1
CS 168, Summer 2025 @ UC Berkeley
Slides credit: Sylvia Ratnasamy, Rob Shakir, Peyrin Kao, Murphy McCauley
Discussion, Ethernet 🔗
Connecting Local Hosts
Ethernet
Connecting Local Hosts
So far, we've assumed that every link connects exactly two machines:
R1
A
B
In reality, a single wire can connect multiple computers:
R1
A
B
A
B
C
Connecting Local Hosts
How could we connect hosts in a local network?
A
B
D
E
C
A
B
C
D
E
Mesh: Link between every pair of machines.
Bus: A single wire for all machines.
Shared Media
Shared media: Many machines using the same wire.
Note: Shared media is not necessarily a wire.
A
B
C
D
E
Blah blah
Blah blah
??!
??!
??!
Multiple Access Protocols
Ethernet
Multiple Access Protocols
A multiple access protocol allocates the shared media to everyone wanting to use it.
CSMA/CD
CSMA
ALOHA
Tokens
Polling
Multiplexing
Taking Turns
Random Access
Multiple Access Protocols
Frequency
Time
Multiple Access Protocols (1/3) – Multiplexing
Idea: Allocate a fixed slice of resources to each node.
Problem: Can be wasteful.
CSMA/CD
CSMA
ALOHA
Tokens
Polling
Multiplexing
Taking Turns
Random Access
Multiple Access Protocols
Frequency
Time
Multiple Access Protocols (2/3) – Taking Turns
Idea: Nodes take turns speaking.
CSMA/CD
CSMA
ALOHA
Tokens
Polling
Multiplexing
Taking Turns
Random Access
Multiple Access Protocols
Frequency
Time
Multiple Access Protocols (3/3) – Random Access
Idea: Nodes talk whenever they have something to say.
CSMA/CD
CSMA
ALOHA
Tokens
Polling
Multiplexing
Taking Turns
Random Access
Multiple Access Protocols
Frequency
Time
Multiple Access Protocols (3/3) – Random Access – ALOHA (Additive Links On-line Hawaii Area)
ALOHA random access scheme: "rude" version.
CSMA/CD
CSMA
ALOHA
Tokens
Polling
Multiplexing
Taking Turns
Random Access
Multiple Access Protocols
Frequency
Time
Multiple Access Protocols (3/3) – Random Access – CSMA
CSMA (Carrier Sense Multiple Access): "polite" version.
CSMA/CD
CSMA
ALOHA
Tokens
Polling
Multiplexing
Taking Turns
Random Access
Multiple Access Protocols
Frequency
Time
Multiple Access Protocols (3/3) – Random Access – CSMA and Propagation Delay
CSMA does not necessarily avoid collisions, because of propagation delay.
A
B
C
D
time
space
Multiple Access Protocols (3/3) – Random Access – CSMA/CD
CSMA/CD (Carrier Sense Multiple Access with Collision Detection):
CSMA/CD uses binary exponential backoff:
CSMA/CD
CSMA
ALOHA
Tokens
Polling
Multiplexing
Taking Turns
Random Access
Multiple Access Protocols
Frequency
Time
Sending Ethernet Packets
Ethernet
Ethernet as LAN Network Protocol
Local Area Networks (LANs) are generally Ethernet.
Machines in the same LAN can exchange messages directly at Layer 2!
Ethernet Addressing
At layer 2, each machine has a MAC address (Media Access Control).
00
0111111111111101000011
110101000110110001101000
2 bits of flags
22-bit manufacturer ID
24-bit�machine ID
Types of LAN Communication
Ethernet supports three types of communication:
Types of LAN Communication (1/3) – Unicast
Unicast: Send a packet to a single recipient.
Recall: On a shared medium, everybody gets the signal.
Types of LAN Communication (2/3) – Broadcast
Broadcast: Send a packet to everyone on the local network.
Types of LAN Communication (3/3) – Multicast
Multicast: Send a packet to everyone in a specific group.
10
0111111111111101000011
110101000110110001101000
If this bit is 1, it's a group address.
Ethernet Packet Structure
A data packet in Ethernet is often called a frame.
Preamble (7)
SFD (1)
Destination MAC (6)
Source�MAC (6)
Type (2)
Payload
FCS (4)
IPG (12)
Signal start of new packet on wire
Destination
Demultiplex�(is payload IPv4 or IPv6?)
Source
Signal end of packet on wire
Checksum
Layer 2 Networks
Ethernet
Layer 2 Networks
We could use more than one wire in a local network.
Switches need to forward packets toward their destination.
S2
S1
A
S3
S3
B
C
D
Layer 2 Networks
Routing protocols from Layer 3 can also be used at Layer 2.
Problem: MAC addresses can't be aggregated.
S2
S1
A
S3
S3
B
C
D
S2's Table | |
Destination | Next Hop |
A | R1 |
B | R3 |
C | R3 |
D | R4 |