+ All Categories
Home > Documents > 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific...

1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific...

Date post: 03-Jan-2016
Category:
Upload: amie-haynes
View: 213 times
Download: 0 times
Share this document with a friend
Popular Tags:
54
1 The Data Link Layer Babu Ram Dawadi
Transcript
Page 1: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

1

The Data Link Layer

Babu Ram Dawadi

Page 2: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

2

The Data Link Layer

• The data link layer has three specific functions:

1. Provide a well-defined interface to the network layer.

2. Deal with transmission errors.

3. Regulate the flow of data (so that slow receivers are not overloaded).

Page 3: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

3

The DLL (cont’d)

• The Data Link Layer sits between the Network Layer and the Physical Layer.

• The DLL provides an interface for the Network Layer to send information from one machine to another.

• To the Network Layer, it looks as though the path to the new machine happens at the DLL level, when it is really happening at the physical level.

Page 4: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

4

Data Flow

Page 5: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

5

How data is moved.

• The DLL is responsible for taking the packets of information that it receives from the Network Layer and putting them into frames for transmission.

• Each frame holds the payload plus a header and a trailer (overhead).

• It is the frames that are transmitted over the physical layer.

Page 6: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

6

Packets and Frames

Page 7: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

5: DataLink Layer 5-7

Link Layer Services• Framing, link access:

– encapsulate datagram into frame, adding header, trailer– channel access if shared medium– “MAC” addresses used in frame headers to identify source,

dest

• different from IP address!• Reliable delivery between adjacent nodes

– seldom used on low bit error link (fiber, some twisted pair)– wireless links: high error rates

Page 8: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

5-8

Link Layer Services (more)• Flow Control:

– pacing between adjacent sending and receiving nodes

• Error Detection: – errors caused by signal attenuation, noise. – receiver detects presence of errors:

• signals sender for retransmission or drops frame

• Error Correction: – receiver identifies and corrects bit error(s) without resorting to

retransmission

• Half-duplex and full-duplex– with half duplex, nodes at both ends of link can transmit, but not

at same time

Page 9: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

5: DataLink Layer 5-9

Adaptors Communicating

• link layer implemented in “adaptor” (aka NIC)– Ethernet card, 802.11 card

• sending side:– encapsulates datagram in a

frame– adds error checking bits,

rdt, flow control, etc.

• receiving side– looks for errors, rdt, flow

control, etc– extracts datagram, passes

to rcving node

• adapter is semi-autonomous

• link & physical layers

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

Page 10: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

10

DLL Services

• The Data Link Layer can offer many different services.

• These services can vary from system to system.

• Common services:– Unacknowledged connectionless service.– Acknowledged connectionless service.– Acknowledged connection-oriented service.

Page 11: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

11

Unacknowledged Connectionless Service

• No acknowledgement from the receiving machine.

• No logical connection is set up between the two machines.

• The DLL will make no attempt to detect the loss of or recover a lost frame.

• This service is useful for low error rate networks and for real-time traffic where late data is worse than no data.

Page 12: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

12

Acknowledged Connectionless Service

• The receiver acknowledges the arrival of each frame.

• If it hasn’t arrived correctly (or within the correct time) it can be resent.

• This is a useful service when the connection is unreliable (such as wireless)

• There is no requirement for such an acknowledgement service to be implemented by the Data Link Layer.

Page 13: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

13

Acknowledged Connection-Oriented Service

• A connection is established between the two machines.

• The frames are then transmitted and each frame is acknowledged.

• The frames are guaranteed to arrive only once and in order.

• This is the same as a “reliable” bit stream.• The connection is released once the

communication is complete.

Page 14: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

14

Extra DLL Features

• The DLL does not have to implement the acknowledged connectionless service – the error handling can be managed at the network layer.

• It is an optimization at the DLL because it requires only retransmitting a frame only – not a whole message.

• This speeds up the sending of larger messages on poor networks.

Page 15: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

Framing:

• How can the receiver detect frame boundaries?

• That is, how can the receiver recognize the start and end of a frame?

SENDER RECEIVER

Frame #1Frame #2Frame #n …

Translates the physical layer's raw bit stream into discrete units called frames

Four methods:1. Character count.2. Flag bytes with byte

stuffing3. Starting and ending

flags, with bit stuffing4. Physical layer coding

violations

Page 16: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

16

Character Count

• We use a field in the header to specify the number of characters in the frame.

• This method can cause problems if the count is garbled in transit.

• The receiver will be able to tell the frame is bad (due to a bad checksum)

• The receiver will not know where to pick up and the sender will not know how much to resend.

• This method is rarely used anymore.

Page 17: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

17

Character Count Example

Page 18: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

18

Flag Bytes (with byte stuffing!)

• Frames begin and end with special bytes.

• Often used are the same start/end flag.

• If the receiver gets “lost”, it just looks for a pair of flag bytes to denote the end of one frame and the start of the next.

• What happens if the “flag” byte is accidentally transmitted in the message?

Page 19: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

Byte stuffing and unstuffing

Byte stuffing is the process of adding 1 extra byte whenever there is a flag or escape character in the text.

Page 20: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

