Announcements
• Prelim and submission for 3rd CS 415 project
• Homework 4 graded
1
The Link Layer
What is purpose of this layer?
• Physically encode bits on the wire
• Link = pipe to send information
– E.g. point to point or broadcast
• Can be built out of:
– Twisted pair, coaxial cable, optical fiber, radio waves, etc
• Links should only be able to send data
– Could corrupt, lose, reorder, duplicate, (fail in other ways)
3
How to connect routers/machines?
• WAN/Router Connections
– Commercial:
•
•
•
•
•
T1 (1.5 Mbps), T3 (44 Mbps)
OC1 (51 Mbps), OC3 (155 Mbps)
ISDN (64 Kbps)
Frame Relay (1-100 Mbps, usually 1.5 Mbps)
ATM (some Gbps)
– To your home:
• DSL
• Cable
• Local Area:
– Ethernet: IEEE 802.3 (10 Mbps, 100 Mbps, 1 Gbps)
– Wireless: IEEE 802.11 b/g/a (11 Mbps, 22 Mbps, 54 Mbps)
4
Link level Issues
•
•
•
•
Encoding: map bits to analog signals
Framing: Group bits into frames (packets)
Arbitration: multiple senders, one resource
Addressing: multiple receivers, one wire
5
Encoding
• Map 1s and 0s to electric signals
• Simple scheme: Non-Return to Zero (NRZ)
– 0 = low voltage, 1 = high voltage
1
0
1
1
0
• Problems:
– How to tell an error? When jammed? When is bus idle?
– When to sample? Clock recovery is difficult.
• Idea: Recover clock using encoding transitions
6
Manchester Encoding
• Used by Ethernet
• Idea: Map 0 to low-to-high transition, 1 to high-to-low
0
1
1
0
• Plusses: can detect dead-link, can recover clock
• Bad: reduce bandwidth, i.e. bit rate = ½ baud rate
– If wire can do X transition per second?
7
Framing
• Why send packets?
– Error control
• How do you know when to stop reading?
– Sentinel approach: send start and end sequence
– For example, if sentinel is 11111
– 11111 00101001111100 11111 10101001 11111 010011 11111
– What if sentinel appears in the data?
• map sentinel to something else, receiver maps it back
– Bit stuffing
8
Example: HDLC
• Same sentinel for begin and end: 0111 1110
• packet format:
0111 1110
header
data
CRC
0111 1110
• Bit stuffing
– Sender: If 5 1s then insert a 0
0111 1110
0111 1101 0
– Receiver: if 5 1s followed by a 0, remove 0
0111 1101 0
0111 1110
• Else read next bit
• Packet size now depends on the contents
9
Arbitration
• One medium, multiple senders
– What did we do for CPU, memory, readers/writers?
– New Problem: No centralized control
• Approaches
– TDMA: Time Division Multiple Access
• Divide time into slots, round robin among senders
• If you exceed the capacity do not admit more (busy signal)
– FDMA: Frequency Division Multiple Access (AMPS)
• Divide spectrum into channels, give each sender a channel
• If no more channels available, give a busy signal
– Good for continuous streams: fixed delay, constant data rate
– Bad for bursty Internet traffic: idle slots
10
Ethernet
• Developed in 1976, Metcalfe and Boggs at Xerox
• Uses CSMA/CD:
– Carrier Sense Multiple Access with Collision Detection
• Easy way to connect LANs
Metcalfe’s Ethernet sketch
11
CSMA/CD
• Carrier Sense:
– Listen before you speak
• Multiple Access:
– Multiple hosts can access the network
• Collision Detection:
– Can make out if someone else started speaking
Older Ethernet Frame
12
CSMA
Wait
until
carrier
free
13
CSMA/CA
Garbled signals
If the sender detects a collision, it will stop and then retry!
What is the problem?
14
CSMA/CD
Packet?
No
Sense
Carrier
Send
Detect
Collision
Yes
Discard
Packet
attempts < 16
Jam channel
b=CalcBackoff();
wait(b);
attempts++;
attempts == 16
15
Ethernet’s CSMA/CD (more)
Jam Signal: make sure all other transmitters are aware of
collision; 48 bits;
Exponential Backoff:
• Goal: adapt retransmission attempts to estimated current
load
– heavy load: random wait will be longer
• first collision: choose K from {0,1}; delay is K x 512 bit
transmission times
• after second collision: choose K from {0,1,2,3}…
• after ten or more collisions, choose K from
{0,1,2,3,4,…,1023}
16
Packet Size
If packets are too small, the collision goes unnoticed
Limit packet size
Limit network diameter
Use CRC to check frame integrity
truncated packets are filtered out
17
Ethernet Problems
• What if there is a malicious user?
– Might not use exponential backoff
– Might listen promiscuously to packets
• Integrating Fast and Gigabit Ethernet
18
Addressing & ARP
128.84.96.89
128.84.96.90
128.84.96.91
“What is the physical
address of the host
named 128.84.96.89”
“I’m at 1a:34:2c:9a:de:cc”
• ARP is used to discover physical addresses
• ARP = Address Resolution Protocol
19
Addressing & RARP
???
128.84.96.90
RARP Server
128.84.96.91
“I just got here. My
physical address is
1a:34:2c:9a:de:cc.
What’s my name ?”
“Your name is
128.84.96.89”
• RARP is used to discover virtual addresses
• RARP = Reverse Address Resolution Protocol
20
Repeaters and Bridges
• Both connect LAN segments
• Usually do not originate data
• Repeaters (Hubs): physical layer devices
– forward packets on all LAN segments
– Useful for increasing range
– Increases contention
• Bridges: link layer devices
– Forward packets only if meant on that segment
– Isolates congestion
– More expensive
21
Backbone Bridge
22
© Copyright 2026 Paperzz