Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of...

61
Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology

Transcript of Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of...

Page 1: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Computer NetworksModule 3: Data Link Layer (Framing)

Dr. Vikram Shete

St. Francis Institute of Technology

Page 2: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Framing

• Data link layer needs to pack bits into frames, so that each frame is distinguishable from another

• Separate a message from one source to a destination, or from other messages to other destinations, by adding a sender address and a destination address

Page 3: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Framing

• Fixed-size framing: ATM

• Variable-size framing– Need a way to define the end of the frame

and the beginning of the next– Character-oriented approach and bit-oriented

approach

Page 4: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Character-Oriented Protocols• Frame structure

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

Page 5: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Bit-Oriented Protocols• Frame structure

• Bit stuffing: process of adding one extra 0 whenever five consecutive 1s follow a 0 in the data

Page 6: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Flow and Error Control• Data link control = flow control + error control• Flow control refers to a set of procedures used to restrict the amount of data

that the sender can send before waiting for acknowledgement• Error control in the data link layer is based on automatic repeat request

(ARQ), which is the retransmission of data• ACK, NAK(Negative ACK), Piggybacking (ACKs and NAKs in data frames)

Page 7: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Noiseless Channels: Simplest Protocol

• Simplest protocol with no flow or error control

Page 8: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Simplest Protocol• Sender-site algorithm

Page 9: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

• Receiver-site algorithm

Simplest Protocol

Page 10: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Stop-and-Wait Protocol• Simple tokens of ACK and flow control added

Page 11: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Stop-and-Wait Protocol• Sender-site algorithm

Page 12: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

• Receiver-site algorithm

Stop-and-Wait Protocol

Page 13: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Stop-and-Wait Protocol: Example

Page 14: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Noisy Channels: Stop-and-Wait ARQ

• Stop-and-wait Automatic Repeat Request (ARQ)

• Error correction in Stop-and-Wait ARQ is done by keeping a copy of the sent frame and retransmitting of the frame when the timer expires

• In Stop-and-Wait ARQ, we use sequence numbers to number the frames. The sequence numbers are based on modulo-2 arithmetic

• Acknowledgment number always announces in modulo-2 arithmetic the sequence number of the next frame expected.

Page 15: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Stop-and-Wait ARQ

Page 16: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

• Sender-site algorithm

Stop-and-Wait ARQ

Page 17: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Stop-and-Wait ARQ

Page 18: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Stop-and-Wait ARQ• Receiver-site algorithm

Page 19: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Stop-and-Wait ARQ: Example

Page 20: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Stop-and-Wait ARQ: Sequence Number

• Sequence no. starts from 0 and goes to 2m-1 and then repeats

Eg: Given bandwidth is 1Mbps and 1 bit round trip time is 20 ms. Frame size is 1000 bits. What is the BW – Delay product? What is % utilization of the link?

Page 21: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

"I want to help create a world where humans and robots can live together,“ ~ Kirobo

Page 22: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Go-Back-N ARQ

• Pipelining improves the efficiency of the transmission

• The send window is an abstract concept defining an imaginary box of size 2m − 1 with three variables: Sf, Sn, and Ssize

• The send window can slide one or more slots when a valid acknowledgment arrives.

Page 23: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Go-Back-N ARQ

Page 24: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Go-Back-N ARQ

• Receive window for Go-Back-N ARQ

• The receive window is an abstract concept defining an imaginary box of size 1 with one single variable Rn. The window slides when a correct frame has arrived; sliding occurs one slot at a time.

Page 25: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Go-Back-N ARQ• Sliding windows, Timers, ACK, Resending a frame

Page 26: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Go-Back-N ARQ: Send Window Size

• In Go-Back-N ARQ, the size of the send window must be less than 2m; the size of the receiver window is always 1

• Stop-and-Wait ARQ is a special case of Go-Back-N ARQ in which the size of the send window is 1

Page 27: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Go-Back-N ARQ: Send Window Size

Page 28: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Go-Back-N ARQ: Sender Algorithm

Page 29: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Go-Back-N ARQ: Receiver Algorithm

Page 30: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Go-Back-N ARQ: Example 1

