0% found this document useful (0 votes)
60 views8 pages

Link Layer and Lans Chapter 5: The Data Link Layer: Our Goals

network layer

Uploaded by

free5050
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views8 pages

Link Layer and Lans Chapter 5: The Data Link Layer: Our Goals

network layer

Uploaded by

free5050
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Chapter 5 Chapter 5: The Data Link Layer

Link Layer and LANs Our goals:


❒ understand principles behind data link layer
services:
❍ error detection, correction
❍ sharing a broadcast channel: multiple access
A note on the use of these ppt slides: ❍ link layer addressing
reliable data transfer, flow control: done!
We’re making these slides freely available to all (faculty, students, readers).
They’re in PowerPoint form so you can add, modify, and delete slides Computer Networking: ❍
(including this one) and slide content to suit your needs. They obviously A Top Down Approach
represent a lot of work on our part. In return for use, we only ask the
Featuring the Internet, ❒ instantiation and implementation of various link
following:
‰ If you use these slides (e.g., in a class) in substantially unaltered form, 3rd edition. layer technologies
that you mention their source (after all, we’d like people to use our book!)
‰ If you post any slides in substantially unaltered form on a www site, that Jim Kurose, Keith Ross
you note that they are adapted from (or perhaps identical to) our slides, and Addison-Wesley, July
note our copyright of this material.
2004.
Thanks and enjoy! JFK/KWR

All material copyright 1996-2004


J.F Kurose and K.W. Ross, All Rights Reserved
5: DataLink Layer 5-1 5: DataLink Layer 5-2

Link Layer Link Layer: Introduction “link”


Some terminology:
❒ 5.1 Introduction and ❒ 5.6 Hubs and switches ❒ hosts and routers are nodes
services ❒ communication channels that
connect adjacent nodes along
❒ 5.2 Error detection
communication path are links
and correction ❍ wired links
❒ 5.3Multiple access ❍ wireless links
protocols ❍ LANs
❒ 5.4 Link-Layer ❒ layer-2 packet is a frame,
encapsulates datagram
Addressing
❒ 5.5 Ethernet
data-link layer has responsibility of
transferring datagram from one node
to adjacent node over a link
5: DataLink Layer 5-3 5: DataLink Layer 5-4

Link layer: context Link Layer Services


❒ Datagram transferred by
transportation analogy
❒ trip from Princeton to ❒ Framing, link access:
different link protocols
Lausanne encapsulate datagram into frame, adding header, trailer
over different links: ❍
❍ limo: Princeton to JFK ❍ channel access if shared medium
❍ e.g., Ethernet on first link,
❍ plane: JFK to Geneva “MAC” addresses used in frame headers to identify
frame relay on ❍

intermediate links, 802.11 ❍ train: Geneva to Lausanne source, dest


on last link ❒ tourist = datagram • different from IP address!
❒ Each link protocol ❒ transport segment = ❒ Reliable delivery between adjacent nodes
provides different communication link ❍ we learned how to do this already (chapter 3)!
services ❒ transportation mode =
❍ seldom used on low bit error link (fiber, some twisted

e.g., may or may not pair)



link layer protocol
provide rdt over link ❍ wireless links: high error rates
❒ travel agent = routing • Q: why both link-level and end-end reliability?
algorithm
5: DataLink Layer 5-5 5: DataLink Layer 5-6

1
Link Layer Services (more) Adaptors Communicating
datagram
link layer protocol rcving
❒ Flow Control: sending node
node
❍ pacing between adjacent sending and receiving nodes frame frame
❒ Error Detection: adapter adapter
errors caused by signal attenuation, noise.
❒ link layer implemented in ❒ receiving side

❍ receiver detects presence of errors:
“adaptor” (aka NIC) ❍ looks for errors, rdt, flow
• signals sender for retransmission or drops frame control, etc
❍ Ethernet card, PCMCI
❒ Error Correction: card, 802.11 card ❍ extracts datagram, passes

receiver identifies and corrects bit error(s) without to rcving node


❍ ❒ sending side:
resorting to retransmission ❍ encapsulates datagram in ❒ adapter is semi-
❒ Half-duplex and full-duplex a frame autonomous
❍ with half duplex, nodes at both ends of link can transmit, ❍ adds error checking bits, ❒ link & physical layers
but not at same time rdt, flow control, etc.
5: DataLink Layer 5-7 5: DataLink Layer 5-8

Link Layer Error Detection


