148
1 Unit 3 Data link layer

Unit 3

Embed Size (px)

DESCRIPTION

Unit 3. Data link layer. Topics. Data link layer design issues Error detection and correction Elementary data link protocols Sliding window protocols Example data link protocols HDLC LAP. Data link layer design issues. Data link layer design issues. - PowerPoint PPT Presentation

Citation preview

Page 1: Unit 3

1

Unit 3

Data link layer

Page 2: Unit 3

2

Topics

Data link layer design issues Error detection and correction Elementary data link protocols Sliding window protocols Example data link protocols HDLC LAP

Page 3: Unit 3

3

Data link layer design issues

Page 4: Unit 3

4

Data link layer design issuesServices provided to the network

layerFramingError controlFlow control

Page 5: Unit 3

5

Data link layer design issuesFunctions of data link layer

Providing a well-defined service interface to the network layer

Determining how the bits of the physical layer are grouped into frames

Dealing with transmission errors Regulating the flow of frames so that

slow receivers are not swamped by fast senders

Page 6: Unit 3

6

Data link layer design issues

Relationship between packets and frames

Page 7: Unit 3

7

Services provided to the network layer Main service to be provided is to transfer data from the

network layer on the sending machine to the network layer on the destination machine.

a) virtual communication b) actual communication

Page 8: Unit 3

8

Types of services provided

Three reasonable possibilities for data link services:

1. Unacknowledged connectionless service

2. Acknowledged connectionless service

3. Acknowledged connection-oriented service

Page 9: Unit 3

9

Unacknowledged connectionless service1. Source sends independent frames to the

destination without the destination acknowledging them.

2. No connection is established or released 3. If a frame is lost due to noise on the line, no

attempt is made to recover it.4. Appropriate when the error rate is very low5. Appropriate for real-time traffic, such as

speech, in which late data are worse than bad data

6. Mostly LANs use this.

Page 10: Unit 3

10

Acknowledged connectionless service

Next step to improve reliability No connections used but for each frame

received, the receiver sends an acknowledgement.

If frame is not received within specified time, the sender will retransmit it.

Suitable for communication over unreliable channels, such as wireless systems

Page 11: Unit 3

11

Acknowledged connection oriented service The source and the destination establish a

connection before data transfer. Each frame sent is numbered The data link layer guarantees that each frame sent

is indeed received. It also guarantees that each frame is received

exactly once and all frames are received in the right order.

Connection-oriented service provides the network layer with the equivalent of a reliable bit stream.

Page 12: Unit 3

12

The data transfer takes place by following three phases:

Connection establishment One or more frames actually transmitted Connection is released.

Acknowledged connection oriented service

Page 13: Unit 3

13

Example of WAN subnet consisting of routers connected by point-to-point leased lines Fig. placement of the data link protocol

Page 14: Unit 3

14

Framing The data link uses the services provided by the

physical layer. The physical layer will not be perfect. It is up to the

data link layer to detect, and if necessary, correct errors.

The usual approach is for the data link layer to break the bit stream up into discrete frames and compute the checksum for each frame.

When a frame arrives at the destination, the checksum is recomputed.

If the newly computed checksum is different from the one contained in the frame, the data link layer knows that an error has occurred and takes steps to deal with it.

Page 15: Unit 3

15

Framing Breaking the bit stream into frames is called as

framing. One way is to insert time gaps between frames.

But practically this technique does not work satisfactorily, because networks generally do not make any guarantees about timing.

So following methods are used:1. Character count.2. Starting and ending characters, with character

stuffing.3. Starting and ending flags, with bit stuffing.4. Physical layer coding violations.

Page 16: Unit 3

16

Character count In this method, a field in the header is used to

specify the number of characters in the frame. This number helps the receiver to know the number

of characters in the frame following this count. Disadvantage: An error can change the character count If the wrong character count is received then the

receiver will get out of synchronization and will be unable to locate the start of next frame.

This method is rarely used in practice.

Page 17: Unit 3

17

Character count

Without error

With one error

Character count

Page 18: Unit 3

18

