457 lecture 03
TRANSCRIPT
![Page 1: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/1.jpg)
CS 457 – Lecture 3Link Layer Protocols
Fall 2011
![Page 2: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/2.jpg)
The Internet Hourglass Design
[Deering98]
Application Layer
Protocol Layer
Transport Layer
Network Layer
Link Layer
Data Communication
Physical Layer
![Page 3: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/3.jpg)
Topics• Link-layer services
– Encoding, framing, and error detection– Error correction and flow control– Forms necessary background
• Reliable Transmission– First look at an essential part of networking
• Ethernet, WiFi, Cellular– How to share a transmission medium– Carrier sense, collision detection, and random
access
![Page 4: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/4.jpg)
Message, Segment, Packet, & Frame
•HTTP
•TCP
•IP
•Ethernet•interface
•HTTP
•TCP
•IP
•Ethernet•interface
•IP •IP
•Ethernet•interface
•Ethernet•interface
•SONET•interface
•SONET•interface
•host •host
•router •router
•HTTP message
•TCP segment
•IP packet •IP packet•IP packet
•Ethernet frame •Ethernet frame•SONET frame
WE ARE HERE IN THE LAYERS
![Page 5: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/5.jpg)
Adaptors Communicating
• Link layer implemented in adaptor (network interface card)– Ethernet card, PCMCIA card, 802.11 card
• Sending side:– Encapsulates datagram in a frame– Adds error checking bits, flow control, etc.
• Receiving side– Looks for errors, flow control, etc.– Extracts datagram and passes to receiving node
•sending
•node
•frame
•receiving
•node
•datagram
•frame
•adapter •adapter
•link layer protocol
![Page 6: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/6.jpg)
Point to Point Data Links• One sender, One receiver, One link:
easier than broadcast link:– no Media Access Control– no need for explicit MAC addressing– e.g., dialup link, ISDN line
• Popular Point-to-Point DLC protocols:– PPP (point-to-point protocol)– HDLC: High level data link control
![Page 7: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/7.jpg)
PPP Design Requirements [RFC 1557]
• Packet framing: encapsulation of network-layer datagram in data link frame – carry network layer data of any network layer
protocol (not just IP) at same time– ability to demultiplex upwards
• Bit transparency: must carry any bit pattern in the data field
• Error detection (no correction)• Connection liveness: detect, signal link failure to
network layer• Network layer address negotiation: endpoint can
learn/configure each other’s network address
![Page 8: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/8.jpg)
PPP non-requirements• No error correction/recovery• No flow control• Out of order delivery OK • No need to support multipoint links
(e.g., polling)
•Error recovery, flow control, data re-ordering
•all relegated to higher layers!
![Page 9: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/9.jpg)
PPP Data Frame• Flag: delimiter (framing)• Address: does nothing (only one option)• Control: does nothing; in the future possible
multiple control fields• Protocol: upper layer protocol to which frame
delivered (eg, PPP-LCP, IP, IPCP, etc)
![Page 10: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/10.jpg)
PPP Data Frame
• info: upper layer data being carried• check: cyclic redundancy check for error
detection
![Page 11: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/11.jpg)
Ethernet Frame Structure
• Sending adapter encapsulates packet in frame
• Preamble: synchronization– Seven bytes with pattern 10101010, followed by
one byte with pattern 10101011– Used to synchronize receiver, sender clock rates
![Page 12: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/12.jpg)
Ethernet Frame Structure (Cont.)• Addresses: source and destination MAC addresses
– Adaptor passes frame to network-level protocol• If destination address matches the adaptor• Or the destination address is the broadcast address
– Otherwise, adapter discards frame
• Type: indicates the higher layer protocol – Usually IP– But also Novell IPX, AppleTalk, …
• CRC: cyclic redundancy check– Checked at receiver– If error is detected, the frame is simply dropped
![Page 13: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/13.jpg)
Encoding Bits• Simple idea of “high” for 1 and low for 0
– Say 1 usec per bit. Sender sends 4 bits with 4 usec “high”– Receiver sees 4.6 usec of “high”…. Was that 4 or 5 bits?
• Allows clocks in sending and receiving nodes to synchronize to each other– no need for a centralized, global clock among nodes!
• Physical-layer stuff for Electrical Engineers!
![Page 14: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/14.jpg)
Error Detection•EDC= Error Detection and Correction bits (redundancy)
•D = Data protected by error checking, may include header fields
• Error detection not 100% reliable!
• protocol may miss some errors, but rarely
• larger EDC field yields better detection and correction
![Page 15: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/15.jpg)
Parity Checking
•Single Bit Parity:•Detect single bit errors
•Two Dimensional Bit Parity:•Detect and correct single bit errors
0 0
![Page 16: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/16.jpg)
Internet Checksum
Sender:• treat segment contents as
sequence of 16-bit integers• checksum: addition (1’s
complement sum) of segment contents
• sender puts checksum value into UDP checksum field
Receiver:• compute checksum of received
segment• check if computed checksum
equals checksum field value:– NO - error detected– YES - no error detected. But
maybe errors nonetheless? More later ….
• Goal: detect “errors” (e.g., flipped bits) in transmitted segment
![Page 17: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/17.jpg)
Checksumming: Cyclic Redundancy Check
• view data bits D as a polynomial • choose r+1 polynomial C • goal: choose r CRC bits, R, such that
– <D,R> exactly divisible by C (modulo 2) – receiver knows C, divides <D,R> by C. If non-zero
remainder: error detected!– can detect all burst errors less than r+1 bits
• widely used in practice (ATM, HDCL)
![Page 18: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/18.jpg)
Reliable TransferFundamental Networking Topic
Most important topic thus far in this course
• Frames may be lost or corrupted– Encoding failures where clocks get out of sync – Error detection reports packet is corrupted– And a vast number of other reasons….
• Can we build link so it appears reliable?– Build link so errors never occur??
• not feasible
– Add error correction to frames?• requires lots of additional overhead bytes for each frame• doesn’t help if entire frame lost (e.g. clock sync error)
![Page 19: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/19.jpg)
Stop and Wait (first attempt… has an error)
• Sender writes frame onto wireand sets a timeout to wait for an ACK– Sender now “stops” and “waits” for the ACK
• Upon receiving a packet, receiver sends an ACK
• Sender Will Either 1) receive an ACK and can send next frame
2) times out and receives the “lost” frame
![Page 20: 457 Lecture 03](https://reader036.vdocument.in/reader036/viewer/2022083009/55cf92ed550346f57b9a805a/html5/thumbnails/20.jpg)
Reasons for Retransmission
•Packet
•ACK
• Tim
eou
t
•Packet
•ACK
• Tim
eou
t
•Packet
• Tim
eou
t
•Packet
•ACK
• Tim
eou
t
•Packet
•ACK
• Tim
eou
t•Packet
•ACK
• Tim
eou
t
•ACK lost
•DUPLICATE PACKET
•Packet lost•Early timeout
•DUPLICATEPACKETS