EDC= Error Detection and Correction bits (redundancy)
❒ 5.1 Introduction and ❒ 5.6 Hubs and switches D = Data protected by error checking, may include header fields
services ❒ 5.7 PPP
• Error detection not 100% reliable!
❒ 5.2 Error detection ❒ 5.8 Link Virtualization: • protocol may miss some errors, but rarely
and correction ATM • larger EDC field yields better detection and correction
❒ 5.3Multiple access
protocols
❒ 5.4 Link-Layer
Addressing
❒ 5.5 Ethernet

5: DataLink Layer 5-9 5: DataLink Layer 5-10

Parity Checking Internet checksum


Single Bit Parity: Two Dimensional Bit Parity: Goal: detect “errors” (e.g., flipped bits) in transmitted
Detect and correct single bit errors
Detect single bit errors segment (note: used at transport layer only)

Sender: Receiver:
❒ compute checksum of received
❒ treat segment contents
segment
as sequence of 16-bit
❒ check if computed checksum
integers equals checksum field value:
❒ checksum: addition (1’s ❍ NO - error detected
complement sum) of ❍ YES - no error detected. But
segment contents maybe errors nonetheless?
❒ sender puts checksum More later ….
0 0
value into UDP checksum
field

5: DataLink Layer 5-11 5: DataLink Layer 5-12

2
Checksumming: Cyclic Redundancy Check CRC Example
❒ view data bits, D, as a binary number Want:
❒ choose r+1 bit pattern (generator), G D.2r XOR R = nG
❒ goal: choose r CRC bits, R, such that
equivalently:
❍ <D,R> exactly divisible by G (modulo 2)
❍ receiver knows G, divides <D,R> by G. If non-zero remainder:
D.2r = nG XOR R
error detected! equivalently:
can detect all burst errors less than r+1 bits
if we divide D.2r by

❒ widely used in practice (ATM, HDCL)


G, want remainder R

D.2r
R = remainder[ ]
G

5: DataLink Layer 5-13 5: DataLink Layer 5-14

Multiple Access Links and Protocols


Link Layer
Two types of “links”:
❒ 5.1 Introduction and ❒ 5.6 Hubs and switches ❒ point-to-point
services ❍ PPP for dial-up access
❍ point-to-point link between Ethernet switch and host
❒ 5.2 Error detection
and correction ❒ broadcast (shared wire or medium)
❍ traditional Ethernet
❒ 5.3Multiple access
❍ upstream HFC
protocols
❍ 802.11 wireless LAN
❒ 5.4 Link-Layer
Addressing
❒ 5.5 Ethernet

5: DataLink Layer 5-15 5: DataLink Layer 5-16

Multiple Access protocols MAC Protocols: a taxonomy


❒ single shared broadcast channel Three broad classes:
❒ two or more simultaneous transmissions by nodes: ❒ Channel Partitioning
interference ❍ divide channel into smaller “pieces” (time slots,
frequency, code)
❍ collision if node receives two or more signals at the same time
❍ allocate piece to node for exclusive use
multiple access protocol
❒ Random Access
❒ distributed algorithm that determines how nodes ❍ channel not divided, allow collisions
share channel, i.e., determine when node can transmit ❍ “recover” from collisions
❒ communication about channel sharing must use channel ❒ “Taking turns”
itself! ❍ Nodes take turns, but nodes with more to send can take
❍ no out-of-band channel for coordination longer turns

5: DataLink Layer 5-17 5: DataLink Layer 5-18

3
Random Access Protocols CSMA (Carrier Sense Multiple Access)

❒ When node has packet to send


CSMA: listen before transmit:
❍ transmit at full channel data rate R.
❍ no a priori coordination among nodes
If channel sensed idle: transmit entire frame
❒ two or more transmitting nodes ➜ “collision”, ❒ If channel sensed busy, defer transmission

❒ random access MAC protocol specifies:


❍ how to detect collisions
❍ how to recover from collisions (e.g., via delayed
❒ Human analogy: don’t interrupt others!
retransmissions)
❒ Examples of random access MAC protocols:
❍ slotted ALOHA
❍ ALOHA
❍ CSMA, CSMA/CD, CSMA/CA

5: DataLink Layer 5-19 5: DataLink Layer 5-20

CSMA collisions spatial layout of nodes