Starting and ending character with character stuffing Here starting character is used before the start of each

frame and an end character is used at the end of each frame.

Flag byte FLAG. is used as starting and ending delimiter Two consecutive flag bytes indicate the end of one frame

and start of the next one. Problem in case of programs or floating point numbers. Solution is to use escape sequence (ESC) before flag. The data link layer at the receiving side removes the

ESC byte before sending to the network layer Known as byte or character stuffing

Page 19: Unit 3

19

Starting and ending character with character stuffing Character (or)

byte-oriented

Page 20: Unit 3

20

Disadvantages of character stuffing

A major disadvantage of using this framing method is that it is closely tied to 8-bit characters in general and the ASCII character code in particular.

We need a technique to allow arbitrary sized characters.

Page 21: Unit 3

21

Bit stuffing This technique allows the frames to contain arbitrary

number of bits and codes. At the beginning and end of each frame , a specific

bit pattern 01111110 called flag byte is transmitted. Since there are six consecutive 1s in this byte, a

technique called bit stuffing is used. Whenever the sender data link layer detects the

presence of 5 consecutive 1s in the data, it automatically stuffs a 0 bit in the outgoing bit stream.

De-stuffing is done at the receiving end.

Page 22: Unit 3

22

Flags (01111110) at the beginning and end

Bit-oriented framing with bit stuffing

Bit stuffing(a) Original data (b) the data as they appear on the line (c) the data as they are stored in the receivers memory after de-stuffing

Page 23: Unit 3

23

Physical layer coding violations This method of framing is only applicable to

networks in which the encoding on the physical medium contains some redundancy.

For example, some LANs encode 1 bit of data by using 2 physical bits.

Normally, a 1 bit is a high-low pair and a 0 bit is a low-high pair.

The combinations high-high and low-low are not used for data and they can be used as frame boundaries.

Page 24: Unit 3

24

The usual way to ensure reliable delivery is to provide the sender with some feedback about what is happening at the other end of the line.

Sender

Data Frame

Receiver Acknowledgement (ACK)

Or negativeAcknowledgement (NAK)

Error control

Page 25: Unit 3

25

An additional complication comes from the possibility that hardware troubles may cause a frame to vanish completely. In this case, the receiver will not react at all.

This possibility is dealt with by introducing timers into the data link layer.

Error control

Page 26: Unit 3

26

retransmitif time-out

ACK if correct

correct and ordered

packeterror code

ack

error code

networklayer

networklayer

physicallayer

physicallayer

Sender Receiver

Error control

Page 27: Unit 3

27

Error control However, when frames may be transmitted

multiple times there is a danger that the receiver will accept the same frame two or more times, and pass it to the network layer more than once.

To prevent this from happening, it is generally necessary to assign sequence numbers to outgoing frames, so that the receiver can distinguish retransmissions from originals.

Page 28: Unit 3

28

Flow control What to do with a sender that systematically

wants to transmit frames faster than the receiver can accept them?

The usual solution is to introduce flow control to throttle the sender into sending no faster than the receiver can handle the traffic.

This throttling generally requires some kind of a feedback mechanism, so the sender can be made aware of whether or not the receiver is able to keep up.

Page 29: Unit 3

29

Flow control Various flow control schemes are there, but

most of them use the same basic principle. The protocol contains well-defined rules

about when a sender may transmit the next frame.

These rules often prohibit frames from being sent until the receiver has granted permission, either implicitly or explicitly.

Two techniques are there: Stop and wait flow control Sliding window flow control

Page 30: Unit 3

30

Error detection and correction

Page 31: Unit 3

31

Error detection and correction

Error correcting codesError detecting codes

Page 32: Unit 3

32

Error detection and correction

Transmission errors are going to be a fact of life for many years to come. (in local loop, in wireless communications)

As a result of the physical processes that generate them, errors on some media (e.g., radio) tend to come in bursts rather than singly.

Disadvantage: They are much harder to detect and correct than isolated errors.

Page 33: Unit 3

33

error model: bursty errors every packet would be in error

bursty error, only one packet is incorrect

