17 Link Layer
17 Link Layer
CS455/CS555/EE407/EE507
Fall 2024
Pat Wilbur
[email protected]
Link (data link) layer
Internet
Standard OSI
Model Model
(a.k.a.
(a.k.a.
“TCP/IP
“TCP/IP
Model”)
model”)
Source: Wikipedia
Avian carrier (experimental)
https://datatracker.ietf.org/doc/html/rfc1149
*
Link (data link) layer
Link (data link) layer: responsible for transferring packet between
physically-adjacent nodes over a physical link (nodes attached to the same
physical medium, network switch, etc. prior to being forwarded by a router to
another (sub)network))
PDU is referred to as a frame
For wired Local Area Networks (LANs, i.e. intra-AS), the predominant set of
protocols/standards is Ethernet (Ethernet standards actually span both the
data link and physical layers, technically speaking)
Wireless LANs (i.e. intra-AS) use the IEEE 802.11 set of protocols/standards
(Mobile (cellular) networks use standards defined by 3GPP/ETSI & GSMA,
Bluetooth “personal area networks” use IEEE 802.15.1 standard, etc.)
Application Traffic Flow Example
Host A Host B
HTTP HTTP
IP IP IP IP
*
Application Traffic Flow Example
Host A Host B
HTTP HTTP
IP IP IP IP
*
Ethernet
Ethernet PDU header:
➢ Ethernet frames include a 64-bit preamble (a.k.a.
”syncword”) of alternating 1s and 0s, to allow the network hardware
receiver (adapter, etc.) to synchronize with the incoming signal
➢ Source and destination MAC addresses are each 48 bits
➢ Type field indicates to which higher-layer protocol the payload (SDU)
should be delivered
Ethernet PDU footer: Cyclic redundancy check (CRC) for error correction
Source
Ethernet adapters/adaptors
Ethernet adapters are network interfaces that physically
connect a host to an Ethernet-enabled network
Adapters add preamble and CRC during transmission
Adapters remove preamble and CRC during reception, prior to delivering the
ethernet frame to the host (hosts and their OSes don’t actually see the
preamble and CRC)
Source
“MAC” address (now “EUI-48”)
Ethernet (and some other link layer protocols) use MAC addresses for
addressing hosts/nodes at the link layer
Since link layer deals with hosts that are physically adjacent (attached to the
same physical medium, network switch, etc. prior to being forwarded by a
router to another (sub)network)), MAC addresses are also used prior to
being forwarded by a router (i.e. routing uses IP addresses)
Despite this, MAC addresses are actually globally unique hardware
identifiers (unique serial numbers), and each hardware manufacturer gets
assigned a range of MAC addresses for each network product
MAC addreses are typically represented in hexadecimal format:
AB:CD:EF:01:23:45
Source
“MAC” address (now “EUI-48”)
Source
Link (data link) protocol types
Point-to-point: Dedicated wire or medium (e.g. serial cable connection)
➢ Serial Line Internet Protocol (SLIP), mostly replaced with PPP
➢ Point-to-Point Protocol (PPP), used in, e.g., modem ↔ PC connections
➢ HD broadcast radio/TV?
Multiple access: shared wire/medium (e.g. Ethernet, wireless protocols)
*
Multiple access: art of sharing
Multiple access is fundamental to communication at scale – why?
At sufficient scale, often don’t have dedicated physical media (dedicated
wires between every node, dedicated radio frequencies for every node)
Two or more communicators must share a medium/media
Simultaneous transmissions on shared media cause interference
Multiple access algorithm: determines how a physical medium gets
shared by multiple transmitters (often via some form of time sharing)
Collision: when two or more transmitters transmit at times that overlap,
causing interference (main goal of multiple access algorithms is to prevent
collisions from occurring, and/or to recover from when they occur)
Multiple access: idealized scenario
Given a shared channel of rate R bits/second (bps)
When one only node wants to transmit, it can send at rate of R bps
When M nodes want to transmit, each can send at average rate of R/M bps
Fully decentralized:
➢ No special node to coordinate transmissions
➢ No synchronization of clocks, slots
Efficient, fair, and simple
*
Multiple access: real world types
Three broad classes:
➢ Channel partitioning: divide channel into smaller “pieces” (time slots,
frequency), allocate dedicated piece to node for exclusive use
➢ Random access: allow collisions, recover from collisions
➢ Polling-style: tightly coordinate shared access to avoid collisions
Goals: efficient, fair, simple, decentralized
*
Multiple access: real world types
Three broad classes:
➢ Channel partitioning: divide channel into smaller “pieces” (time slots,
frequency), allocate dedicated piece to node for exclusive use
➢ Random access: allow collisions, recover from collisions
➢ Polling-style: tightly coordinate shared access to avoid collisions
Goals: efficient, fair, simple, decentralized
Note: Can’t cheat physics! Given a fixed physical
medium (channel) bit rate of R, as the number of
channel-hungry nodes M increases, average
bit rate of each “slice” will get smaller!
*
Multiple access: real world types
Three broad classes:
➢ Channel partitioning: divide channel into smaller “pieces” (time slots,
frequency), allocate dedicated piece to node for exclusive use
➢ Random access: allow collisions, recover from collisions
➢ Polling-style: tightly coordinate shared access to avoid collisions
Goals: efficient, fair, simple, decentralized
Key takeaway: Random access algorithms perform better when one station
wants to use the channel heavily and channel partitioning algorithms perform
better when many stations want to use the channel heavily.
*
Channel partitioning: TDMA
TDMA: time division multiple access
Access to channel in "rounds"
Each node gets fixed-length slot (length = frame transmission time) in each
round
Unused slots are idle (wasted capacity)
Example: 6-station LAN, slots 1/3/4 have frames, slots 2/5/6 are idle
*
Channel partitioning: FDMA
FDMA: frequency division multiple access
frequency bands
Channel spectrum divided into
frequency bands
Each station assigned fixed frequency band
Unused transmission time within a frequency
band goes idle
Example: 6-node LAN, frequency
bands 1/3/4 have frame,
bands 2/5/6 idle
*
Channel partitioning: CDMA
CDMA: code division multiple access – learn more here
All users share same frequency, each user has unique “chipping” sequence
(“code”) to encode data, and more bits are used than original message
Used mostly in wireless channels
Encoded signal = (original data) X (chipping sequence)
➢ For each code there is a spreading factor G
➢ For d bits of user data, G*d bits are transmitted
Decoding: inner-product of encoded signal and chipping sequence
Allows multiple users to coexist and transmit simultaneously with minimal
interference (so long as codes are orthogonal)
*
Channel partitioning
TDMA – all channel part of time
FDMA – part of channel all the time
CDMA – use all the channel all the time, but transmit more bits spread out in
a specified arrangement (according to chipping sequence, or “code”) that
avoids interference with others
*
Channel partitioning
TDMA – all channel part of time
FDMA – part of channel all the time
CDMA – use all the channel all the time, but transmit more bits spread out in
a specified arrangement (according to chipping sequence, or “code”) that
avoids interference with others
*
Random access: slotted ALOHA
Time is divided into equal size slots (= frame transmission time), requires
synchronization between nodes
Node with new arriving frame transmits frame at beginning of next slot
If collision: retransmit frame in future slots with probability p, until successful
(success = no collision)
*
Random access: CSMA
CSMA: carrier sense multiple access (listen before transmit)
➢ If channel sensed idle: transmit entire frame
➢ If channel sensed busy, defer transmission
Persistent CSMA: retry immediately with probability p when channel
becomes idle (can cause instability)
Non-persistent CSMA: retry after random interval
CSMA/CD: adds collision detection to CSMA, used by early Ethernet
*
Partitioning vs. random access
Channel partitioning algorithms:
➢ Share channel efficiently at high load
➢ Inefficient at low load: delay in channel access, 1/N bandwidth allocated
even if only 1 active node!
Random access algorithms:
➢ Efficient at low load: single node can fully utilize channel
➢ Under high load: collision overhead
Possible compromise with polling-style algorithms to achieve best of both worlds
*
Polling-style algorithms
Take turns using the channel
Polling: control node “invites” transmitter nodes to transmit in turn
➢ Request to Send, Clear to Send control messages
➢ Concerns: polling overhead, latency, single point of failure (control node)
Token passing: control token passed from one transmitter node to next
sequentially in order to transmit in turn
➢ Token exchange message
➢ Concerns: token overhead, latency, single point of failure (token
exchange)
*
What about modern-day Ethernet?
Modern-day Ethernet often uses switched, full-duplex links for each segment
(each node ↔ node physical connection)
Full-duplex: dedicated media (i.e. wires) for each direction of each segment
Ethernet switches can buffer frames as they come in from one segment,
then schedule (similar to slotting or time sharing) frames to go out another
segment so that there won’t be a collision along common paths/segments
Modern-day Ethernet is technically only one node per channel (per segment)
*
ARP Example
arp -a
ping 8.8.8.8
arp -a
Physical layer
At the bottom, the physical layer is responsible for conveying 1s and 0s.
All physical media are technically analog, not digital! Need analog-to-digital
conversion and digital-to-analog conversion for all physical media. A
modulation/demodulation technique is used to convey 1s and 0s.
Wireless media also need a carrier wave of some sort, and encoding data
along a carrier is described as keying, using a keying algorithm/function
Source
References & attribution:
Original slides by Patrick F. Wilbur, 2024.
Other slides adapted from slides by Professor Yu Liu and Professor Jeanna Matthews.
In this file, slides marked * are heavily adapted or taken from slides by Professor Yu Liu and Professor Matthews.