CSMA/CD (Collision Detection)
collisions can still occur: CSMA/CD: carrier sensing, deferral as in CSMA
propagation delay means ❍ collisions detected within short time
two nodes may not hear
each other’s transmission ❍ colliding transmissions aborted, reducing channel
wastage
collision:
entire packet transmission
❒ collision detection:
time wasted ❍ easy in wired LANs: measure signal strengths,
note: compare transmitted, received signals
role of distance & propagation ❍ difficult in wireless LANs: receiver shut off while
delay in determining collision transmitting
probability
❒ human analogy: the polite conversationalist

5: DataLink Layer 5-21 5: DataLink Layer 5-22

CSMA/CD collision detection “Taking Turns” MAC protocols


channel partitioning MAC protocols:
❍ share channel efficiently and fairly at high load
❍ inefficient at low load: delay in channel access,
1/N bandwidth allocated even if only 1 active
node!
Random access MAC protocols
❍ efficient at low load: single node can fully
utilize channel
❍ high load: collision overhead
“taking turns” protocols
look for best of both worlds!
5: DataLink Layer 5-23 5: DataLink Layer 5-24

4
“Taking Turns” MAC protocols Summary of MAC protocols
Polling: Token passing:
❒ What do you do with a shared media?
❒ master node ❒ control token passed from
one node to next ❍ Channel Partitioning, by time, frequency or code
“invites” slave nodes
sequentially. • Time Division, Frequency Division
to transmit in turn
token message ❍ Random partitioning (dynamic),
❒ concerns: ❒
• CSMA, CSMA/CD
❍ polling overhead ❒ concerns:
• carrier sensing: easy in some technologies (wire), hard
latency ❍ token overhead

in others (wireless)
single point of ❍ latency

• CSMA/CD used in Ethernet
failure (master) ❍ single point of failure (token)
• CSMA/CA used in 802.11
❍ Taking Turns
• polling from a central site, token passing

5: DataLink Layer 5-25 5: DataLink Layer 5-26

LAN technologies Link Layer


Data link layer so far:
❒ 5.1 Introduction and ❒ 5.6 Hubs and switches
❍ services, error detection/correction, multiple services
access
❒ 5.2 Error detection
Next: LAN technologies and correction
❍ addressing ❒ 5.3Multiple access
❍ Ethernet protocols
❍ hubs, switches ❒ 5.4 Link-Layer
Addressing
❒ 5.5 Ethernet

5: DataLink Layer 5-27 5: DataLink Layer 5-28

MAC Addresses and ARP LAN Addresses and ARP


Each adapter on LAN has unique LAN address
❒ 32-bit IP address:
❍ network-layer address
1A-2F-BB-76-09-AD Broadcast address =
❍ used to get datagram to destination IP subnet FF-FF-FF-FF-FF-FF

❒ MAC (or LAN or physical or Ethernet)


address: LAN
(wired or = adapter
❍ used to get datagram from one interface to wireless)
another physically-connected interface (same 71-65-F7-2B-08-53
58-23-D7-FA-20-B0

network)
❍ 48 bit MAC address (for most LANs)
0C-C4-11-6F-E3-98
burned in the adapter ROM

5: DataLink Layer 5-29 5: DataLink Layer 5-30

5
LAN Address (more) ARP: Address Resolution Protocol

❒ MAC address allocation administered by IEEE Question: how to determine ❒ Each IP node (Host,
MAC address of B Router) on LAN has
❒ manufacturer buys portion of MAC address space
knowing B’s IP address? ARP table
(to assure uniqueness)
❒ ARP Table: IP/MAC
❒ Analogy: [Link]
address mappings for
(a) MAC address: like Social Security Number 1A-2F-BB-76-09-AD
some LAN nodes
(b) IP address: like postal address [Link]
[Link] < IP address; MAC address; TTL>
❒ MAC flat address ➜ portability ❍ TTL (Time To Live): time
LAN after which address
❍ can move LAN card from one LAN to another
71-65-F7-2B-08-53 mapping will be forgotten
❒ IP hierarchical address NOT portable
58-23-D7-FA-20-B0
(typically 20 min)
❍ depends on IP subnet to which node is attached
0C-C4-11-6F-E3-98
[Link]

5: DataLink Layer 5-31 5: DataLink Layer 5-32

ARP protocol: Same LAN (network) Routing to another LAN