Advantage:

Error detection and correction

Page 34: Unit 3

34

Types of error

Single bit error: only one bit gets corrupted. Common in parallel transmission.

Multiple bit errors: more than one bits get corrupted

Burst error: more than one bit gets corrupted at the same place or at once. Very common in serial transmission of data. Occurs when the duration of noise is greater than the duration of one bit.

Page 35: Unit 3

35

Single bit error:

Multiple bit error:

Page 36: Unit 3

36

Burst error:

Page 37: Unit 3

37

Error detection techniques Use of redundancy: additional bits are

added to facilitate detection and correction of errors.

Popular techniques: Simple parity check Two-dimensional parity check Checksum Cyclic redundancy check

Page 38: Unit 3

38

Simple parity check The simplest and most popular error

detection technique Appends a parity bit to the end of the data Even parity: means the number of 1’s in the

given word including parity bit should be even (2,4,6…)

Odd parity: means the number of 1’s in the given word including parity bit should be odd (1,3,5…)

Page 39: Unit 3

39

Page 40: Unit 3

40

Performance of simple parity check

Simple parity check can detect all single bit errors.

It can also detect burst errors if the number of bits in error is odd.

The technique is not foolproof against burst errors that inverts more than one bits. If an even number of bits are inverted due to error, the error is not detected.

It cannot correct errors.

Page 41: Unit 3

41

Two dimensional parity check

Performance can be improved by using two dimensional parity check, which organizes the block of bits in the form of a table

Parity check bits are calculated for each row which is equivalent to a simple parity check bit

Parity check bits are also calculated for all columns

Both are sent along with the data At the receiving end these are compared with

the parity bits calculated on the receiving data

Page 42: Unit 3

42

Example

Page 43: Unit 3

43

LRC and VRC Two sets of parity bits are generated known

as: Longitudinal redundancy check (LRC)

Vertical redundancy check (VRC)

Page 44: Unit 3

44

Performance Extra overhead is traded for better error

detection capability Two-dimensional parity check significantly

improves error detection capability compared to simple parity check

It can detect many burst errors but not all It cannot correct the errors

Page 45: Unit 3

45

Checksum At the senders end: The data is divided into k

segments each of m bits. The segments are added

using one’s complement arithmetic to get the sum

The sum is complemented to get the checksum

The checksum segment is sent along with the data segments

Page 46: Unit 3

46

Checksum At the receiver’s end: All received segments

are added using one’s complement arithmetic to get the sum

The sum is complemented

If the result is zero the received data is accepted otherwise discarded

Page 47: Unit 3

47

Performance

The checksum detects all errors involving an odd number of bits

It also detects most errors involving even number of bits

Page 48: Unit 3

48

Cyclic redundancy check One of the most powerful and commonly used error

detecting codes Basic approach: Given a m-bit block of bit sequence, the sender

generates an n-bit sequence known as frame check sequence (FCS), so that the resulting frame, consisting of m+n bits, is exactly divisible by some predetermined number

The receiver divides the incoming frame by that number and, if there is no remainder, assumes there was no error

Page 49: Unit 3

49

Cyclic redundancy check

Page 50: Unit 3

50

Modulo-2 arithmetic

Page 51: Unit 3

51

Binary Division

Modulo-2 arithmetic

Page 52: Unit 3

52

Polynomials All the variables can be expressed as polynomials of

a dummy variable X. P= 11001 => X^4 +X^3+ X^1 CRC process can be expressed as X^nM(X)/P(X) =

Q(X) + R(X) / P(X) Commonly used divisor polynomials are: CRC-12= X^12 + X^11 + X^3 + X^2 + X + 1 CRC-16= X^16 + X^15 + X^2 + 1 CRC-CCITT = X^16 + X^12 + X^5 + 1 CRC-32 = X^32 + X^26 + X^23 + X^22 + X^16 +

X^12 + X^11 + X^10 + X^8 + X^7 + X^5 + X^4 + X^2 + X + 1

Page 53: Unit 3

53

Performance of CRC