20

Example of Byte Stuffing

Page 21: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

21

What about Bit Stuffing?

• We could have problems with two machines communicating where one uses 8-bit characters and one uses 16-bit characters.

• We stuff bits instead of bytes.• Most DLL protocols use a combination of

character count with another method for extra safety. This increases the chances of catching an error.

Page 22: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

Framing Bit Stuffing Use reserved bit patterns to indicate the start and end of a frame.

For instance, use the 4-bit sequence of 0111 to delimit consecutive frames. A frame consists of everything between two delimiters.

0111 frame 0111

Problem: What happens if the reserved delimiter happens to appear in the frame itself? If we don't remove it from the data, the receiver will think that the incoming frame is actually two smaller frames!

Solution: Use bit stuffing. Within the frame, after every occurrence of two consecutive 1's insert 0. E.g., append a zero bit after each pair of 1's in the data. This prevents 3 consecutive 1's from ever appearing in the frame.

Likewise, the receiver converts two consecutive 1's followed by a 0 into two 1's, but recognizes the 0111 sequence as the end of the frame.

Page 23: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

Framing – bit stuffing

Bit stuffing(a) The original data.(b) The data as they appear on the line.(c) The data as they are stored in receiver’s memory after

destuffing.

Page 24: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

24

Error Control

• We use bit and byte stuffing as a method for detecting and determining errors in the data that we send.

• We also have to deal with making sure that the frames make it to their destination.

• The receiver sends back a control frame acknowledging the received frame and the condition of the frame.

• A timeout can occur if the acknowledgement doesn’t arrive, resulting in the frame being resent.

Page 25: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

25

Error Control (cont’d)

• Resending the frame can also cause problems – what happens when the same frame is received twice?

• We can also sequentially number the frames to prevent this problem.

• There are many different ways to do this type of error control (and it can be done at different levels as well).

Page 26: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

26

Flow Control

• We must deal with the issue where the sender is sending data at a higher rate than the receiver can receive the data.

• There are two approaches to this problem:– feedback-based flow control

• feedback is used to tell the sender how the receiver is doing or to send another frame

– rate-based flow control• the transfer rate is fixed by the sender• this is not used often in the DLL

Page 27: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

27

Data Link Protocols

• We assume that the three layers (physical, data link and network) are independent and communicate through a well-define interface.

• We will assume that the library for this interface will contain routines such as to_physical_layer and from_physical_layer to send and receive data.

Page 28: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

28

Simplex: Stop-and-Wait Protocol

• One of the easiest ways of controlling the speed in which data is transmitted.

• Once a frame has been received by the data link layer on the receiving end, the receiver sends an “empty” frame back to the sender to notify the sender that it is ready for another frame.

• Acknowledging each frame means that the sender must stop and wait.

Page 29: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

Figure shows an example of communication using this protocol. It is still very simple. The sender sends one frame and waits for feedback from the receiver. When the ACK arrives, the sender sends the next frame. Note that sending two frames in the protocol involves the sender in four events and the receiver in two events.

Page 30: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

30

Simplex: Noisy Channels

• We must be able to deal with dropped and mangled frames from a noisy channel.

• What do we do if the data arrives damaged?

• What do we do if the frame header is damaged?

• What do we do if the frame is dropped?

• Will a timer on the sender work?

Page 31: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

31

Simplex: Sequence Numbers

• The receiver must be able to determine if a frame is an original or a retransmission.

• To do this, we sequentially number the frames as they are sent.

• If the receiver does not receive a frame, it can ask for that specific frame to be retransmitted.

• If the frame arrives twice, the receiver can ignore the second frame.

• We can number the frames with a single bit.

Page 32: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

32

Duplex Protocols

• As opposed to sending information in only one direction, we should make full use of the connection.

• We are already sending acknowledgements back on the connection, so why not data?

• We can use the header of the frame to denote if it is an acknowledgement frame or a data frame.

Page 33: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

33

Piggybacking

• As opposed to sending an acknowledgement for each received packet, we can piggyback the “ack” on the next data frame going from one machine to the other.

• This give the “ack” a free ride and decreases the overhead.

Page 34: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

34

Sliding Window Protocol - Sending

• The sender has a “window” of frames that it can be sending at any point in time.

• The larger the window, the more frames that it can have “on the go” at once.

• All of the frames in the window must be buffered in case one must be resent.

• The size of the sending window does not have to match the receiver, nor must it remain a constant size.

Page 35: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

35

Sliding Window - Receiving

• This is the window of frames that the receiver is allowed to receive at any point in time.

• A receiving window of 1 means that the frames must be received one-at-a-time and in order.

• A receiving window larger than 1 results in buffering of frames at the receiver end.

Page 36: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

36

Sliding Window - Receiving

• Anything outside of the receiving window is automatically discarded.

• Anything inside the window can be accepted.• If the sequence number is equal to the lower edge

of the window, then that frame is acknowledged and the packet passed to the network layer.

• Other buffered data, if it now has the sequence number of the lower edge of the window, will also be passed to the network layer.

• As the lower edge is received, the window moves.

Page 37: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

Sliding Window Protocols

