0% found this document useful (0 votes)
7 views33 pages

17 Link Layer

The document provides an overview of the Link Layer in computer networks, detailing its role in transferring packets between adjacent nodes and the various protocols used, such as Ethernet and IEEE 802.11. It discusses multiple access methods for sharing communication channels, including channel partitioning and random access algorithms, and highlights the importance of MAC addresses in addressing at the link layer. Additionally, it covers the Address Resolution Protocol (ARP) for mapping IP addresses to MAC addresses and touches on the physical layer's function in conveying data.

Uploaded by

Hemanth Sumny
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)
7 views33 pages

17 Link Layer

The document provides an overview of the Link Layer in computer networks, detailing its role in transferring packets between adjacent nodes and the various protocols used, such as Ethernet and IEEE 802.11. It discusses multiple access methods for sharing communication channels, including channel partitioning and random access algorithms, and highlights the importance of MAC addresses in addressing at the link layer. Additionally, it covers the Address Resolution Protocol (ARP) for mapping IP addresses to MAC addresses and touches on the physical layer's function in conveying data.

Uploaded by

Hemanth Sumny
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
You are on page 1/ 33

Computer Networks:

Intro to the 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

TCP Router 1 Router 2 TCP

IP IP IP IP

link link link link link


link

*
Application Traffic Flow Example
Host A Host B

HTTP HTTP

TCP Router 1 Router 2 TCP

IP IP IP IP

link link link link link


link

*
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

Round 1 Round 2 ...

*
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

All require lots of coordination about who transmits when…

What if didn’t want to have to have a dedicated coordination function to


coordinate things so tightly?
*
Random access

When node has packet to send:
➢ Transmit at full channel data rate R
➢ No prior coordination among nodes

Random access algorithms specify:
➢ How to detect collisions
➢ How to recover from collisions (e.g., via delayed retransmissions)

Examples of random access algorithms: ALOHA, slotted ALOHA, CSMA,
and CSMA/CD

*
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)

Success (S), Collision (C), Empty (E) slots


*
Random access: unslotted ALOHA

Unslotted ALOHA: simpler, no synchronization of time/slots between nodes

Frame needs transmission: send without awaiting for beginning of a slot

Collision probability increases:
frame sent at t0 collides with other frames sent in [t0-1, t0+1]

*
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)

Note: Although modern-day Ethernet links do not use multiple access


algorithms, wireless links frequently do use multiple access algorithms!
IP routing meets link (data link) layer

Recall: IP routing (network/Internet layer)
➢ Hosts can either communicate with each other directly as neighbors (e.g. point-to-point link,
both sitting on the same Ethernet switch, etc.), or
➢ Hosts can each exist on different (sub)networks and therefore need their traffic routed
through one or more routers in order to communicate

How do we route data from one (non-passive) node to the (non-passive) node that is the next
hop (next hop = either the destination host if on final destination (sub)network, or the next
router) and set the appropriate MAC address at the link (data link) layer?
➢ IP addresses are used to address to the source/destination host OSes
➢ MAC addresses are used to address the last/next hops (host or router)
➢ When next hop is a router, frame’s destination MAC address will be the router’s MAC addr
➢ IPv4 uses ARP (IPv6 uses NDP) protocol to resolve next MAC address given an IP address
Address Resolution Protocol (ARP)

A knows B's IP address, wants to learn Layer 2 (MAC) address of B
➢ A broadcasts ARP query, containing B's IP address
➢ Special broadcast address FF:FF:FF:FF:FF:FF
➢ All machines on LAN receive ARP query

B receives ARP packet, replies to A with its (B's) MAC address

A caches (saves) IP-to-physical address pairs until information becomes old (times out
according to TTL)
ARP is unauthenticated with no integrity checking, so it can be spoofed by an attacker that wants to
trick network into routing packets via the attacker’s own host!
IPv6’s Neighbor Discovery Protocol (analogous to ARP) has been extended with a secure version to
reduce the risk of spoofing (although there are some concerns with its cryptographic robustness).

*
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.

Other references are depicted on individual slides themselves.

You might also like