Can detect all single bit errors Can detect all double bit errors (three 1’s) Can detect any odd number of errors (X+1) Can detect all burst errors of less than the

degree of the polynomial Detects most of the larger burst errors with a

high probability For example CRC-12 detects 99.97% of

errors with a length 12 or more

Page 54: Unit 3

54

Error correction

Backward error correction: When an error is detected in a frame, the

sender is asked to retransmit the data/frame. This approach is known as Automatic Repeat Request (ARQ) technique.

Forward error correction: Use more redundancy in the transmitted data

to not only detect but correct error in the received data.

Page 55: Unit 3

55

m data bits r check bits

Codeword: an n-bit unit containing data and check bits is called as n-bit codeword

There are 2n possible codewords and 2m possible data messages.Hamming distance between codewords: min d(C1,C2)=number of (same bit position) bits which differ

d(10010010,00010001)=3

n=m+r

If two codewords are a hamming distance d apart, it will require d single-bit errors to convert one into the other.

Error correcting codes

Page 56: Unit 3

56

Hamming distance: the number of differences in the corresponding bits

The minimum Hamming distance is the smallest Hamming distance between all possible pairs in a set of words

Error correcting codes

Page 57: Unit 3

57

Error correction

Requirement for error detection: A code is an error detecting code if and only if minimum distance between any two code words is two

Requirement for error correction: For a code to be error correcting the minimum distance between any two code words must be more than two

Number of additional bits should be such that it can point to the position of the bit in error. If k is the number of additional bits, the condition is 2^k> m+ k+1

Page 58: Unit 3

58

Hamming code

Basic approach: To each group of m information k parity bits are

added to form m+k bit code Location of each of the m+k digits is assigned a

decimal value The k parity bits are placed in 1,2 …2^k-1 positions. K parity checks are performed on selected digits of

each codeword At the receiving end the parity bits are recalculated.

The decimal value of the k parity bits provides the bit position in error, if any.

Page 59: Unit 3

59

Hamming Code

Page 60: Unit 3

60

Hamming Code

Page 61: Unit 3

61

Hamming Code

Page 62: Unit 3

62

Example of Hamming Code

Page 63: Unit 3

63

Single-bit error

Page 64: Unit 3

64

Error Detection

Page 65: Unit 3

65

Elementary data link protocols

Page 66: Unit 3

66

Elementary data link protocols

An unrestricted simplex protocolA simplex stop and wait protocolA simplex protocol for noisy channelPiggybacking

Page 67: Unit 3

67

An Unrestricted Simplex protocol This is the simplest possible protocol Has no flow control and no error control Unidirectional protocol in which frames travel from

sender to receiver Assumption is noiseless channel It is assumed that the network layer of the sender

and the receiver are always ready. It is also assumed that the processing time can be

ignored and infinite buffer space is available This protocol is also known as “utopia”

Page 68: Unit 3

68

An Unrestricted Simplex protocol

This protocol consists of two distinct procedures, namely a sender and a receiver.

The sender runs in the data link layer of the sender machine and receiver runs in the data link layer of the receiver machine

The sender site cannot send a frame until its network layer has a data packet to send.

No sequence numbers and no acknowledgments are used.

Both procedures are constantly running because they don’t know when the corresponding events will occur

Page 69: Unit 3

69

The design of simplex protocol with no flow and error control

Page 70: Unit 3

70

Sender site algorithm for the simplex protocol

Page 71: Unit 3

71

Receiver site algorithm for the simplex protocol

Page 72: Unit 3

72

Flow diagram for simplex protocol

Page 73: Unit 3

73

A simplex Stop and Wait protocol Assumption is noiseless channel and

communication is unidirectional Flow control is added to previous protocol In this protocol, a small dummy frame is sent

back from the receiver to the transmitter to indicate that it can send the next frame.

Here the sender sends one frame, stops until it receives confirmation from the receiver and then sends the next frame.

Hence the name stop and wait.

Page 74: Unit 3

74

Design of stop and wait protocol

Page 75: Unit 3

75

Sender site algorithm for the stop and wait protocol

Page 76: Unit 3

76

