Top Banner
1 Data Link Layer Lesson 6 NETS2150/2850
65

1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

Dec 20, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

1

Data Link Layer

Lesson 6NETS2150/2850

Page 2: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

2

Position of the data-link layer

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Page 3: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

3

LLC and MAC sublayers

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Page 4: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

4

IEEE Standards for LANs

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Page 5: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

5

The Data Link Layer The principles behind data link layer

services: error detection, correction reliable data transfer, flow control sharing a broadcast channel: multiple

access (see later) link layer addressing (see later)

Page 6: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

6

Lesson Outline Introduction Flow control

Stop and wait Sliding Window

Error Detection Parity Check CRC

Error Correction Stop and wait ARQ Sliding Window ARQ

Page 7: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

7

Link Layer: IntroductionSome terminology: End systems and routers are

nodes communication channels

that connect adjacent nodes along communication path are links wired links wireless links

L2-PDU is a frame, encapsulates a packet

“link”

data-link layer has responsibility of transferring frame from one node to adjacent node over a link Adapted from Kurose &

Ross book

Page 8: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

8

Link Layer Services

Framing, link access: encapsulate packet into frame, adding

header, trailer control channel access if shared medium ‘physical 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 (fibre,

some twisted pair) crucial for wireless links: high error rates

Page 9: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

9

Link Layer Services (2) Flow Control:

pacing between adjacent sending and receiving nodes

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

Error Correction: receiver identifies and corrects bit error(s)

Half-duplex and full-duplex transmission with half duplex, nodes at both ends of link can

transmit, but not at same time

Page 10: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

10

Adapters Communicating

link layer implemented in “adapter” (aka NIC) E.g. Ethernet card,

PCMCIA card, 802.11 card

sending side: encapsulates packet in a

frame adds error checking bits,

flow control, etc.

receiving side looks for errors, flow

control, etc extracts packet, passes

to rcving node adapter is semi-

autonomous Contains link & physical

layers

sendingnode

frame

rcvingnode

packet

frame

adapter adapter

link layer protocol

Page 11: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

11

Flow control refers to a set of Flow control refers to a set of procedures used to restrict the amount procedures used to restrict the amount of data that the sender can send before of data that the sender can send before

waiting for acknowledgmentwaiting for acknowledgment

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Page 12: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

12

Flow Control Ensuring the sending entity does not

overwhelm the receiving entity Preventing buffer overflow

Two schemes: Stop and Wait Sliding Window

Page 13: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

13

Stop and Wait Source transmits frame Destination receives frame and

replies with acknowledgement Source waits for ACK before sending

next frame Destination can stop flow by not

send ACK Works well for a few large frames

Page 14: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

14

Normal operation

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Page 15: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

15

Stop-and-Wait, lost ACK frame

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Page 16: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

16

Numbering frames prevents the Numbering frames prevents the retaining of duplicate framesretaining of duplicate frames

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Page 17: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

17

Stop and Wait Utilisation

Transmission time (tframe) Time taken to emit all bits into medium

Propagation time (tprop) Time for a bit to traverse the link

Link utilisation is the fraction of time a link is used for data

Page 18: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

18

Stop and Wait Utilisation (2)

Light in vacuum

= 300 m/s

Light in fibre

= 200 m/s

Electricity

= 200 m/s

Speed of Signals

RTT

Page 19: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

19

Utilization: Examples Satellite Link: Propagation Delay,

tprop = 270 msFrame Size = 4000 bitsData rate = 56 kbps tframe = 4/56 = 71 ms

= tprop/tframe = 270/71 = 3.8U = 1/(2 +1) = 0.12

Short Link: 1 km, tprop = 5 s,Rate=10 Mbps, Frame size= 500 bytes

tframe = 4k/10M= 400 s

=tprop/tframe=5/400=0.012 U=1/(2 +1)=0.98

Page 20: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

20

Fragmentation Large block of data may be split into small

frames. Why? Limited buffer size at rcvr Errors can be detected sooner On error, only retransmission of smaller

frames is needed Prevents one station occupying medium for

long periods However, stop and wait is inadequate to

cater for long-delay links!!

Page 21: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

21

Sliding Window Flow Control Allow multiple frames to be in transit Receiver has buffer W-frame long Transmitter can send up to W frames without

ACK Each frame is numbered ACK includes number of next frame expected Sequence number bounded by size of

sequence # field (k-bit) Frames are numbered modulo 2k

Max window size 2k - 1

Page 22: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

22

Sender and Receiver windows

Last frame acknowledged

Page 23: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

23

Example Sliding Window

Page 24: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

24

Sliding Window Enhancements Receiver can acknowledge frames

without permitting further transmission (using Receive Not Ready or RNR frame) Must send a normal acknowledge to

resume (Receive Ready or RR frame) Use piggybacking

When need to ACK and send data, use same data frame to carry ACK number

Page 25: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

25

Sliding Window Utilisation

Page 26: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

26

Sliding Window Utilisation (2)

Page 27: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

27

Model of Frame Transmission

Page 28: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

28

Data can be corrupted during transmission. For reliable

communication, errors must be detected and corrected.

Page 29: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

29

Types of ErrorTypes of Error

Single-Bit Error

Burst Error

Page 30: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

30

In a single-bit error, only one bit in the data unit has changed.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Page 31: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

31McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

A burst error means that 2 or more bits in the data unit have changed.

Page 32: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

32

Error Detection MethodsError Detection Methods

Parity Check

Cyclic Redundancy Check (CRC)

Checksum (see later)

Page 33: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

33McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Error detection uses the concept of redundancy, which means adding

extra bits for detecting errors at the destination.

Page 34: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

34

Detection Methods

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Page 35: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

35

