Nixu Oy PL 21
(Mäkelänkatu 91) 00601 Helsinki, Finland tel. +358 9 478 1011 fax. +358 9 478 1030
Automatic Repeat Request and
the Data Link Layer
Reliable Communications with Retransmission
• End to End
— Eg. TCP
• Hop to Hop
— Eg. SMTP, X.25, HDLC
• ARQ
— Automatic Repeat Request
— A technique, abstract concept
— Used in many protocols for reliable transmission
Basic ARQ
• Data (SDUs) is divided/packaged to packets (PDUs) that contain a header and checksum, these are called information frames
• There are also empty packets called control frames
• And there is a timeout mechanism
• Problem: what if a frame is received and acknowledged after the timeout at sender’s end?
Sender Packets in transit
packet 1
packet gets lost waiting for
acknowledgment retransmission
Receiver
packet arrives acknowledgment sent
ARQ Control Frames
• ACK, acknowledgment
• NAK, negative acknowledgment
• ENQ, enquiry
ARQ Sequence Numbers
• It is possible for the sender and receiver to get out of syncronization
— A problem that all protocols must address
• Sender and receiver can be synchronized by having a sequence number in each frame
• In theory one bit sequence number would be sufficient for stop-and-wait ARQ
— Stop-and-wait means that only one frame is in transmission at one time
— One bit sequence number is not sufficient if the network may duplicate frames
• Larger sequence numbers allow multiple frames to be in transit
ARQ Stop-and-Wait Frame Loss
• Information frames are ACKed, control frames not
• When a frame is lost:
• 1) Sender retransmits after timeout or
• 2) ENQ is replied with the last frame sent
— Sender sends ENQ after timeout
— Reciever sends last ACK
Go-Back-N ARQ Frame Loss
• A sufficiently large sequence number and a sliding window are used
• Receiver ACKs only frames in sequence
• When an information frame is lost, it and all frames sent after it must be retransmitted
— Frame loss is recognized either from timeout or the receiver sends a NAK when it receives a frame out of sequence
— The receiver requires a buffer the size of one frame
• If the ACK control frame is lost, a later ACK can replace it
• This increases the efficiency of bandwidth usage compared to stop-and-wait ARQ
Selective Repeat ARQ
• When the receiver recieves a frame out of secuence, it sends a NAK for the missing frame and that frame only is resent
— More complex for the receiver, requires a larger receive buffer
• This is more efficient for channels with large error rates than Go-Back-N ARQ
The Data Link World
• Traditionally the data communications world has been built on
— Local Area Networks
> Ethernet, Token Ring, ATM over physcal media
— Point to point connections between LANs
> HDLC, PPP, SLIP, ATM, Frame Relay, ISDN over telecoms infrastructure
• Also
— Campus networks
> FDDI, HIPPI, ATM, optical rings
— Mobile wireless networks
> GPRS, UMTS, WLAN
— Plenty of other solutions
> Cable modems, Bluetooth
HDLC
• High-level Data Link Control
• Data link layer protocol
• Point-to-point and point-to-multipoint connections
— Unbalanced (master/slave) point-to-point and multipoint
— Balanced point-to-point (each side has dual roles)
• Encapsulates network layer packets (SDUs) to frames (PDUs)
• Provides both connnection oriented and connectionless service
HDLC Frame Format
• Flag is 01111110
— Bit stuffing is used in other data, every 11111 is followed by 0
> This is bit-limited protocol, not byte limited
• Adress is receiver adress
• Control is 8 bits, 16 in extended mode for longer sequences
• Information is paylod data
• CRC is the checksum in ITU-CRC, 16 or 32 bits
Flag Address Control Information (data) CRC Flag
HDLC Control Byte for Information Frame
• Starts with bit 0
• Secuence numbers can be extended with an additional byte to 7 bits from 3
— Receive ACKs may be sent piggypacked in information frames or in control frames
• Poll/Final bit is used for master/slave communications
— In unbalanced mode the secondaries (slaves) may not send without receiving first a frame with the P/F bit on form the primary (master)
1 2-4 5 6-8
0 Send sequence Poll/Final Receive Sequence
HDLC Control Byte for Supervisory Frame
• Starts with bits 10
• Control 00 is RR, Receive Ready (ACK)
• Control 01 is REJ, Reject (NAK)
• Control 10 is RNR, Receive Not Ready
— Sent for eg. buffers full, used for flow control
• Control 11 is SREJ, Selective Reject
— Used to request retransmission of a single frame
1-2 3-4 5 6-8
10 Control field Poll/Final Receive Sequence
HDLC Control Byte for Unnumbered Frame
• Starts with bits 10
• Used to set up connections and master/slave relationships
1-2 3-4 5 6-8
11 Message Poll/Final Message
ATM, Asynchronous Transfer Mode
• Standardized by the ATM Forum, an industry consortium
• When introduced, a competitor for Internet Protocol
> ATM to the desktop
• Currently mostly used as flexible telecoms infrastructure
— Customer connections can be configured immediately from a central control location
— Enables allocation and control of bandwidth (not at the ATM level but at the endpoints)
• ATM network consists of ATM switches that are connected to other switches and ATM nodes using point to point connections
— Different from traditional LAN topologies
How the ATM works
• Two entities want to communicate
• A route over the ATM network is created
— The routing is a separate function from data transmission (switching)
— Currently often done by hand (permanent virtual circuit)
— PNNI protocol exists for creating routes (Private Network to Network Interface)
• The route is named using using a VPI/VCI pair and configured in each switch of the ATM network
— Virtual Path Identifier
— Virtual Channel Identifier
How the ATM works (cont.)
• The ATM packet, called a cell, is exactly 53 bytes long
• The header is 5 bytes long and contains the
— VPI/VCI address (VPI is 8 or 12 bits, VCI is 16 bits)
— Payload type (3 bits)
— Priority (1 bit)
— Header checksum (8 bits)
• The header contains all needed information for the switches to transmit the packet
• The rest of 48 bytes is the payload (data)
— Now how do we use the 48 bytes?
ATM Addressing
• The VPI/VCI pair need to be unique only in each switch along the path
— It may be changed along the switching path
• 20 octet (byte) ATM addresses exist
— 13 bytes of prefix (network address)
— 6 byte ID (can be Ethernet address)
• Other 20 byte addressing schemes exist also
• These are not really used very much
AAL, ATM Adaptation Layer
• The different AAL layers provide ATM services to higher level protocols
• AAL1 provides a constant rate bitstream
— No error detection, missing cells are reported
— Suits for audio and video
• AAL2 was intended for packet data, but is dead
• AAL3/4 is a connection oriented or connectionless stream or packet data service with or without reliability
— Supports multiplexing several connections/packets over a single VPI/VCI
• AAL5 is a more simple and efficient version of the AAL3/4
— The AAL usually selected for IP traffic
The Ethernet
• IEEE 802.3 standard
• A limited distance LAN protocol and cabling standard
• Several physical cabling and bandwidth options
— Coaxial cable 10Base5 and 10Base2, mostly historical
> All nodes connect to the same coax
— Twisted pair 10BaseT, 100BaseT
> Nodes are connected using a hub or switch
— Also optical and wireless Ethernet and gigabit speeds
How the Ethernet Uses the Shared Media?
• 1-persistent CSMA/CD
— Carrier Sense Multiple Access / Collision Detection
• Each node waits for a free moment to send
• If two or more send simultaneously they detect the collision and each stops sending and waits a random interval
• All nodes listen to all traffic and pick their own as directed by the MAC address
Ethernet Addressing
• Each network card has a unique hardware address (MAC)
— In some hardware can be changed with software
— The MAC address usually has a manufacturer ID part and an unique part
— Duplicate MAC addresses in the same LAN happen, but extremely rarely
• Ethernet frames start with a 48-bit destination address followed by a 48-bit source address
• Hosts can send unicasts or broadcasts
— The broadcast is used to find who else is on the same LAN
— Or to find who has a certain IP address on this LAN (ARP)
Hubs and switches
• Twisted pair Ethernet hosts use a physical star configuration
• A hub repeats all traffic to all stations
• A switch learns which MAC addresses are in which physical ports and transmit only necessary traffic
— Security point: switches are harder to eavesdrop, but can usually be made to enter a fail- safe mode, where they act as a hub
• Switches provide better performance than hubs
• Both may be chained within certain limits
Extending Ethernet
• The physical reach of the Ethernet can be extended using repeaters, bridges and other devices
• However having a large (many hosts) Ethernet is very vulnerable to problems
— Broadcast storms can cripple the whole network (as happened to FUNET once)
• There is a reason for the higher level protocols like IP
Lan topologies
• Lans can be
— Buses
— Stars
— Rings
— Other
> A switch with connections to local hubs, a star of stars
— Wireless
> Raises interesting problems, A can see B, B can see C, A can not see C...
LAN cabling
• Expensive, difficult to change afterwards
— The reason for 10BaseT was the ability to use existing telephone cabling
• Since the analog signals are RF, the quality of cabling and connectors is very important
— CAT 5 minimum
• The physical routing of the cabling creates security considerations
• The physical maximum length of a single hub to workstation and overall cabling length creates installation considerations
Token Ring
• Instead of collision detection, there is a token (data) circulating in the network
• The node having the token at the moment has the permission to send, all others must wait for their turn
• The protocol must be able to handle situations like the node dieing, while it posesses the token
— Usually if there is no token seen within a certain time period, a new token is created
• IBM Token Ring network was physically a star, logically a ring
ATM LANs
• ATM uses only point to point connections
• IP on a LAN assumes that local network addresses can be reached directly and traffic to other addresses must be sent to the router
• There are several workarounds that make it possible to build an IP LAN using ATM
— Most common is an ATM LAN Emulation server that emulates broadcasts and other serv- ices
• But the 100 Mbps switched Ethernet killed the need for ATM LANs
Point-to-point links
• Need to connect 2 networks or computers with a dedicated link
— dial-up hosts and modem pools, inter-office routing
• Endpoints might be single computers, routers or bridges
• Dial-up connections, on-demand routing
— Dial-up access to networks with telephone/ISDN lines
— Routing between offices over leased lines
— Encapsulating of network routes over different networks (tunneling)
SLIP overview
• Simple packet framing protocol
— Framing is done with END (octal 300) and ESC (octal 333) special characters. Sender just transfers data packet and END
— Occurrances of END and ESC characters in data bytes are escaped with two byte sequences (ESC+octal 334 nad ESC+octal 335, respectively)
• Static IP addresses for endpoints
— Every dial-up client needs own IP address
• No type field for packets
— only one protocol over one SLIP connection
PPP overview
• Specification in RFCs 1661,1662, 1663 and others
• A protocol capable of multiplexing different network protocols over a single point-to-point link
— For example IP, IPX, XNS and AppleTalk concurrently
— HDLC-like
• Carefully designed for compatibility with most commonly used hardware
• Independent protocols for link and network control
— Link encapsulation options, authentication and link quality control configured with link control protocol, with reasonable default values
— Extensible with new network protocols: each network protocol has its own network control packets and configuration options
Practical PPP examples
• Dial-up Internet connections
— Physical connection with modem or ISDN
— Dynamic IP addresses and network configuration for clients
— Easy to install and reliable
— Supported for almost all client platforms
• Simple VPN (Virtual private network) over TCP/IP and ssh
— Secure Shell connection from distant location to intranet over untrusted networks
— PPP runs over SSH connection with link ends in secure networks
— Packets from distant location to intranet are routed over PPP to intranet. Cheap, dirty and practical VPN solution
… Practical PPP examples
• PPP over Ethernet
— Specified in RFC 2516
— Used in some DSL and cable modem configurations
— Makes it possible to decouple providing
— Integrates with existing authentication/billing systems
Description of a PPP Session
• Simplified PPP state diagram:
— Session up/down events not shown (from hardware or manually)
Dead
Terminate
Establish
Network
Authenticate SUCCESS/NONE
FAIL
DOWN
FAIL
OPENED UP
CLOSING
Some Other Data Link Protocols
• ISDN
• Frame Relay
• FDDI
• GPRS + UMTS
• WLAN
• Bluetooth
• Cable modems
• And the mighty IP runs over everything