Receiver site algorithm for the stop and wait protocol

Page 77: Unit 3

77

Stop and Wait

Page 78: Unit 3

78

A Simplex Protocol for Noisy Channel Assumption is noisy channel Frames may be damaged or lost completely In this protocol, the sender waits for positive

acknowledgement before advancing to the next data item

So it is called as PAR (positive acknowledgement with retransmission) or Automatic Repeat Request (ARQ)

Due to retransmission there is always a possibility of duplication of frames at the receiver.

To avoid this, sender puts a sequence number in the header of each frame it sends.

The operation can be divided into two modes: 1. Normal operation 2.Time out

Page 79: Unit 3

79

A Simplex Protocol for Noisy Channel

Page 80: Unit 3

80

Flow diagram

Page 81: Unit 3

81

Piggybacking In all practical situations, the transmission of

data needs to be bi-directional (full duplex) One way of achieving full duplex

transmission is to have separate channels for forward and reverse data transfer

But this will waste the bandwidth of reverse channel almost entirely

A better solution would be to use each channel (forward and reverse) to transmit frames both ways, with both channels having the same capacity

Page 82: Unit 3

82

Piggybacking Let A and B be the users. When a frame is carrying data from A to B, it can

also carry control information about arrived or lost frames from B; and vice-versa.

This technique where outgoing acknowledgement is delayed temporarily is called as piggybacking.

Advantage: better use of available bandwidth Disadvantage: additional complexity If data link layer waits too long before transmitting

acknowledgement, then retransmission of frame would take place

Page 83: Unit 3

83

Design of piggybacking in Go-Back-N ARQ

Page 84: Unit 3

84

Sliding window protocols

Page 85: Unit 3

85

Sliding Window Sliding window is an abstract concept that defines

the range of sequence numbers that is the concern of the sender and receiver

The sender maintains a set of sequence numbers corresponding to frames it is permitted to send.

These frames are said to fall within the sending window.

Similarly, the receiver also maintains a receiving window corresponding to the set of frames it is permitted to accept.

The sender’s window and the receiver’s window need not have the same lower and upper limits, or even have the same size.

Page 86: Unit 3

86

Sliding Window In some protocols they are fixed in size, but in

others they can grow or shrink as frames are sent and received.

The sequence numbers within the sender’s window represent frames sent but as yet not acknowledged.

Whenever a new packet arrives from the network layer, it is given the next higher sequence number, and the upper edge of the window is advanced by one.

When an acknowledgement comes in, the lower edge is advanced by one. In this way the window continuously maintains a list of unacknowledged frames.

Page 87: Unit 3

87

Sliding window Since frames currently within the sender’s window

may ultimately be lost or damaged in transmit, the sender must keep all these frames in its memory for possible retransmission.

Thus if the maximum window size is n, the senders need n buffers to hold the unacknowledged frames.

If the window ever grows to its maximum size, the sending data link layer must forcibly shut off the network layer until another buffer becomes free.

The receiving data link layer’s window corresponds to the frames it may accept. Any frame falling outside the window is discarded without comment.

Page 88: Unit 3

88

Sliding window

When a frame whose sequence number is equal to the lower edge of the window is received, it is passed to the network layer, an acknowledgement is generated, and the window is rotated by one.

Fig. sliding window

Page 89: Unit 3

89

Sender sliding window

Page 90: Unit 3

90

Receiver sliding window

Page 91: Unit 3

91

Sliding window example

Page 92: Unit 3

92

Sliding Window protocols

A One-bit sliding window protocol (Stop and Wait ARQ)

A protocol using Go Back N (Go-Back-N ARQ)

A protocol using Selective Repeat (Selective Repeat Request)

Page 93: Unit 3

93

One bit sliding window protocol (Stop and Wait ARQ)

One bit protocol because the maximum window size is n=1.

Operation is based on ARQ Transmitter sends one frame of data and waits for

an acknowledgement from the receiver If it receives a positive acknowledgement (ACK) it

transmits the next frame. If it receives a negative acknowledgement (NACK) it

retransmits the same frame.

