Chapter 5
Link Layer
Computer
Networking: A Top
Down Approach
6th edition
Jim Kurose, Keith Ross
Addison-Wesley
March 2012
Link Layer 5-1
Chapter 5: Link layer
our goals:
understand principles behind link layer
services:
error detection, correction
sharing a broadcast channel: multiple access
link layer addressing
local area networks: Ethernet, VLANs
instantiation, implementation of various link
layer technologies
Link Layer 5-2
Link layer, LANs: outline
5.1 introduction, services 5.5 link virtualization:
5.2 error detection, MPLS
correction 5.6 data center
5.3 multiple access networking
protocols 5.7 a day in the life of a
5.4 LANs web request
addressing, ARP
Ethernet
switches
VLANS
Link Layer 5-3
Link layer: introduction
terminology:
hosts and routers: nodes
communication channels that global ISP
connect adjacent nodes along
communication path: links
wired links
wireless links
LANs
layer-2 packet: frame,
encapsulates datagram
data-link layer has responsibility of
transferring datagram from one node
to physically adjacent node over a link
Link Layer 5-4
Link layer: context
datagram transferred by transportation analogy:
different link protocols over trip from Princeton to Lausanne
different links: limo: Princeton to JFK
e.g., Ethernet on first link, plane: JFK to Geneva
frame relay on train: Geneva to Lausanne
intermediate links, 802.11 tourist = datagram
on last link transport segment =
each link protocol provides communication link
different services transportation mode = link
e.g., may or may not layer protocol
provide rdt over link travel agent = routing
algorithm
Link Layer 5-5
Link layer services
framing, link access:
encapsulate datagram into frame, adding header, trailer
channel access if shared medium
“MAC” addresses used in frame headers to identify
source, dest
• different from IP address!
reliable delivery between adjacent nodes
we learned how to do this already (chapter 3)!
seldom used on low bit-error link (fiber, some twisted
pair)
wireless links: high error rates
• Q: why both link-level and end-end reliability?
Link Layer 5-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
half-duplex and full-duplex
with half duplex, nodes at both ends of link can transmit, but not
at same time
Link Layer 5-7
Where is the link layer implemented?
in each and every host
link layer implemented in
“adaptor” (aka network
interface card NIC) or on a
chip application
Ethernet card, 802.11 transport
network cpu memory
card; Ethernet chipset link
implements link, physical host
layer controller
bus
(e.g., PCI)
attaches into host’s system
link
physical
buses
physical
transmission
combination of hardware,
software, firmware network adapter
card
Link Layer 5-8
Adaptors communicating
datagram datagram
controller controller
sending host receiving host
datagram
frame
sending side: receiving side
encapsulates datagram in looks for errors, rdt,
frame flow control, etc
adds error checking bits, extracts datagram, passes
rdt, flow control, etc. to upper layer at
receiving side
Link Layer 5-9
Link layer, LANs: outline
5.1 introduction, services 5.5 link virtualization:
5.2 error detection, MPLS
correction 5.6 data center
5.3 multiple access networking
protocols 5.7 a day in the life of a
5.4 LANs web request
addressing, ARP
Ethernet
switches
VLANS
Link Layer 5-10
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
otherwise
Link Layer 5-11
Parity checking
single bit parity: two-dimensional bit parity:
detect single bit detect and correct single bit errors
errors
0 0
Link Layer 5-12
Internet checksum (review)
goal: detect “errors” (e.g., flipped bits) in transmitted packet
(note: used at transport layer only)
sender: receiver:
treat segment contents compute checksum of
as sequence of 16-bit received segment
integers check if computed
checksum: addition (1’s checksum equals checksum
complement sum) of field value:
segment contents NO - error detected
sender puts checksum YES - no error detected.
value into UDP But maybe errors
checksum field nonetheless?
Link Layer 5-13
Cyclic redundancy check
more powerful error-detection coding
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 (Ethernet, 802.11 WiFi, ATM)
Link Layer 5-14
Link layer, LANs: outline
5.1 introduction, services 5.5 link virtualization:
5.2 error detection, MPLS
correction 5.6 data center
5.3 multiple access networking
protocols 5.7 a day in the life of a
5.4 LANs web request
addressing, ARP
Ethernet
switches
VLANS
Link Layer 5-15
MAC addresses and ARP
32-bit IP address:
network-layer address for interface
used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address:
function: used ‘locally” to get frame from one interface to
another physically-connected interface (same network, in IP-
addressing sense)
48 bit MAC address (for most LANs) burned in NIC
ROM, also sometimes software settable
e.g.: 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation
(each “number” represents 4 bits)
Link Layer 5-16
LAN addresses and ARP
each adapter on LAN has unique LAN address
1A-2F-BB-76-09-AD
LAN
(wired or adapter
wireless)
71-65-F7-2B-08-53
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
Link Layer 5-17
LAN addresses (more)
MAC address allocation administered by IEEE
manufacturer buys portion of MAC address space
(to assure uniqueness)
analogy:
MAC address: like Social Security Number
IP address: like postal address
MAC flat address ➜ portability
can move LAN card from one LAN to another
IP hierarchical address not portable
address depends on IP subnet to which node is
attached
Link Layer 5-18
ARP: address resolution protocol
Question: how to determine
interface’s MAC address,
knowing its IP address? ARP table: each IP node (host,
router) on LAN has table
137.196.7.78
IP/MAC address
mappings for some LAN
1A-2F-BB-76-09-AD
nodes:
137.196.7.23
137.196.7.14 < IP address; MAC address; TTL>
TTL (Time To Live):
LAN time after which address
71-65-F7-2B-08-53 mapping will be
forgotten (typically 20
58-23-D7-FA-20-B0
min)
0C-C4-11-6F-E3-98
137.196.7.88
Link Layer 5-19