Lect21 09-11

27
1 Application Layer Presentation Layer Session Layer Transport Layer Network Layer Data Link Layer Physical Layer Application Layer Presentation Layer Session Layer Transport Layer Network Layer Data Link Layer Physical Layer Network Layer Electrical and/or Optical Signals Application A Application B Data Link Layer Physical Layer Network Layer Data Link Layer Physical Layer Communication Network Figure 2.6 Review of seven layers

description

 

Transcript of Lect21 09-11

Page 1: Lect21 09-11

1

ApplicationLayer

PresentationLayer

SessionLayer

TransportLayer

NetworkLayer

Data LinkLayer

PhysicalLayer

ApplicationLayer

PresentationLayer

SessionLayer

TransportLayer

NetworkLayer

Data LinkLayer

PhysicalLayer

NetworkLayer

Electrical and/or Optical Signals

Application A Application B

Data LinkLayer

PhysicalLayer

NetworkLayer

Data LinkLayer

PhysicalLayer

Communication Network

Figure 2.6

Review of seven layers

Page 2: Lect21 09-11

Data Link Control

• Framing

• Line Discipline/MAC

• Flow Control

• Error Control

• Addressing

WCB/McGraw-Hill The McGraw-Hill Companies, Inc., 1998

Page 3: Lect21 09-11

Data Link Layer

WCB/McGraw-Hill The McGraw-Hill Companies, Inc., 1998

Page 4: Lect21 09-11

WCB/McGraw-Hill The McGraw-Hill Companies, Inc., 1998

Page 5: Lect21 09-11

Peer-to-peer protocols

• Two communicating entities are called peer processes.

• Communication between layer n+1 peers is virtual and is carried by layer n service

• Two meanings of peer-to-peer:

point-to-point (hop-by-hop):

end-to-end (user-to-user):

Physical link

network

Page 6: Lect21 09-11

6

3 2 11 22

1

3 2 11 22

1

21

Medium

1

2

Physical layer entity

Data link layer entity

3 Network layer entity

PhysicalLayer

Data linkLayer

PhysicalLayer

Data linkLayer

A B

A B

Packets Packets

Frames

(a)

(b)

Peer-to-peer protocol across a single hop

1. take packets2. form frame3. transfer through

Physical layer

5. deliver tonetwork layer

Several pairs of data link & physical entities

Only one network layer entity, a routermay connect several different networks

4. Pass up

Page 7: Lect21 09-11

PhysicalLayer

Data linkLayer

PhysicalLayer

Data linkLayer

End system

NetworkLayer

NetworkLayer

PhysicalLayer

Data linkLayer

NetworkLayer

PhysicalLayer

Data linkLayer

NetworkLayer

TransportLayer

TransportLayer

MessagesMessages

Segments

End system

Network

Peer-to-peer protocol operating end-to-end across network

Page 8: Lect21 09-11

3 2 11 22

1

3 2 11 22

1

21

Medium

A B

3 2 11 221

C

21

21

2 134 1 2 3 4

End System End System

Network1

2

Physical layer entity

Data link layer entity 3 Network layer entity

3 Network layer entity

Transport layer entity4Figure 5.4Peer-to-peer protocol operating end-to-end across network

1. Layer 4 not in middle 2.Data go up and down in router

3. Different paths4. Out of order, delay, duplicate, lost

Page 9: Lect21 09-11

9

Service models

• Connection-oriented and connectionless• Confirmed and unconfirmed• A service may transfer in constant bit rate ( CBR)

or variant bit rate (VBR)

Page 10: Lect21 09-11

1 2 3 4 5

Data Data Data

ACK/NAK

Data

1 2 3 4 5

Data Data Data Data

ACK/NAK

ACK/NAK

ACK/NAK

ACK/NAK

End-to-end

Hop-by-hop

Figure 5.7

Adaptation functions may be implemented end-to-end or hop-by-hop

Data are ACK or NAK by the other end

Data are ACK or NAK by each hop

Page 11: Lect21 09-11

11

End-to-end versus hop-by-hop (cont.)•Hop-by-hop: faster recovery & more reliable

but more burden on middle nodes•End-to-end: simpler and only at end-system•QUESTIONS:

–could hop-to-hop waivers end-to-end? NO. it is difficult for all elements in the hop-by-hop

chain to operate correctly, furthermore the errors

may be introduced in middle nodes

--Adaptations are implemented at which layer(s)?

Hop-by-hop: End-by-End:

Data link & network layerTransport & application layer

Page 12: Lect21 09-11

12

End-to-end versus hop-by-hop (cont.)

• In case of error-detection and recovery:– If frequent errors, use hop-by-hop , otherwise end-to-end

• Flow control and congestion control could be exercised on a hop-by-hop or end-to-end basis or both.

• Security issue: may be hop-by-hop or end-by-end– IPSec (IP security protocol) in Internet layer, hop-by-hop/end-to-end?

