Computer Networks

From Computing Study
Jump to: navigation, search

The OSI Model

Application

  • Network processes to applications: Provides network services to application processes (such as electronic mail, file transfer and terminal emulation). Provides user authentication

Presentation

  • Data representation: Ensures that data is readable by the receiving system. Formats data. Structures data. Negotiates data transfer syntax for application layer. Provides encryption.

Session

  • Interhost communication: Establishes, manages and terminates sessions between applications

Transport

  • End-to-end communications: Handles transportation issues between hosts. Ensures data transport reliability. Establishes, maintains and terminates virtual circuits. Provides reliability through fault detection and recovery information flow control.

Network

  • Data delivery: Routes data packets. Selects best path to deliver data. Provides logical addressing and path selection.

Data Link

  • Access to media: Defines how data is formatted for transmission and how access to the network is controlled. Also provides error detection.

Physical

  • Binary transmission: Defines the electrical, mechanical, procedural and functional specifications for activating, maintaining and deactivating the physical link.

TCP/IP

Application Layer

  • Enables user to access the network. Provides services such as email, file transfer. Concerned with representation, encoding and dialogue control

Transport Layer

  • Provides access to instances of specific applications. Can provide a connectionless or connection-oriented service. Provides process-to-process communication.

Internet Layer

  • Deals with logical addressing (IP addresses). Responsible for the routing of packets through a network. Provides a connectionless, best-efforts service. Provides host-to-host communication.

Network Access Layer

  • Provides for the transmission of unstructured bit streams over the physical medium. Deals with the mechanical, electrical, functional and procedural characteristics to access the physical medium.

Networks

Bus

  • Advantages: Easy to set up; small amount of wire
  • Disadvantages: Slow; easy to crash

Star

  • Advantages: Easy to set up; one cable cannot crash the network
  • Disadvantages: One hub crashing downs the entire network; uses lots of cable

Ring

  • Advantages: Time to send data is known; no data collisions
  • Disadvantages: Slow; lots of cable

Mesh

  • Advantages: Data will always be delivered
  • Disadvantages: Lots of cable; hard to set up

Networks-table.png

Layer 1 - Physical

UTP Cables
Cat5 (100Mhz) - Data to 100Mbps (Fast Ethernet)
Cat5e (100Mhz) - Data to 1000Mbps (Full Duplex Fast Ethernet and Gigabit Ethernet)
Cat6 (250Mhz) - Data to 1000Mbps (more stringent specifications for crosstalk and system noise)

Coaxial Cables
Better shielding, more bandwidth for longer distances and higher rates than twisted pair.