Page 31: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Go-Back-N ARQ: Example 2

Page 32: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Selective Repeat ARQ• Sender window size

• Receive window size

Page 33: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Selective Repeat ARQ

Page 34: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Selective Repeat ARQ: Window Size

• The size of the sender and receiver window must be at most one-half of 2m

Page 35: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Selective Repeat ARQ: Sender-Site Algorithm

Page 36: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Selective Repeat ARQ: Receiver-Site Algorithm

Page 37: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Selective Repeat ARQ: Example

Page 38: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Piggybacking• To improve the efficiency of the bidirectional protocols• Piggybacking in Go-Back-N ARQ

Page 39: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

HDLC• High-level Data Link Control• Two common transfer mode: normal response mode (NRM) and

asynchronous balanced mode (ABM)

Page 40: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

HDLC: Frames• I(information)-frames, S(supervisory)-frames, U(unnumbered frame)-

frames• Flag field: 01111110 to identify both the beginning and the end of a

frame and serve as synchronization pattern for receiver• FCS field: 2- or 4-byte ITU-T CRC for error detection

Page 41: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

HDLC: Frames• Control Field: 1- or 2-byte segment of the frame used for flow and

error control• Determine the type of frame and define its functionality• Control field for I-frame: P/F (poll/final bit for primary/secondary)

Page 42: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

HDLC: Frames• Control field for S-frame• Receive ready (RR), Receive not ready (RNR), Reject (REJ) Selective

reject (SREJ)

Page 43: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

HDLC: Frames• Control field for U-frame

Page 44: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

HDLC: Example 1• Connection and disconnection

Page 45: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

HDLC: Example 2• Piggybacking without error

Page 46: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

HDLC: Example 3• Piggybacking with error

Page 47: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

HDLC: Bit Stuffing and Unstuffing

Page 48: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Point-to-Point Protocol: PPP

• One of the most common protocols for point-to-point access• Many Internet users who need to connect their home computer to

the server of an Internet service provider use PPP• A point-to-point link protocol is required to control and manage the

transfer of data• PPP defines/provides

– the format of the frame to be exchanged between devices– how two devices negotiate the establishment of the link and the exchange of

data– how network layer data are encapsulated in the data link frame– how two devices can authenticate each other– multiple network layer services– connection over multiple links– Network address configuration

• But, several services are missing for simplicity– no flow control, simple error control (detection and discard), no sophisticate

addressing for multipoint configuration

Page 49: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

PPP Frame

• Flag: 01111110 the same as HDLC, but it treated as a byte because of PPP is a byte-oriented protocol

• Address: 11111111 (broadcast address)• Control: No need because PPP has no flow control and limited error

control• PPP is a byte-oriented protocol using byte stuffing with the escape byte

01111101

Page 50: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

PPP: Transition States

Page 51: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

PPP: Multiplexing

• PPP uses another set of other protocols to establish the link, authenticate the parties, and carry the network layer data

• Three sets of protocols defined for powerful PPP: LCP, two APs, several NCPs

Page 52: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

LCP: Encapsulated in a Frame

Page 53: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

LCP: Common Options

• Options are inserted in the information field of the configuration packets

Page 54: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Authentication

• Authentication means validating the identity of a user who needs to access

• PPP is designed for use over dial-up links

User authentication is necessary• PPP has two protocols for authentication

– Password Authentication Protocol (PAP)– Challenge Handshake Authentication Protocol

(CHAP)

Page 55: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Password Authentication Protocol (PAP)

Page 56: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Challenge Handshake Authentication Protocol (CHAP)

• Three-way hand-shaking authentication protocol with greater security than PAP

Page 57: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Network Control Protocol: NCP• PPP is a multiple-network layer protocol.• It can carry a network data packet from protocols defined by the

Internet, OSI, Xerox, DECnet, AppleTalk, Novel• IPCP (IP Control Protocol)

– Configures the link used to carry IP packets in the Internet

Page 58: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

IPCP Packet

IP Datagram in a PPP frame

Page 59: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Multiple PPP

Page 60: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Example (1)

Page 61: Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.

Example (2)