Page 94: Unit 3

94

Features added for retransmission

The transmitter stores the copy of last frame transmitted until it receives an acknowledgement for those frames.

Data frame is numbered 0 and ACK frame as 1 If an error occurs while transmission, receiver

sends a NAK back for retransmission of the corrupted frame.

A timer is there for lost ACK and NACK frames

Page 95: Unit 3

95

When is retransmission required???

If the received frame is damaged If the transmitted frame is lost If the acknowledgement from the receiver is

lost

Page 96: Unit 3

96

Received Damaged frame

Page 97: Unit 3

97

Transmitted Lost frame

Page 98: Unit 3

98

Lost acknowledgement

Page 99: Unit 3

99

Stop and wait ARQ

Advantages: Simplicity Requires minimum buffer size Disadvantages: Very inefficient. At any time only one frame

is in transition The sender will have to wait at least one

round trip time before sending next frame

Page 100: Unit 3

100

Go-Back-N Protocol (Go-Back-N ARQ) Based on sliding window protocol Most commonly used A sending station may send a series of

frames sequentially up to a maximum number The number of unacknowledged frames is

determined by window size, using the sliding window flow control technique

In case of no error, the destination will acknowledge incoming frames as usual

Page 101: Unit 3

101

Go-Back-N ARQ

If the destination detects error in a frame, or it receives a frame out of order, it sends a NAK for that frame

The destination will discard the frame in error and all frames succeeding that frame in error

The source station on receiving the NAK, must retransmit the frame in error plus all succeeding frames.

Page 102: Unit 3

102

Damaged frame

Page 103: Unit 3

103

Lost frame

Page 104: Unit 3

104

Lost ACK

Page 105: Unit 3

105

Disadvantages

It transmits all the frames if one frame is damaged or lost

It transmits frames continuously as long as it does not receive the ACK or NACK signals

Error can be introduced if NAK is lost

Page 106: Unit 3

106

Selective Repeat ARQ

In this method only the damaged or lost frame is retransmitted.

The receiver can do the sorting of data frames and is also able to store frames received after a NAK has been sent until the damaged frame has been replaced

The transmitter must contain a searching mechanism that allows it to find and select only the requested frame for retransmission

Page 107: Unit 3

107

Selective Repeat ARQ

Page 108: Unit 3

108

Selective Repeat ARQ Transmitter does not wait for the ACK signal for

transmitting the next code. It transmits the code continuously till it receives the

NAK signal from the receiver. On reception of the NAK signal, the transmitter will

retransmit only that frame 2 and continue with the sequence 6, 7

The frames 6,7 received by the receiver are not discarded by the receiver.

The receiver receives the retransmitted frames in between the regular frames.

Therefore receiver will have to maintain the frames sequentially.

Page 109: Unit 3

109

Example data link protocols

Page 110: Unit 3

110

Example data link protocols

HDLC SDLC PPP protocol LAP protocol

Page 111: Unit 3

111

HDLC High level data link control

Bit oriented protocol for communication over point to point and point to multipoint links.

It implements ARQ mechanisms HDLC provides two common transfer mode: Normal response mode (NRM) Asynchronous balanced mode (ABM)

Page 112: Unit 3

112

Normal response mode (NRM) The station configuration is unbalanced One primary station and multiple secondary

stations A primary station can send commands; a

secondary station can only respond

Page 113: Unit 3

113

Normal response mode

Page 114: Unit 3

114

Asynchronous Balanced Mode

In this the configuration is balanced Link is balanced and each station can

function as a primary and a secondary

Page 115: Unit 3

115

HDLC Frames

Information frames (I-frames): transport user data and control information

Supervisory frames (S-frames): transport control information

Unnumbered frames (U-frames): used for system management

Page 116: Unit 3

116

Frame format

Page 117: Unit 3

117

Fields Flag field: 8-bit sequence with bit pattern 01111110

used to identify beginning and end of frame Address field: contains address of secondary

station. If primary station created the frame contains to if secondary created the frame, it contains from address. Address field can be 1 byte or several bytes long. 1 byte identifies 128 stations (1bit used for some purpose)

