Data Link layer (CN chap 3.1, 3.4, 3.6) The OSI model an old friend... Application Presentation Session Transport Network Data link Physical F.eks. ftp, mail, http,... handles data structures and conversion between different representation Sessions f.ex. based on login Connection oriented communication Routing from source to destination Framing of data and error detection at a low level. How to handle lost, duplicated or error packets. Transmitting raw bits. Decides how many volts and milliseconds it takes to send a bit. Data Link layer services Varying from system to system, but normally falls within one of the below three main groups: Unacknowledged connectionless service Acknowledged connectionless service Acknowledged connectionoriented service Used typically in LANs where the error rate is low, or is used for real time traffic where delayed data is worse than erroneous data. Lost packets can be retransmitted, but duplicated and out-of-sequence packets are possible. Packets are delivered guaranteed and in sequence. Notice that reliability in the Data Link layer is just an optimization in relation to leaving the retransmission work to the transport layer. However the Data Link layers packets are typically smaller than the transport layer's packets. Kristoffer Miklas, Niels Brock, Copenhagen Page 1 of 5
Framing How to define and mark a frame? Where does it start and end? Packets can be defined (marking the beginning and end) in different ways: Character count Starting and ending characters, with character stuffing Starting and ending flags, with bit stuffing Physical layer coding violations Kristoffer Miklas, Niels Brock, Copenhagen Page 2 of 5
Error detection and recovery There are many different reasons for a signal not to arrive error free. Some error sources typically produce burst errors while others changes single bits. Error detection Error recovery Discover errors by using checksums and like. The packet is discarded and may be retransmitted again. The packet contain enough redundant information for some data to be recreated in case of error. Error detecting codes parity bit CRC check Error correcting codes redundant bits to increase hamming distance Hamming discovered in 1950 a practical method to achieve the theoretically lowest possible number of redundant bits for correcting bit errors in messages. Bit number 1,2,4,8,16, (2 n ) are used for redundancy. A data bit in position k only contributes to the r bits which are members of: k being expressed as a sum of powers of 2. For example bit 11 only contributes to r bits in position 1, 2 and 8. So a bit error can be recognized as the sum of the r bits where the parity is wrong. Kristoffer Miklas, Niels Brock, Copenhagen Page 3 of 5
Data Link layer Sliding windows (CN chap 3.4) Sliding windows Data packets are given sequential numbers at send time. The sequential numbers can possible by cycled. The sender "window" starts at the lowest packet number not yet acknowledged, and ends at the highest packet number sent. The maximum size of the sender window depends on things like buffer size in the sender system. For example: ---------------- the sender window ----------------------- Packet 1 2 3 4 5 6 Acknowl edged yes no no yes no no In a similar way the receiver has a "window" with the lowest packet number not yet received. The receiver has a fixed window size (4 in the example below) and packets outside this window are ignored. ----------- the receiver window ------------ Packet 1 2 3 4 5 Received yes no no yes no Different versions of sliding windows One bit sliding window (stop and go) Pipelining Go back n Selective repeat Piggybacking of acks Kristoffer Miklas, Niels Brock, Copenhagen Page 4 of 5
Data Link protocol example PPP (CN chap 3.6) PPP - Point to Point Protocol When a newtwork GateWay Router connect to a backbone network Router, it is done buy a private leased line. PPP (or HDLC) is the protocol used between these two routers in different networks. When a home user dials with his modem (or ADSL) to an internet service provider (ISP) Router, then the home PC will use PPP to talk to the ISP Rounter. PPP is handling things like framing, error control, sliding windows, granting IP address to the home PC, checking authentication, and so on. Example: a home user connects to hsi ISP Router via modem or ADSL. After the Router accepts physical connection (bits, speed,...) the PC will send a series of LCP (Link Control Protocol) packets in the payload of some PPP frames. The LCP packets initiates the Data Link and negotiates a PPP/HDLC flavour. Now some NCP (Network Control Protocol) packets are sent inside the PPP payload. Now if the home PC wants to be a TCP/IP host the IP-NCP is used to get configuration information like IP address, network mask, DNS and GW addresses to the home PC. When the home PC wnat to finish, NCP wil close the connection, LCP will close the link, and the model/adsl will close the physical connection. Flag is standard. Payload is gyte stuffed, in HDLC payload is bit stuffed. Address is broadcast as only one station (home PC) and save setup work. Control is 00000011 which is an unnumbered frame so no SEQ-numbers or acknowledgements. (However can be negotiated for noisy conditions) Address and Control is not needed and can be negotiated lost during LCP setup. Protocol is f.ex. IP Payload is fixed and negotiated during LCP setup. Data can be padded. Checksum 2 or 4 bytes depending LCP negotiation. Kristoffer Miklas, Niels Brock, Copenhagen Page 5 of 5