– SSL (Secure Socket Layer) in transport layer, end-to-end

– SSH (Secure Shell) in application layer, end-to-end

Page 13: Lect21 09-11

13

ARQ (Automatic Repeat Request) protocols

• A technique used to ensure accurate delivery of a data stream despite errors during transmission

• Form a basis for peer-to-peer protocols• Assume that

– There is a connection between peers– The channel is error-prone– A sequence of information blocks for transfer

Page 14: Lect21 09-11

14

Typical ARQ protocols• Assume unidirectional transmission, consider

bidirectional transmission later– Stop-and-wait ARQ– Go-back-N ARQ

• Based on ARQs,– Sliding-window flow control– Reliable stream service (TCP preview)

• Data link layer protocols --HDLC (High-level Data Link Control)

--PPP (Point-to-Point protocol)

Page 15: Lect21 09-11

15

Stop-and-Wait ARQ

• Transmitter sends one frame and waits for acknowledgment

• Receiver acknowledges the receiving of the frame• After receiving acknowledgment, transmitter

sends the next frame• In case the transmitted frame or returned

acknowledgment was lost, the transmitter’s timer will time out, the transmitter resends the frame

Page 16: Lect21 09-11

16

A

B

One frame

ACK

Another frame

ACK

timeAnotherframe

Figure 5.9

Stop-and-Wait ARQ

•Transmitter A sends one frame and waits for acknowledgment

•Receiver B acknowledges the receiving of the frame

•After receiving acknowledgment, transmitter A sends the next frame

Any Problem with it?Transmitted frame may lost, the acknowledgment may lost.

How to solve?Set up timer, when timer times out, resends the frame

Page 17: Lect21 09-11

17

(a) Frame 1 lost or badly garbled

A

B

One

frame Another

frame

ACK

The frame

ACK

timeTime-out

Anotherframe

(b) ACK lost

A

B

One

frame Anotherframe

ACK

theframe

ACK

timeTime-out

Anotherframe

ACK

Figure 5.9

Using timer to retransmit the frame when a frame or acknowledgement lost

Any problem? Frame was received twice when ACK lost.

How to solve it?Introduce sequence number (SN) into frame and discard duplicate frame

Page 18: Lect21 09-11

18

Go-back-N ARQ• Sends enough frames to keep channel busy and

then waits for ACK• ACK to one frame validates all frames ahead of

this frame (called accumulated ACK)• If ACK for a frame is not received before time

out, all outstanding frames are retransmitted.

Page 19: Lect21 09-11

19

A

B

fr0

timefr1

fr2

fr3

fr4

fr5

fr6

fr3

ACK1 error

Out-of-sequence frames

Go-Back-4: 4 frames are outstanding; so go back 4

fr5

fr6

fr4

fr7

fr8

fr9

ACK2

ACK3

ACK4

ACK5

ACK6

ACK7

ACK8

ACK9

Figure 5.13

Basic Go-back-N ARQ

1. A sends 0,1,2,3 frames then waits for ACK2. ACK1 just comes in time and A sends one more frame: 43. ACK2 and 3 come and A sends frame 5 and 64. Frame 3 lost and no ACK for it5. B discards out-of-sequence frame 4,5,6 6. A exhausts its window (4 frames) and does not receive ACK, so resends all outstanding frames 3,4,5,6, called Go-back N

Page 20: Lect21 09-11

Sliding Window Protocols

• Bidirectional Protocol

• Each frame contains a sequence number

• Sliding window refers to a imaginary boxes at the transmitter and receiver.

• At any instant of time , the sender maintains a set of sequence numbers corresponding to the frames permitted to send.

• The receiver also maintains a receiver window corresponding to the set of frames permitted to accept

Page 21: Lect21 09-11

Sliding Window

Figure 10-11

WCB/McGraw-Hill The McGraw-Hill Companies, Inc., 1998

Page 22: Lect21 09-11

Sliding window

• The sequence number within a sender’s window represents the no of frames sent but not yet acknowledged.

• The receiving window corresponds to the frames the receiver may accept.

Page 23: Lect21 09-11

WCB/McGraw-Hill The McGraw-Hill Companies, Inc., 1998

Sender Sliding Window

Page 24: Lect21 09-11

Figure 10-13

WCB/McGraw-Hill The McGraw-Hill Companies, Inc., 1998

Receiver Sliding Window

Page 25: Lect21 09-11

Figure 10-14

WCB/McGraw-Hill The McGraw-Hill Companies, Inc., 1998

Sliding Window Example

Page 26: Lect21 09-11

Figure 10-14-continued

WCB/McGraw-Hill The McGraw-Hill Companies, Inc., 1998

Sender

Page 27: Lect21 09-11

WCB/McGraw-Hill The McGraw-Hill Companies, Inc., 1998

Receiver