Control field: 1 or 2 byte segment used for error control and flow control

Information field: contains user data or management information. Length varies for different networks

FCS field: HDLC error correction field. It can contain 2 or 4 byte ITU-T CRC.

Page 118: Unit 3

118

HDLC address field

Page 119: Unit 3

119

Control field Determines the type of frame and defines its

functionality

Page 120: Unit 3

120

Control field for I-frames First bit 0 denotes that it is I-frame 3 bits of N(S) denotes that it is sequence

number. 0 to 7 sequence numbers possible Last 3 bits of N(R) denote acknowledgement

number P/F bit called poll-final bit Poll- means frame sent from primary to

secondary Final – means frame is sent from secondary

to primary

Page 121: Unit 3

121

Poll / Final

Page 122: Unit 3

122

Control field for S-frames

Used for error and flow control when piggybacking is impossible or inappropriate

10 bit indicates it is S-frame PF is poll-final bit N(R) denotes ACK no or NAK depending on

type of frame. 2 code bits define the type of S-frames:

Page 123: Unit 3

123

Control field for S-frames Receive Ready (RR) : if code field is 00, it is RR S-

frame. Denotes safe receipt of frame by receiver. Here N(R) denotes ACK

Receive Not ready (RNR): if code is 10 it is RNR. It means frame is received safely but the receiver is busy. Here N(R) is ACK no.

Reject (REJ): if code field is 01, it is REJ S-frame. It is NAK frame used in Go-Back-N ARQ. N(R) is NAK

Selective reject (SREJ): if code field is 11, it is SREJ S-frame. It is NAK frame used in selective repeat ARQ. N(R) here is NAK

Page 124: Unit 3

124

Control field for U-frames

U-frames used to exchange session management and control information between connected devices

U-frame codes are divided into 2 sections: 2-bit prefix before PF bit and 3-bit suffix after

PF. These 5 bits together can be used to create

up to 32 different types of U-frames

Page 125: Unit 3

125

U-frame control field

Set normal response modeSNRM extended

Unnumbered information

Request disconnectSet initialization mode/ Request information modeUnnumbered poll

Frame reject

Disconnect mode

Page 126: Unit 3

126

SDLC Synchronous Data link control protocol

Used by IBM Not a standard but is widely used A subset of HDLC There are primary and secondary stations

defined for HDLC

01111110 01111110Address Field 8bits

control Field 8bits

User data ECF 16 bits

Page 127: Unit 3

127

The data link layer in the internet SLIP and PPP

Page 128: Unit 3

128

The point-to-point protocol (PPP)

Used to connect the home computers to the server of an ISP

Most of the users have a traditional modem and they are connected to the Internet through a telephone line or cable TV

PPP is used for controlling and managing the data transfer

Can operate over a full duplex point-to-point transmission link, asynchronous links, bit synchronous links or ADSL and SONET

Character-oriented protocol

Page 129: Unit 3

129

Services provided by PPP Defines the format of the frames It defines how the link between two devices is

to be established and how the data exchange should take place. Uses LCP (link control protocol)

Decides the encapsulation of network layer into the data link frame. Uses NCP (network control protocol)

It defines the way in which the two devices can authenticate each other

Page 130: Unit 3

130

Flag: the PPP always begin and end with flag

Address: broadcast address. All 1s in the frame indicate all stations can accept the frame

Control: denotes unnumbered frame, indicates no flow control and error control

Frame format of PPP

Page 131: Unit 3

131

Protocol: tells the type of packet contained in payload. E.g. LCP, NCP, IP, OSI CLNP, XNS

Payload field: variable length, up to negotiated maximum. Default 1500 bytes. Padding may follow payload field

Checksum: normally 2 bytes, but 4 bytes can be used. Can use CCITT 16 or 32 generator polynomial

Frame format of PPP

Page 132: Unit 3

132

Making a communication

1. PC calls the provider’s router by a modem

2. Use LCP packets to select PPP parameters

3. Use NCP to receive an IP address

4. Send and receive IP packets