A sliding window of size 1, with a 3-bit sequence number.

(a) Initially.

(b) After the first frame has been sent.

(c) After the first frame has been received.

(d) After the first acknowledgement has been received.

Page 38: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

A One-Bit Sliding Window Protocol

Two scenarios for protocol 4. (a) Normal case. (b) Abnormal case. The notation is (seq, ack, packet number). An asterisk indicates where a network layer accepts a packet.

Page 39: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

39

Pipelining the Frames

• When the latency on the physical network is long (i.e., long propagation delay), we want to pipeline the data in hopes that no errors will occur.

• Pipelining is the process of putting multiple frames on the connection without receiving any acks for them. Assuming that they all arrive safely, it is much faster than sending them with stop-and-wait.

Page 40: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

4343 X2 40

Pipelining and a Bad Frame

• What happens when we get a bad frame?• Go back n – Ask the sender to go back

and start retransmitting from the lost frame.– this should be easy as they should still be

buffered.

• Selective repeat – Ask the sender to repeat the particular frames that were lost.– this should be easy as that particular frame

should still be buffered.

Page 41: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

41

Overlapping Windows

• We have to make sure that there is no overlap between the two windows that may cause error. Error can occur when retransmitted frames can look like new frames.

• The ensure there is no overlap, the number of frames should be, at most, ½ of the range of sequence numbers.

Page 42: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

42

Buffers and Timers• The sender needs a timer and a buffer for

each spot in the sending window, regardless of the range of the sequence numbers. The data is stored in a buffer until the timer runs out or an ack is received.

• The receiver only needs enough buffers for the window size.

• The receiver can use an auxiliary timer to make sure that acks are sent when there is no reverse traffic.

Page 43: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

43

Example Data Link Protocols

• IBM introduced SDLC – Synchronous Data Link Control – and submitted it to ANSI and ISO for acceptance as US and International standards.

• ANSI modified it to be ADCCP – Advanced Data Communication Control Procedure

• ISO modified it to be HDLC – High-level Data Link Control.

Page 44: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

44

Example (cont’d)

• CCITT then adopted and modified HDLC for its LAP (Link Access Procedure).

• They modified it again to LAPB.

• With so many standards, how do you know which one to choose?

• They are all very similar, with only minor (but annoying) differences between them.

Page 45: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

45

The Protocol

• All are bit oriented, all use bit stuffing.• The address field is used to identify the

terminal on lines with multiple terminals.• The control field is used for sequence

numbers, acks & other stuff.• The data field contains *gasp* - data.• The checksum field is for the checksum.• The frame is delimited by 8 bits on either

end.

Page 46: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

46

The DLL in the Internet

• We will look at LANs later, so let’s take a look at the protocol for point to point connections within the Internet.

• The protocol is known as PPP or Point to Point Protocol.

• PPP is used to connect LANs to backbones.

• PPP is (often) used to connect home users to the Internet.

Page 47: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

47

PPP for Internet Connections

Page 48: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

48

PPP Provides:– A framing method to delineate the end of one

frame and the start of the next. It also handles error detection.

– A link control protocol to establish, test and terminated lines. This is known as the LCP (Link Control Protocol). It supports sync and async circuits plus byte and bit oriented encodings.

– Negotiates the network-layer options that is independent of the network layer protocol used. This is known as the NCP (Network Control Protocol)

Page 49: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

49

A Typical Dial-up Connection

• The modem makes a physical connection to the ISP’s modem.

• A series of LCP packets are send in PPP frames. These packets select the PPP parameters to be used.

• NCP packets are then sent to configure the network layer, such as getting an IP address.

Page 50: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

50

A Dial-up Connection (cont’d)

• The computer can now send IP packets as if it was hardwired to the Internet.

• When finished, the process is:– NCP removes the network connection and

frees up the IP address.– LCP shuts down the data link layer

connection.– The computer tells the modem to drop the

connection and release the phone line.

Page 51: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

51

A PPP Frame

Page 52: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

52

PPP Frame Breakdown

• Start with the standard HDLC flag byte (01111110)

• Next we have the address.• The control field is used to number the

frames (which is very uncommon for PPP)• Considering that this is a PPP connection,

the address and the control field are always going to be the same, so the LCP can negotiate to leave those two fields out.

Page 53: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

53

PPP Frame Breakdown (cont’d)

• The 4th field is the protocol field to identify the type of packet being transmitted. It is normally 2 bytes, but can be negotiated to 1 byte by the LCP.

• The 5th field is for payload, and is variable in size (up to some negotiated maximum).

• The 6th field is for the checksum and is normally 2 bytes (but can be 4 bytes).

• We close with the same flag in field 7.

Page 54: 1 The Data Link Layer Babu Ram Dawadi. 2 The Data Link Layer The data link layer has three specific functions: 1.Provide a well-defined interface to the.

54

PPPoE

• This is PPP over Ethernet.• Normally reserved for dial-up connections,

we can use PPPoE to force some users to make a connection over what could be a dedicated line.

• This is now used by Aliant/MTT in order to remove the need for dedicated lines at the switching office, increasing capacity and reducing hardware.


Recommended