In even parity check, a parity bit is added to every data unit so that the

total number of 1s is even (or odd for odd-parity).

Page 36: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

36

Example 1Example 1

Suppose the sender wants to send the word world. In ASCII the five characters are coded as

1110111 1101111 1110010 1101100 1100100

The following shows the actual bits sent

11101110 11011110 11100100 11011000 11001001

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Page 37: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

37

Example 2Example 2

Now suppose the word world in Example 1 is received by the receiver without being corrupted in transmission.

11101110 11011110 11100100 11011000 11001001

The receiver counts the 1s in each character and comes up with even numbers (6, 6, 4, 4, 4). The data are accepted.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Page 38: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

38

Example 3Example 3

Now suppose the word world in Example 1 is corrupted during transmission.

11111110 11011110 11101100 11011000 11001001

The receiver counts the 1s in each character and comes up with even and odd numbers (7, 6, 5, 4, 4). The receiver knows that the data are corrupted, discards them, and asks for retransmission.

Page 39: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

39

Simple parity check can detect all Simple parity check can detect all single-bit errors. It can detect burst single-bit errors. It can detect burst errors only if the total number of errors only if the total number of errors in each data unit is odd.errors in each data unit is odd.

Even number of bit errors goes Even number of bit errors goes undetected!undetected!

Page 40: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

40

In two-dimensional parity check, a block of bits is divided into rows and a redundant row of bits is added to the

whole block.

Page 41: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

41

Two-dimensional parity (even)

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Page 42: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

42

Example 4Example 4

Suppose the following block is sent:

10101001 00111001 11011101 11100111 10101010

However, it is hit by a burst noise of length 8, and some bits are corrupted.

10100011 10001001 11011101 11100111 10101010

When the receiver checks the parity bits, some of the bits do not follow the even-parity rule and the whole block is discarded.

10100011 10001001 11011101 11100111 10101010

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

Page 43: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

43

Cyclic Redundancy Check

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004

r bits

r+1 bits

r bits

Page 44: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

44

Cyclic Redundancy Check

goal: choose r CRC bits, R, such that <D,R> exactly divisible by G (divisor)

(modulo 2 arithmetic) receiver knows G, divides <D,R> by G.

If non-zero remainder: error detected! can detect all burst errors less than r+1 bits

widely used in practice (HDLC, ATM)

Page 45: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

45

CRC Example

Assume:D = 101110 (d bits)G = 1001 (r+1 bits)

What is the CRC?

Transmitted block is:

101110011 (d+r bits)

011 (r bits)

Stallings Section 6.3

CRC detect all burst errors r bits

Page 46: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

46

Error Control Deliver frames without error, in the

proper order to network layer Handles Lost frames

And damaged frames An automatic repeat request scheme:

Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement and

retransmission

Page 47: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

47

Automatic Repeat Request (ARQ) Stop and wait ARQ Sliding window schemes

Go back N ARQ Selective reject (selective repeat) ARQ

Page 48: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

48

Stop and Wait ARQ

Source transmits single frame And waits for ACK

If received frame damaged, discard it Transmitter has timer If no ACK within timeout, retransmit

If ACK damaged,transmitter will not recognize it Transmitter will retransmit Receive gets two copies of frame Use ACK0 and ACK1 to distinguish

Page 49: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

49

Stop and Wait -Diagram

Page 50: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

50

Go Back N ARQ Based on sliding window If no error, ACK as usual with next

expected frame If error, reply with a rejection frame

Rcvr discards that frame and all future frames until errored frame received correctly

Transmitter must go back and retransmit that frame and all subsequent frames

Page 51: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

51

Go Back N - Diagram

Page 52: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

52

Selective Reject ARQ Only rejected frames are

retransmitted Subsequent frames are accepted by

the receiver and buffered Minimizes retransmission

Receiver must maintain large enough buffer

Page 53: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

53

Selective Reject -Diagram

Page 54: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

54

High Level Data Link Control (HDLC) The most important and widely

used DL protocol Also the basis for many other DL

protocols

Page 55: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

55

HDLC Frame Structure3 types of frame has same frame format: Information frame (I-frame) – carries

network layer data Flow and error control piggybacked on

information frames Supervisory frame (S-Frame) - ARQ when

piggyback not used (i.e. RR, RNR, REJ) Unnumbered frame (U-frame) - link control

frames

Page 56: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

56

Flag Fields Delimit frame at both ends

01111110 Receiver hunts for flag sequence to

synchronise (i.e. frame synchronisation) Bit stuffing used to avoid confusion with

data containing 01111110 0 inserted after every sequence of five 1s If receiver detects five 1s, it checks next bit

• If 0, it is deleted• If 1 and seventh bit is 0, accepts as flag• If sixth and seventh bits 1, sender is indicating abort

Page 57: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

57

Bit Stuffing

Page 58: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

58

Control Field Different for different frame type First one or two bits of control field

identify frame type

Page 59: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

59

Control Field

Page 60: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

60

Information Field

Only in I- and some U-frames Must contain integral number of

octets Variable length

Page 61: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

61

Frame Check Sequence (FCS) Field Error detection code (i.e. redundant

bits) 16-bit CRC

Optional 32-bit CRC

Page 62: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

62

HDLC Operation Three phases

Initialization (Connection setup)

Data transfer Disconnect

(Connection Termination)

Page 63: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

63

Examples of Operation (1)U-frames

I-frames S-frames

Page 64: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

64

Examples of Operation (2)

Page 65: 1 Data Link Layer Lesson 6 NETS2150/2850. 2 Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.

65

Summary Flow control and error

control through the same scheme

HDLC a basis for many other data link layer protocols

Read Stallings sec. 6.2, 6.3, 6.5 and chap 7

Next: LAN Overview