1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network...
-
Upload
miles-fletcher -
Category
Documents
-
view
218 -
download
0
Transcript of 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network...
![Page 1: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/1.jpg)
1
Week 5 Lecture 3Data Link Layer
![Page 2: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/2.jpg)
2
Data Link Layer location
• application: supporting network applications– FTP, SMTP, STTP
• transport: host-host data transfer– TCP, UDP
• network: routing of datagrams from source to destination– IP, routing protocols
• link: data transfer between neighboring network elements– PPP, Ethernet
• physical: bits “on the wire”
application
transport
network
Data link
physical
![Page 3: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/3.jpg)
3
Link Layer: where?
Some terminology:• communication channels that
connect adjacent nodes along communication path are links– wired links
– wireless links
• 2-PDU is a frame, encapsulates datagram
“link”
data-link layer has responsibility of transferring frames from one node to adjacent node over a link
![Page 4: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/4.jpg)
4
Link layer: Analogy
• Datagram transferred by different link protocols over different links:– e.g., Ethernet on first link,
frame relay on intermediate links, 802.11 on last link
• Each link protocol provides different services– e.g., may or may not
provide RDT over link
transportation analogy• trip from Princeton to Lausanne
– limo: Princeton to JFK– plane: JFK to Geneva– train: Geneva to Lausanne
• tourist = datagram• transport segment =
communication link• Concrete transportation mode
= link layer protocol• travel agent = routing
algorithm
![Page 5: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/5.jpg)
5
Think: why put the following functions in Data Link Layer?
• (most important) channel access: channel access if shared medium
• Framing, – encapsulate datagram into frame, adding header, trailer– ‘physical addresses’ used in frame headers to identify source, dest
• different from IP address!
• (may not exist) Reliable delivery between adjacent nodes-- seldom used on low bit-error-rate link (fiber, some
twisted pair)– wireless links: high error rates
• Q: why both link-level and end-end reliability (TCP)?
![Page 6: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/6.jpg)
6
Link Layer Services (more)• Flow Control:
– pacing between adjacent sending and receiving nodes
• Error Detection: – errors caused by signal attenuation, noise.
– receiver detects presence of errors:
• signals sender for retransmission or drops frame
• Error Correction: – receiver identifies and corrects bit error(s) without
resorting to retransmission
![Page 7: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/7.jpg)
7
Data link layer: where?
• link layer implemented in “adaptor” (aka NIC)– Ethernet card, PCMCI card,
802.11 card
• sending side:– encapsulates datagram in a
frame– adds error checking bits, rdt,
flow control, etc.
• receiving side– looks for errors, rdt, flow
control, etc– extracts datagram, passes to
rcving node
• adapter is semi-autonomous• link & physical layers in one
board !
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
![Page 8: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/8.jpg)
8
Error DetectionEDC= 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 9: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/9.jpg)
9
1. Parity Checking
Single Bit Parity:Detect single bit errors
Two Dimensional Bit Parity:Detect and correct single bit errors
0 0
![Page 10: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/10.jpg)
10
2. 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 (note: used at transport layer only)
![Page 11: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/11.jpg)
11
3. Cyclic Redundancy Check
• view data bits, D, as a binary number
• choose r+1 bit pattern (generator), G
• goal: choose r CRC bits, R, such that– <D,R> exactly divisible by G (modulo 2) – receiver knows G, divides <D,R> by G. If non-zero remainder:
error detected!– can detect all burst errors less than r+1 bits
• widely used in practice (ATM, HDCL)
![Page 12: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/12.jpg)
12
CRC ExampleWant:
D.2r XOR R = nGequivalently:
D.2r = nG XOR R equivalently: if we divide D.2r by
G, want remainder R
R = remainder[ ]D.2r
G
Note: Not subtraction! Use XOR!
![Page 13: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/13.jpg)
13
outline
• 1 Introduction and services
• 2 Error detection and correction
• 3 Multiple access protocols
• 4 LAN addresses and ARP
• 5 Ethernet
• 6 Hubs, bridges, and switches
![Page 14: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/14.jpg)
14
Why Multiple Access protocols?• single shared broadcast channel • two or more simultaneous transmissions by
nodes: interference – only one node can send successfully at a time
multiple access protocol• distributed algorithm that determines how
nodes share channel, i.e., determine when node can transmit
![Page 15: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/15.jpg)
15
MAC Protocols: a taxonomy
Three broad classes:• Channel Partitioning
– divide channel into smaller “pieces” (time slots, frequency, code)
– allocate piece to node for exclusive use
• Random Access– channel not divided, allow collisions
– “recover” from collisions
• “Taking turns”– tightly coordinate shared access to avoid collisions
![Page 16: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/16.jpg)
16
1. Channel Partitioning MAC: TDMA
TDMA: time division multiple access • access to channel in "rounds" • each station gets fixed length slot (length = pkt trans time)
in each round • unused slots go idle • example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle • TDM (Time Division Multiplexing): channel divided into
N time slots, one per user; inefficient with low duty cycle users and at light load.
• FDM (Frequency Division Multiplexing): frequency subdivided.
![Page 17: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/17.jpg)
17
1. Channel Partitioning MAC : FDMA
FDMA: frequency division multiple access • example: 6-station LAN, 1,3,4 have pkt, frequency
bands 2,5,6 idle fr
equ
ency
bands time
![Page 18: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/18.jpg)
18
1. Channel Partitioning (CDMA)CDMA (Code Division Multiple Access) • unique “code” assigned to each user; i.e., code set partitioning• used mostly in wireless broadcast channels (cellular, satellite,
etc)• all users share same frequency, but each user has own
“chipping” sequence (i.e., code) to encode data• encoded signal = (original data) X (chipping sequence)• decoding: inner-product of encoded signal and chipping
sequence• allows multiple users to “coexist” and transmit simultaneously
with minimal interference (if codes are “orthogonal”)
![Page 19: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/19.jpg)
19
2. Random Access Protocols -- Ethernet • When node has packet to send
– transmit at full channel data rate R.
– no a priori coordination among nodes
• two or more transmitting nodes -> “collision”,• random access MAC protocol specifies:
– how to detect collisions
– how to recover from collisions (e.g., via delayed retransmissions)
![Page 20: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/20.jpg)
20
CSMA (Carrier Sense Multiple Access)
CSMA: listen before transmit:• If channel sensed idle: transmit entire frame• If channel sensed busy, defer transmission
• Human analogy: don’t interrupt others!
![Page 21: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/21.jpg)
21
CSMA/CD (Collision Detection)CSMA/CD: carrier sensing, deferral as in CSMA
– collisions detected within short time– colliding transmissions aborted, reducing channel
wastage
• collision detection: – easy in wired LANs: measure signal strengths,
compare transmitted, received signals– difficult in wireless LANs: receiver shut off while
transmitting
• human analogy: the polite conversationalist
![Page 22: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/22.jpg)
22
3. “Taking Turns” MAC protocols
Polling: • master node
“invites” slave nodes to transmit in turn
• concerns:– polling overhead
– latency
– single point of failure (master)
Token passing:control token passed from one node to next sequentially.token messageconcerns:
token overhead latencysingle point of failure (token)
![Page 23: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/23.jpg)
23
Summary of MAC protocols
• What do you do with a shared media?– Channel Partitioning, by time, frequency or code
• Time Division,Code Division, Frequency Division
– Random partitioning (dynamic), • ALOHA, S-ALOHA, CSMA, CSMA/CD
• carrier sensing: easy in some technologies (wire), hard in others (wireless)
• CSMA/CD used in Ethernet
– Taking Turns• polling from a central site, token passing
![Page 24: 1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.](https://reader035.fdocuments.us/reader035/viewer/2022062803/56649f3c5503460f94c5b9c5/html5/thumbnails/24.jpg)
24
Next week – Exam # 1 & Bluetooth