5. Use NCP to tear down the network layer connection and free up the IP address

6. Use LCP to shutdown the data link connection

7. The computer tells the modem to hang up

Page 133: Unit 3

133

Transition states of PPP A simple phase diagram for bringing line up

and down

Page 134: Unit 3

134

Dead: link is not used. No active carrier and line is quiet

Establish: when communication starts. User sends configure request packet to negotiate options. If successful goes into authenticating state. LCP packets used

Authentication: user sends the authenticate request packet

Network: NCP protocol is invoked to configure the network layer

Open: exchange of user data and control packets Terminate: user sends terminate packet to

terminate the link

Transition states of PPP

Page 135: Unit 3

135

Link control protocol LCP responsibilities: To establish links To maintain established links To configure the links Termination of the links It also provides negotiation mechanisms. When PPP is carrying LCP packet it is in the link

establishing state or in link terminating state and user data is not carried in these states

All LCP packets are carried in the payload field of the PPP frame with protocol field set to C021 in hexadecimal

Page 136: Unit 3

136

LCP packet encapsulated in a frame

Page 137: Unit 3

137

Types of LCP packets

Configuration packets: first 4 used for link configuration during establish phase

Link terminating packets: 5 and 6 used for link termination during termination phase

Link monitoring packets: last five used for link monitoring and debugging

Page 138: Unit 3

138

LCP packets

Page 139: Unit 3

139

Common options Many options that can be negotiated between

two endpoints Options are inserted in the information field Information field is divided into option type,

option length and option data

Page 140: Unit 3

140

Authentication protocols PPP needs authentication because it is used

for dial-up links. Authentication is to validate the identity of a

user who needs to access the set of resources.

Two protocols created by PPP for authentication are:

Password authentication protocol (PAP) Challenge handshake protocol (CHAP) These are used during authentication and no

user data is exchanged

Page 141: Unit 3

141

PAP PAP packets encapsulated in a PPP frame

Page 142: Unit 3

142

CHAP CHAP packets encapsulated in a PPP frame

Page 143: Unit 3

143

Link Access Protocol (LAP) LAP originates from IBM SDLC. Later it was named as LAPB (LAP balanced) LAP is data link protocol for X.25 LAPB is used to manage communication and packet

framing between data terminal equipment (DTE) and the data circuit-terminating equipment (DCE) devices in the X.25 protocol stack.

LAPB is essentially HDLC in Asynchronous Balanced Mode (ABM).

LAPB sessions can be established by either the DTE or DCE.

Bit oriented LAPB makes sure that frames are error free and

properly sequenced.

Page 144: Unit 3

144

LAPB frames I-Frames :

Carries data and control information. It includes sequencing, flow control, and error detection

and recovery. I-frames carry send and receive sequence numbers.

S-Frames : Carries control information. S-frame functions include requesting and suspending

transmissions, reporting on status, and acknowledging the receipt of I-frames.

U-Frames : carries control information. U-frame functions include link setup and disconnection, as

well as error reporting.

Page 145: Unit 3

145

LAPB frame format

Page 146: Unit 3

146

LAPB protocol operation In LAPB, since there is no master/slave relationship,

the sender uses the Poll bit to insist on an immediate response.

In the response frame this same bit becomes the receivers Final bit.

The receiver always turns on the Final bit in its response to a command from the sender with the Poll bit set.

The P/F bit is generally used when either end becomes unsure about proper frame sequencing because of a possible missing acknowledgement, and it is necessary to re-establish a point of reference.

Page 147: Unit 3

147

LAPF- Link Access Procedure/protocol for Frame Mode Services

Defined in the ITU Q.922 An enhanced LAPD (Q.921) with congestion control

capabilities Used for Frame Mode Services in the Frame Relay

network. The core functions of LAPF are: Frame delimiting, alignment, and flag transparency Virtual circuit multiplexing and de-multiplexing Octet alignment: Integer number of octets before

zero-bit insertion Checking minimum and maximum frame sizes Error detection, Sequence and non-duplication Congestion control

Page 148: Unit 3

148

Protocol format