The Data Link Layer ( 数据链路层 )

Click here to load reader

download The Data Link Layer ( 数据链路层 )

of 65

description

The Data Link Layer ( 数据链路层 ). Chapter 3. 3.1 Data Link Layer Design Issues. Services Provided to the Network Layer ( 为网络层提供的服务 ) Framing ( 帧 ) Error Control ( 差错控制 ) Flow Control ( 流量控制). 3.1.1 Services provided to the network layer. - PowerPoint PPT Presentation

Transcript of The Data Link Layer ( 数据链路层 )

  • The Data Link Layer()Chapter 3

  • 3.1 Data Link Layer Design IssuesServices Provided to the Network Layer FramingError ControlFlow Control

  • 3.1.1 Services provided to the network layerUnacknowledged connectionless serviceAcknowledged connectionless service Acknowledged connection-oriented service

  • Functions of the Data Link LayerProvide service interface to the network layerDealing with transmission errorsRegulating data flowSlow receivers not swamped by fast senders

  • Functions of the Data Link Layer (2)Relationship between packets and frames.

  • Services Provided to Network Layer(a) Virtual communication.(b) Actual communication.

  • Services Provided to Network Layer (2)Placement of the data link protocol.

  • H1 H2 R1 R2 R3 H1 H2

  • ( H1 H2 R1 R2 R3 H1 H2 H1H2R1R2R3

  • 3.1.2 FramingFraming method(): 31character count -[see fig 3-3]2Starting and ending character,with character stuffing -[see fig 3-4]Frame flags: DLE STX(Start Text), DLE ETX(End Text)DLE in data(between flags): DLE-->DLE DLE, so that: DLE ETX--> DLE DLE ETX 3Starting and ending flags,with bit stuffing . -01111110-[see fig 3-5]Physical layer coding violation 1->-0->-

  • Framing (2)A character stream. (a) Without errors. (b) With one error.

  • Framing (3)(a) A frame delimited by flag bytes.(b) Four examples of byte sequences before and after stuffing.

  • Framing (4)Bit stuffing(a) The original data.(b) The data as they appear on the line.(c) The data as they are stored in receivers memory after destuffing.

  • 3.1 DATA LINK LAYER DESIGN ISSUES3.1.3 Error ControlError detectionError correctionRepeated data frameLost frameTimer3.1.4 Flow ControlTo solve the problem that a sender wants to transmit frames faster than the receiver can accept them.Feedback-based flow controlRate-based flow control

  • 3.2 Error Detection and CorrectionError-Correcting Codescodeword Hamming distance (10001001,10110001=>00111000,3)parity bitd2d+1Error-Detecting Codespolynomial codecyclic redundancy codeCRC codedd+1

  • 3.2.1 Error-Correcting Codes (*)Use of a Hamming code to correct burst errors.

  • 3.2.2 Error-Detecting CodesCalculation of the polynomial code checksumCRC G(x)-[see page 197]CRC-12 = x12+x11+x3+x2+x1+1CRC-16 = x16+x15+x2+1CRC-CCITT = x16+x12+x5+1r
  • 1101010110 Q P 110101 101000110100000 2nM 110101 111011 110101 111010 110101 111110 110101 101100 110101 110010 110101 01110 R

  • 3.3 Elementary Data Link ProtocolsAn Unrestricted Simplex ProtocolA Simplex Stop-and-Wait Protocol-A Simplex Protocol for a Noisy Channel

    (process)(packet)(frame)wait_for_event(&event), 3 events:frame_arrival: Received correct frame cksum_err: Received frame with checksum errortimeout: Timeout when waiting acknowledgement

  • Protocol DefinitionsContinued Some definitions needed in the protocols to follow. These are located in the file protocol.h.

  • Protocol Definitions(ctd.)Some definitions needed in the protocols to follow. These are located in the file protocol.h.

  • 3.3.1 Unrestricted Simplex Protocol()

  • 3.3.2 Simplex Stop-and-Wait Protocol(-)

    stop-and-wait,,, .:,.

  • 3.3.3 A Simplex Protocol for a Noisy Channel(PAR)(timer)(sequence)PAR/ARQ(timeout)network layer of sender has unlimited data to transmit.Discard restricted condition: channel never damages or loses frame.

    Continued PAR:Positive Acknowledgement with RetransmissionARQ:Automatic Repeat reQuest

  • A Simplex Protocol for a Noisy Channel (ctd.)A positive acknowledgement with retransmission protocol.

  • 3.4 Sliding Window ProtocolsBidirectional transmission, piggybacking, better use of available bandwidth slide windowsending window: a set of sequence numbers corresponding to frame it is permitted to send for senderreceiving window: corresponding to the set of frames which is permitted to accept for receiver

  • Sliding Window Protocols (2)A One-Bit Sliding Window ProtocolA Protocol Using Go Back NnA Protocol Using Selective Repeat

  • Sliding Window Protocols (3)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.

  • 3.4.1 A One-Bit Sliding Window ProtocolContinued

  • A One-Bit Sliding Window Protocol (ctd.)

  • A One-Bit Sliding Window Protocol (2) 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.

  • 3.4.2 A Protocol Using Go Back NPipelining and error recovery. Effect on an error when(a) Receivers window size is 1.(b) Receivers window size is large.

  • Sliding Window Protocol Using Go Back N (2)W=1MAX_SEQStop-and-wait is not fitful for channel which has long round-trip delay, e.g. Satellite channel,270 msBidirectional transmission, noisy channel,Discard restricted condition: network layer of sender has unlimited data to transmitsize of receiving window = 1, receiver discards all subsequent frames after a damaged or lost data frame.

  • Sliding Window Protocol Using Go Back N (3)MAX_SEQ+1 distinct sequence numbers(0,1,2,... MAX_SEQ),no more than MAX_SEQ unacknowledged frames,the sender window
  • Sliding Window Protocol Using Go Back N (4)A Protocol Using Go Back n( when the size of sender window=7,no ambiguity:The sender sends frames 0 through 6A piggybacked acknowledgement for frame 6 eventually comes back to the senderThe sender sends another 7 frames:7,0,1,2,3,4,5,Frame 7,0,1,2,3,4,5 belonging to the second batch get lostFrame 7,0,1,2,3,4,5 belonging to the second batch arriveAnother piggybacked ack nowledgement comes in,no ambiguityFrame 7,0,1,2,3,4,5 belonging to the second batch get lost,ack=6Frame 7,0,1,2,3,4,5 belonging to the second batch arrive,ack=5the problem :Since a sender may have to retransmit all the unacknowledged frames at a future time ,it must hang on to all transmitted frames until it knows for sure that they have been accepted by the receiver.No acknowledged frames without data.

  • Sliding Window Protocol Using Go Back N (5)Continued

  • Sliding Window Protocol Using Go Back N (6)Continued

  • Sliding Window Protocol Using Go Back N (7)Continued

  • Sliding Window Protocol Using Go Back N (8)

  • Sliding Window Protocol Using Go Back N (9)Simulation of multiple timers in software.

  • 3.4.3 A Sliding Window Protocol Using Selective Repeat

    >1W

  • A Sliding Window Protocol Using Selective Repeat (2)Continued

  • A Sliding Window Protocol Using Selective Repeat (3)Continued

  • A Sliding Window Protocol Using Selective Repeat (4)Continued

  • A Sliding Window Protocol Using Selective Repeat (5)

  • A Sliding Window Protocol Using Selective Repeat (6)(a) Initial situation with a window size seven.(b) After seven frames sent and received, but not acknowledged.(c) Initial situation with a window size of four.(d) After four frames sent and received, but not acknowledged.

  • * 3.5 Protocol VerificationFinite State Machined ModelsPetri Net Models

  • *3.5.1 Finite State Machined Models(a) State diagram for protocol 3. (b) Transmissions.

  • *3.5.2 Petri Net ModelsA Petri net with two places and two transitions.

  • *Petri Net Models (2)A Petri net model for protocol 3.

  • 3.6 Example Data Link ProtocolsHDLC High-Level Data Link Control The Data Link Layer in the Internet

  • 3.6.1 High-Level Data Link ControlSDLC(IBMSNA)ADCCP(ANSI) HDLC(ISO)LAP(CCITT)LAPB(X.25)bit-oriented protocol frame format-[see fig 3-24]flag sequence (01111110)the minimum framethree fields32 bitsthree kinds of framesInformationSupervisoryUnnumbered-[see fig 3-25]

  • High-Level Data Link Control (2)Seq --- sender seq(like former protocol 5 )Next --- expected frame seq, different from former ack,it is (ack+1) mod 8

  • High-Level Data Link Control (3)Information frame():Supervisory frame():RR(Receive Ready),RNR(Receive Not Ready): to implement flow controlREJ(Reject): like NAK frame,Next,NextSREJ(Selective Reject),Unnumbered frame ():request to establish connection: SNRM(Set Normal Response Mode), SABM(set asynchronous balanced mode)request to disconnect: DISC(Disconnect)response frame: UA(unnumbered acknowledgement)report severe error: FRMR(FRaMe Reject)

  • 3.6.2 The Data Link Layer in the InternetA home personal computer acting as an internet host.

  • (ISP) TCP/IP PPP PC

  • PPP 1992 PPP 1993 1994 PPP [RFC 1661] PPP IP LCP (Link Control Protocol) NCP (Network Control Protocol)

  • PPP PPP HDLC F 0x7E 0x 7E 01111110 A 0xFF C 0x03PPP PPP

  • PPP PPP 2 0x0021 PPP IP 0xC021, PPP 0x8021 IP 121112 1500 PPP 7EFF03FACFCSF7E

  • PPPPoint to Point Protocol (2)Supporterror detectionmultiple protocols(IP,IPX,Apple Talk,XNS,...),allows IP address to be negotiatedpermits authenticationLCP(Link Control Protocol): byte oriented and bit-oriented encodingsNCP(Network Control Protocol).Frame format(as HDLC):-[see fig 3-27]A simplified phase diagram for bringing a line up and down-[see fig 3-28]

  • PPP Point to Point Protocol (3)The PPP full frame format for unnumbered mode operation.Flag: 01111110Address: always 11111111Control: default 00000011 (unnumbered mode)Protocol: default size is 2 bytes, tell what kind of packet is in the Playload fieldprotocols starting with a 0 bit are network lay protocols such as IP, IPX,OSL CLNP, XNS; Those starting with a 1 bit are used to negotiate other protocols: LCP or other NCPPayload: variable length, up to some negotiated maximum; default length of 1500 bytes is used for LCP line setupChecksum: 2 or 4 bytes

  • PPP Point to Point Protocol (4)A simplified phase diagram for bring a line up and down.

  • PPP Point to Point Protocol (5)The LCP frame types.

  • 3.7 SummaryThe task of the data link layerThe size of windowthe sliding windowstop-wait protocolsliding window protocolModelsfinite state machine models and Petri net modelsExample of the data link layerbit-orientedSDLCHDLCADCCP or LAPBbyte-oriented and bit-orientedSLIP and PPPInternet

  • Exercises2351415162937