❒ A wants to send datagram walkthrough: send datagram from A to B via R
to B, and B’s MAC address ❒ A caches (saves) IP-to- assume A know’s B IP address
not in A’s ARP table. MAC address pair in its
❒ A broadcasts ARP query ARP table until information
packet, containing B's IP becomes old (times out)
address ❍ soft state: information
❍ Dest MAC address = that times out (goes
away) unless refreshed
A
FF-FF-FF-FF-FF-FF
❍ all machines on LAN ❒ ARP is “plug-and-play”:
receive ARP query ❍ nodes create their ARP
❒ B receives ARP packet, tables without R
replies to A with its (B's) intervention from net B
MAC address administrator
❍ frame sent to A’s MAC ❒ Two ARP tables in router R, one for each IP
address (unicast)
network (LAN)
5: DataLink Layer 5-33 5: DataLink Layer 5-34

❒ A creates datagram with source A, destination B


Now we can understand DHCP
❒ A uses ARP to get R’s MAC address for [Link]
❒ A creates link-layer frame with R's MAC address as dest, better
frame contains A-to-B IP datagram
❒ A’s adapter sends frame ❒ DHCP Server
❒ R’s adapter receives frame Discovery: (use IP
❒ R removes IP datagram from Ethernet frame, sees its
[Link],
destined to B encapsulate in FF-FF-
❒ R uses ARP to get B’s MAC address
FF-FF-FF-FF)
❒ R creates frame containing A-to-B IP datagram sends to B
❒ DHCP server offer (a
server responds)
❒ DHCP Request (choose
A server from which
ones that replied)
❒ DHCP ACK (server
R confirms request)
B

5: DataLink Layer 5-35 5: DataLink Layer 5-36

6
Link Layer Ethernet
“dominant” wired LAN technology:
❒ 5.1 Introduction and ❒ 5.6 Hubs and switches ❒ cheap $20 for 100Mbs!
services ❒ 5.7 PPP ❒ first widely used LAN technology
❒ 5.2 Error detection ❒ 5.8 Link Virtualization: ❒ Simpler, cheaper than token LANs and ATM
and correction ATM
❒ Kept up with speed race: 10 Mbps – 10 Gbps
❒ 5.3Multiple access
protocols
❒ 5.4 Link-Layer
Addressing Metcalfe’s Ethernet
sketch
❒ 5.5 Ethernet

5: DataLink Layer 5-37 5: DataLink Layer 5-38

Unreliable, connectionless service Ethernet uses CSMA/CD


❒ Connectionless: No handshaking between sending ❒ No slots ❒ Before attempting a
and receiving adapter. ❒ adapter doesn’t transmit retransmission,
❒ Unreliable: receiving adapter doesn’t send acks or if it senses that some adapter waits a
nacks to sending adapter other adapter is random time, that is,
❍ stream of datagrams passed to network layer can have transmitting, that is, random access
gaps carrier sense
❍ gaps will be filled if app is using TCP ❒ transmitting adapter
❍ otherwise, app will see the gaps aborts when it senses
that another adapter is
transmitting, that is,
collision detection

5: DataLink Layer 5-39 5: DataLink Layer 5-40

Ethernet CSMA/CD algorithm Ethernet’s CSMA/CD (more)


1. Adaptor receives 4. If adapter detects Jam Signal: make sure all Exponential Backoff:
datagram from net layer & another transmission while other transmitters are ❒ Goal: adapt retransmission
creates frame transmitting, aborts and aware of collision; 48 bits attempts to estimated
sends jam signal Bit time: .1 microsec for 10 current load
2. If adapter senses channel Mbps Ethernet ; heavy load: random wait
idle, it starts to transmit 5. After aborting, adapter

for K=1023, wait time is will be longer
frame. If it senses enters exponential about 50 msec ❒ first collision: choose K
channel busy, waits until backoff: after the mth from {0,1}; delay is K· 512
channel idle and then collision, adapter chooses bit transmission times
transmits a K at random from ❒ after second collision:
See/interact with Java choose K from {0,1,2,3}…
3. If adapter transmits {0,1,2,…,2m-1}. Adapter applet on AWL Web site:
waits K·512 bit times and ❒ after ten collisions, choose
entire frame without highly recommended !
K from {0,1,2,3,4,…,1023}
detecting another returns to Step 2
transmission, the adapter
is done with frame ! 5: DataLink Layer 5-41 5: DataLink Layer 5-42

7
Hubs
Hubs are essentially physical-layer repeaters:
❍ bits coming from one link go out all other links
❍ at the same rate
❍ no frame buffering
❍ no CSMA/CD at hub: adapters detect collisions
❍ provides net management functionality

twisted pair

hub

5: DataLink Layer 5-43

You might also like