Fibre
High speed point to point (10s - 100s Gbps)
Low error rate - repeaters spaced far apart - immune to electromagnetic noise
Single mode - Core so narrow (10µm - used with lasers for long distances e.g. 100km
Multi-mode - Used with LEDs for cheaper shorter distance links

Wireless Media
IEEE 802.11 (WiFi) uses CSMA/CA media access process
IEEE 802.15 WPAN or Bluetooth
IEEE 802.16 WiMAX (microwave) - point to multipoint
GSM (mobile) includes physical layer specifications

Bandwidth
Measures the amount of information that can flow from one place to another in a given amount of time. The practical bandwidth of a network is determined by a combination of factors: the properties of the physical media and the technologies chosen for signalling and detecting networks.

Throughput
The measure of transfer of bits across the media over a given period of time. Factors that influence throughput: amount of traffic, the type of traffic and the number of network devices encountered on the network being measured.

Goodput
The measure of useable data transferred over a given period of time. Unlike throughput, which measures the transfer of bits and not the transfer of useable data, goodput accounts for bits devoted to protocol overhead. Goodput is throughput minus traffic overhead for establishing sessions, acknowledgements and encapsulation.

Myquist's theorem
Relates the data rate to the bandwidth and number of signal levels.

Shannon's theorem
Relates the data to the bandwidth and signal strength relative to the noise.

Bits are represented on the medium by changing one or more of the following characteristics of a signal: Amplitude, Frequency, Phase.

Non-return to zero - 1 -> high signal; 0 -> low signal
Disadvantages: When there is a long sequence of 1's or 0's. Sensitive to clock skew. I.e. difficult to do clock recovery.

Non-return to zero inverted - 1 -> make transitions; 0 -> stay at the same level
Solves previous problems for long sequences of 1's but not for 0's

Manchester - 1 -> high-to-low transition; 0 -> low-to-high transition
Addresses clock recovery problem
Disadvantage: signal transition rate doubled

  • Useful data rate on the same physical medium halved
  • Efficiency of 50%
  • Transition at centre of bit period

Differential Manchester

  • 0 - transition period at beginning and at centre
  • 1 - transition at centre of bit period. No transition at beginning

Layer 1 devices

  • Repeater
  • Hub is just a multi-port repeater
  • NIC

Layer 2 - Data Link

Provide service interface to the Network Layer
Framing, link access

  • Encapsulate datagram into frame, adding header, trailer
  • Implement channel access if shared medium
  • Physical addresses used in frame headers to identify source, destination (MAC addresses -> different from IP addresses)

Reliable delivery between two physically connected devices
Flow control - pacing between sender and receivers
Error detection - caused by signal attenuation or noise - receiver detects presence of errors and signals sender for retransmission
Error correction - identifies and corrects bit errors without resorting to retransmission

Ethernet Frame
Ethernet-frame.png

Preamble - 7 bytes with pattern 10101010 followed by one byte with patters 10101011 used to synchronise receiver and sender clock rates

Addresses - 6 byte source and destination MAC addresses

  • If adapter receives frame with matching destination address, or with broadcast address (e.g. ARP packet), it passes data in frame to network layer protocol
  • In MAC addressing (layer 2), the broadcast address is the MAC address FF:FF:FF:FF:FF:FF
  • Otherwise the adapter discards the frame

Type - indicates higher layer protocol (mostly IP but others are possible, e.g. Novell, IPX, AppleTalk)

CRC - Cyclic Redundancy Check at receiver - error detected > frame is dropped

MAC Address
Unique identifier assigned to NIC for communications on the physical network segment
6 groups of 2 hexadecimal digits, separated by hyphens
The first three octets identify the organisation that issued the identifier and are known as the Organisationally Unique Identifier (OUI)
The following three octets are assigned by that organisation
Broadcast address would be FF:FF:FF:FF:FF:FF

To get network configuration information
Windows - ipconfig/all
Mac - networksetup -listallhardwareports
Linux - ifconfig -a

Parity Checking
Single Bit Parity - detect single bit errors
Two Dimensional Bit Parity - detect and correct single bit errors

Cyclic Redundancy Check
More powerful
View data bits D as binary number
Choose R + 1 bit pattern (generator) G
Goal: choose CRC bits R such that

  • < D, R > exactly divisible by G (modulo 2)
  • Receiver knows G, divides < D, R > by G. If non-zero remainder -> error detected!
  • Can detect all burst error less than r + 1 bits
  • Widely used in practice (Ethernet, 802.11, WiFi, ATM)

Ethernet
Segment - single shared medium
Frame - variably sized chunks of information

Connectionless - no handshaking
Unreliable - receiving NIC doesn't send acks nor nacks - data in dropped frames is only recovered if sender uses higher layer RDT
Ethernet's MAC protocol unslotted CSMA/CD with binary backoff

CSMA/CD Carrier sense - When a device connected to an Ethernet network wants to send data, it first checks to make sure it has a carrier (usually a piece of copper cable)
Multiple Access - This means that all machines on the network are free to use it whenever they like as long as no-one else is transmitting
Collision Detection - when two machines transmit simultaneously, the corrupted data is discarded and re-transmissions are generated at differing time.
Single Ethernet segment can handle 40 - 70 users

Monitor carrier sense signal before transmission (listen before transmitting)
If busy, delay transmission
Should a collision occur:

  • Stop transmission (listen while transmitting)
  • Send out short jam sequence
  • Reschedule a transmission after a random interval (binary exponential backoff)

Token Passing
Token Ring, FDDI, and Token Bus
A physical or logical ring is formed
A token is passed from station to station in sequence
To transmit, a station must wait for the token
On arrival of the token, if the station has any data, it transmits the data by converting the token into a data frame, otherwise the station may hold the token for up to a default duration and if it still has not data the station must relinquish the token to its downstream neighbour.

Ethernet Hub
Star wired bus
Data still travels to each of the other machines
Still possible for collisions to occur, but hubs have advantage of centralised wiring and can automatically bypass any ports that are disconnected or faulty
Makes the network more fault tolerant than a coax-based system
Hubs are very rare these days

Switch
Machines can transmit simultaneously
The switch reads the destination address and 'switches' the signal directly to the recipients without broadcasting to all of the machines on the network
This 'point-to-point' switching alleviates the problems associated with collisions and considerably improves network speed
Break the collision domain
Switch is a multi-port bridge
Link-Layer device: it takes an active role
Examine incoming frame's MAC address, selectively forward frame to one or more outgoing links when frame is to be forwarded on segment, uses CSMA/CD to access segment
Cut-through vs store and forward
Transparent - hosts are unaware of the presence of switches
Plug and Play - switches do not need to be configured
Multiple simultaneous transmissions
Switches buffer packets
Ethernet protocol used on each incoming link, but no collisions - full duplex, each link is its own collision domain
Switching A-to-A and B-to-B can transmit simultaneously without collisions
Each switch has a switch table, each entry has the MAC address of the host, the interface to reach host, time stamp
Switch learns which hosts can be reached through which interfaces. When frame is received, switch 'learns' the location of the sender via its incoming LAN segment
Records sender/location pair in switch table
Switches can be connected together

When the frame is received at the switch:

  • Record incoming link, MAC address of the sending host
  • Index switch table using MAC destination address
  • If entry is found for the destination then {
if destination on segment from which frame arrived
then drop frame
else forward frame on interface indicated by entry
} else {
flood /* forward on all interfaces except arriving interface */

Layer 3 - Routing and Addressing

Responsible for delivering packets between endpoints over multiple links
Routing: determine the route taken by packets from source to destination using routing algorithms
Forwarding: move packets from router's input to appropriate router output
Routing algorithm determines end-to-end path through the network
Forwarding table determines local forwarding at this router

Internet Protocol Characteristics
Operates at Network Layer of OSI
Connectionless protocol -> packets treated independently
Best effort delivery
No data recovery features
Hierarchical addressing -> IP

Connectionless Service
Packet is forwarded using destination address inside it
Different packets may take different paths

Connection Orientated
Packet is forwarded along a virtual circuit using tag inside it
Virtual circuit (VC) is set up ahead of time

IP addresses uniquely identify each device on an IP network
IP addresses are assigned by organisations to individual devices

Class A: First 1 bit fixed - 0xxxxxxx.Host.Host.Host
Class B: First 2 bits fixed - 10xxxxxx.Network.Host.Host
Class C: First 3 bits fixed - 110xxxxx.Network.Network.Host

IP Address Ranges

IP Address Class First Octet Decimal Value First Octet Binary Value Possible Number of Hosts
Class A 1-126 00000001 to 01111110 16,777,214
Class B 128-191 10000000 to 10111111 65,534
Class C 192-223 11000000 to 11011111 254

127 (01111111) is a Class A address reserved for loopback testing and cannot be assigned to a network

IP fragmentation reassembly
Network links have MTU - largest possible link-level frame - different link types, different MTUs
Large IP datagrams divides (fragmented)

  • One datagram becomes several datagrams
  • Reassembled at the final destination
  • IP header bits used to identify and order related fragments

Subnet Masks
Tells the router the number of bits to look at when routing
Defines the number of bits that are significant
Used as a measuring tool, not to hide anything

Subnetworks
Flat topology problems

  • All devices share the same bandwidth
  • All devices share the same broadcast domain
  • It is difficult to apply a security policy

Solution: Subnetting

  • Smaller networks are easier to manage
  • Overall traffic is reduced
  • You can more easily apply network security policies

Possible subnets and hosts for a Class C network
Network.Network.Network.xxxxxxxx

Number of bits borrowed Number of subnets possible Number of bits remaining in Host ID Number of hosts possible per subnet
1 2 7 126
2 4 6 62
3 8 5 30
4 16 4 14
5 32 3 6
6 64 2 2
7 128 1 2

Possible subnets and hosts for a Class B network
Network.Network.xxxxxxxx.xxxxxxxx

Number of bits borrowed Number of subnets possible Number of bits remaining in Host ID Number of hosts possible per subnet
1 2 15 32,766
2 4 14 16,382
3 8 13 8,190
4 16 12 4,094
5 32 11 2,046
6 64 10 1,022
7 128 9 510

Possible subnets and hosts for a Class A network
Network.xxxxxxxx.xxxxxxxx.xxxxxxxx

Number of bits borrowed Number of subnets possible Number of bits remaining in Host ID Number of hosts possible per subnet
1 2 23 8,388,606
2 4 22 4,194,302
3 8 21 2,097,150
4 16 20 1,048,574
5 32 19 524,286
6 64 18 262,142
7 128 17 131,070

Subnet Mask
IP address has two components: network and host
A subnet mask separates the IP address (<network><host>)
Subnet mask identifies the network address of an IP address by a bitwise AND on the netmask
Subnet mask is made by setting network bits to all 1's and setting host bits to all 0's
Within a given network, two host addresses are reserved and cannot be assigned to hosts

  • The 0 address is assigned to a network address
  • 255 is assigned to a broadcast address

Class A subnet mask:

Network . Host . Host . Host
255 . 0 . 0 . 0

Class B subnet mask:

Network . Host . Host . Host
255 . 255 . 0 . 0

Class C subnet mask:

Network . Host . Host . Host
255 . 255 . 255 . 0


IP: 1101 1000 . 0000 0011 . 1000 0000 . 0000 1100 - (216 . 003 . 128 . 012)
Mask: 1111 1111 . 1111 1111 . 1111 1111 . 0000 0000 - (255 . 255 . 255 . 000)
Bitwise AND 1101 1000 . 0000 0011 . 1000 0000 . 0000 0000

Subnetting
Divides the host of an IP address into (<network><subnet><host>)
Subnetting an IP address is to separate a big network into smaller multiple networks
Performance of a network is adversely affected under heavy traffic load
All nodes (hosts) in a subnetwork see all packets transmitted by any node in a network

Subnetting example
216 . 003 . 128 . (0000 0000) (1st half assigned to the web host)
216 . 003 . 128 . (1000 0000) (2nd half assigned to the customers)

216 . 003 . 128 . (1000 0000) Customer 1 gets 16 IPs (14 usable)
216 . 003 . 128 . (1001 0000) Customer 2 gets 16 IPs (14 usable)
216 . 003 . 128 . (1010 0000) Customer 3 gets 16 IPs (14 usable)
216 . 003 . 128 . (1011 0000) Customer 4 gets 16 IPs (14 usable)
216 . 003 . 128 . (1100 0000) Customer 5 gets 16 IPs (14 usable)
216 . 003 . 128 . (1101 0000) Customer 6 gets 16 IPs (14 usable)
216 . 003 . 128 . (1110 0000) Customer 7 gets 16 IPs (14 usable)
216 . 003 . 128 . (1111 0000) Customer 8 gets 16 IPs (14 usable)

CIDR - Classless Inter Domain Routing
CIDR was invented to keep the internet from running out of IP addresses
The IP4 addresses have a limit of 4,294,967,296 unique IP addresses
The classful address scheme of allocating IP addresses in 8-bit increments can be very wasteful

  • A minimum number of IP addresses allocated to an organisation is 256
  • An organisation requiring more than 256 IP addresses is assigned a Class B, which allocates 65,636 addresses

An organisation requiring more than 65,636 addresses is assigned a Class A network, which allocates 16,777,216 IP addresses With CIDR, a network of IP addresses is allocated in 1 bit increments
The use of a CIDR notated address can easily represent classful addresses (Class A = /8, Class B = /16, Class C = /24)
The example shown above can be illustrated with CIDR as follows:
216 . 3 . 128 . 12 with subnet mask of 255 . 255 . 255 . 128 is written as 126 . 3 . 128 . 12 / 25
Similarly, the 8 customers with the block of 16 IP addresses can be written as 216 . 3 . 128 . 129 / 28, 216 . 3 . 128 . 130 / 28 etc

IPv6
IPv6 uses a 128 bit numbering scheme
It is intended to replace the IPv4 but the introduction of CIDR allocation scheme in 1993 prolonged its lifespan
As of May 2014 per Google statistics, 95% of internet traffic was IPv4 and only 4% IPv6. By May 2018 this had risen to 22% and 78% respectively.
IPv4 and IPv6 are not interoperable by design, so the transition requires 'transition mechanisms' to make them interoperable.

IPv6 addresses are classfied into three categories:

  • Unicast address - A unicast IP address is an identifier for a single network interface. An IPv6 packet sent to a unicast address is delivered to a single interface
  • Anycast address - An anycast IP address is an identifier for a set of interfaces assigned to a group but belonging to different nodes. An IPv6 packet sent to an anycast address is delivered to a single node closest to the sender identified by the routing algorithm
  • Multicast address - A multicast IP address is an identifier for a set of interfaces that may belong to different nodes. An IPv6 packet sent to a multicast address is delivered to all interfaces identified by the multicast address.

Coloned Decimals
IPv6 addresses are comprised of 128 bits (or 8 groups of 4 hexadecimal digits separated by colons)
When abbreviating IPv6 addresses, the following rules apply:

  • One or more leading zeros in any group of 8 hexadecimal digits can be removed. For example, 0012 can be written as 12 and 0000 can be converted to 0
  • Consecutive groups of zeros are replaced by a double colon :: The loopback address 0000:0000:0000:0000:0000:0000:0000:0001 can be abbreviated to ::1

An example of an IPv6 address may look like
2001:0bd8:0012:0001:3c5e:7354:0000:5db1

The example address can also be represented as
2001:db8:12:1:3c5e:7354:0:5db1

Routing Protocols
Routing protocols are used between routers to determine paths and maintain routing tables
Once the path is determined, a router can route a routed protocol.
Static:

  • Uses a route that a network administrator enters into the router manually
  • Routes change slowly over time

Dynamic

  • Uses a route that a network routing protocol adjusts automatically for topology or traffic changes
  • Route change more quickly
    • Periodic update
    • In response to link cost changes

Global

  • All routers have complete topology and link cost info

Decentralised

  • Router knows physically-connected neighbours and link costs to neighbours
  • Iterative process of computation - exchange of information with neighbours e.g. 'distance vector' algorithms

Layer 4 - Transport

Responsible for delivering data across networks with the desired reliability or quality

Services:

  • Segmenting upper layer application data
  • Establishing end-to-end operations
  • Sending segments from one end host to another end host
  • Ensuring flow control provided by sliding windows
  • Ensuring reliability provided by sequence numbers and acknowledgements

Reliability - repetition
Flow control - speed and pausing when the receive buffer is full

UDP Characteristics

  • Is a connectionless protocol
  • Operates at transport layer of OSI and TCP/IP models
  • Provides applications with access to the network layer without the overhead of reliability mechanisms
  • Provides best effort delivery
  • Provides limited error checking
  • Has no data recovery features

UDP Header

16-bit source port 16-bit destination port
16-bit UDP length 16-bit UDP checksum
Data

TCP Characteristics

  • Transport player of the TCP/IP stack
  • Access to the network layer for applications
  • Connection-oriented protocol
  • Full-duplex mode operation
  • Sequencing of data packets
  • Acknowledgement of receipt
  • Error checking
  • Data recovery features

TCP Header
Tcp-header.png

The purpose of the transport layer is to hide the network requirements from the application layer
Connection-oriented transport provides reliable transport; Connectionless transport provides best-effort transport
UDP is a protocol that operates at the transport layer and provides applications with access to the network without the overhead of the reliability mechanisms of TCP. UDP is a connectionless best-effort delivery protocol
TCP is a protocol that operates at the transport layer and provides applications with access to the network layer. TCP is a connection-oriented , provides error checking, delivers data reliably, operates in full-duplex mode and provides some data recovery functions
TCP/IP supports a number of applications, including FTP (supports bidirectional binary and ASCII file transfers), TFTP (transfers configuration files and Cisco IOS images) and Telnet (provides capability to remotely access another computer
IP uses a protocol number in the datagram header to identify which protocol to use for a particular datagram
Port numbers are used to map Layer 4 to an application
Flow control avoids the problem of a transmitting host overflowing the buffers in the receiving host and slowing network performance
TCP provides sequencing of segments with a forward reference acknowledgement. When a single segment is sent, receipt is acknowledged and the next segment is sent
The TCP window size decreases the transmission rate to a level at which congestion and data loss do not occur. The TCP window size allows a specified number of unacknowledged segments to be sent
A fixed window size is a window that can change size dynamically to accommodate the flow of segments
TCP provides the sequencing of segments by providing sequence numbers and acknowledgement numbers in TCP headers

Multiplexing

Multiplexing is a technique to place multiple signals on a single communications channel by partitioning the channel into many separate channels. Multiplexing - sharing of a link's capacity.
Inverse multiplexing (line aggregation) is the aggregation of several low capacity channels to form a higher capacity channel.

Frequency Division Multiplexing
A channel uses part of the bandwidth all of the time.

Wavelength Division Multiplexing
WDM creates several different chanels over the same fibre
Fibre has a bandwidth of about 25 x 1012Hz. Electronic components can provide bit rates of up to about 2.5Gbps, so most of the bandwidth of a fibre is unused.
In WDM, lasers of different wavelengths are modulated by separate data streams which are then added together and then sent down the fibre.
At the other end of the link the different wavelengths are separated out, individually demodulated and all the data streams recovered.

Synchronous Time Division Multiplexing
Each channel uses all of the bandwidth for part of the time.
Each channel being given the same amount of time.

TDM Framing
No headers or trailers
Flow control needed.
Error control and flow control on a per channel basis.
Link control protocol not needed to manage TDM links.
For the E-1 carrier, frames and multi-frame synchronisation are obtained by FAS and MAS.
Other methods of framing - added digit framing.
Synchronising of data sources achieved through pulse stuffing.

Statistical Time Division Multiplexing
Some channels have all the bandwidth for longer than others.
Dynamic allocation of time slots on demand.
Higher overhead - address information is needed.

Summary
Multiplexing is the name given to techniques, which allow more than one message to be transferred via the same communication channel.
The channel in this context could be a transmission line e.g. a twisted pair or coaxial cable, a radio system or a fibre optic system etc.
Various multiplexing methods are possible in terms of the channel bandwidth and time, and the signal, in particular the frequency, phase or time.

The two basic methods are:

Frequency Division Multiplexing
FDM is derived from AM techniques in which the signals occupy the same physical line but in different frequency bands. Each signal occupies its own specific band of frequencies all of the time i.e. the messages share the channel bandwidth.

Time Division Multiplexing
TDM is derived from sampling techniques in which messages occupy all the channel bandwidth but for short time intervals i.e. the messages share the channel time.

Layer 5 - Session

The session layer established, manages, and terminates sessions between applications. This includes starting, stopping, and re-synchronising communications between applications on two computers.

Dialogue separation is the orderly initiation, termination, and managing of communication.

The session layer provides a way to insert checkpoints into the data stream, so if the data flow is interrupted, only the data after the last checkpoint has to be repeated.

Dialogue controls communicate between two computers involving may mini-conversations. One requirement of these mini-conversations is that each host pays dual roles. They are requesting service, like a client, and replying with service, like a server. Determining which role they are playing at any given moment is called dialogue control.

The session layer decides whether to use two-way simultaneous conversation or two-way alternate communication. Two-way alternate communication involves the use of a session layer data token that allows each host to take turns. If two-way simultaneous communication is allowed, then the communication can go in both directions at the same time. It is possible to have session layer collisions. At this level, collisions can only occur as two messages pass each other and cause confusion in either, or both communicating hosts.

Session Layer Protocols

  • SQL
  • Remote Call Procedure (RPC)
  • X-Window System
  • AppleTalk Session Protocol
  • Digital Network Architecture Session Control Protocol

Layer 6 - Presentation

  • Ensure data is readable by the receiving system
  • Format of data
  • Data structures
  • Negotiates data transfer syntax for the application layer

Data Translation
A sending computer receiving data from the application layer will need to convert data from the receiving format to a format understood and accepted by other layers of the OSI model to ensure smooth file transfer. The receiving computer is responsible for the conversation of the 'external format' with which data is received from the sending computer to one accepted by the other layers in the host computer.

Encryption

Compression
The goal of data compression is to represent an information source as accurately as possible using the fewest number of bits.