1
CS 168, Spring 2025 @ UC Berkeley
Slides credit: Sylvia Ratnasamy, Rob Shakir, Peyrin Kao
Internet Design Principles
Lecture 2 (Intro 2)
Architecting the Internet
Lecture 2, CS 168, Spring 2025
Internet Design Principles
Designing Resource Sharing
Today: Internet Design Principles
Last time, we showed how the Internet was built.
Why was the Internet built this way?
Architecting the Internet
Why think about the Internet design choices?
The Internet Design Principles
The Internet Design Principles:
These are guidelines, not unbreakable rules.
The Internet Design Principles
1. Decentralized control.
2. Best-effort service model.
The Internet Design Principles
3. Route around trouble.
4. Dumb infrastructure (with smart endpoints).
5. End-to-end principle.
The Internet Design Principles
6. Layering.
7. Federation via narrow-waist interface.
Narrow Waist, Demultiplexing
Lecture 2, CS 168, Spring 2025
Internet Design Principles
Designing Resource Sharing
Protocols at Different Internet Layers
Multiple protocols exist at each layer.
Physical
Link
Internet
Layer 1:
Layer 2:
Layer 3:
Transport
Layer 4:
Application
Layer 7:
Optical
Copper Wire
Radio Waves
Telephone Line
Wi-Fi
Point-to-Point
Ethernet
FDDI
IP
TCP
UDP
SMTP
DNS
HTTP
NTP
Protocols at Different Internet Layers
Multiple protocols exist at each layer.
Physical
Link
Internet
Layer 1:
Layer 2:
Layer 3:
Transport
Layer 4:
Application
Layer 7:
Optical
Radio Waves
Telephone Line
Wi-Fi
Point-to-Point
FDDI
UDP
DNS
HTTP
NTP
Copper Wire
Ethernet
IP
TCP
SMTP
Protocols at Different Internet Layers
The narrow waist: IP (Internet Protocol) is the only protocol at Layer 3.
Physical
Link
Internet
Layer 1:
Layer 2:
Layer 3:
Transport
Layer 4:
Application
Layer 7:
Optical
Copper Wire
Radio Waves
Telephone Line
Wi-Fi
Point-to-Point
Ethernet
FDDI
IP
TCP
UDP
SMTP
DNS
HTTP
NTP
Demultiplexing
When you receive a packet, you pass it up the stack, to higher-layer protocols.
Physical
Link
Internet
Layer 1:
Layer 2:
Layer 3:
Transport
Layer 4:
Application
Layer 7:
Optical
Copper Wire
Radio Waves
Telephone Line
Wi-Fi
Point-to-Point
Ethernet
FDDI
IP
TCP
UDP
SMTP
DNS
HTTP
NTP
Which way?
Which way?
Demultiplexing at Layer 3
Demultiplexing:
IP
TCP
UDP
Which way?
From: Alice's computer
To: Bob's computer
Next layer is TCP.
Layer 4 headers
"Potato."
From: Alice's computer
To: Bob's computer
Next layer is UDP.
Layer 4 headers
"Potato."
Demultiplexing at Layer 4
Demultiplexing also works at Layer 4.
Firefox
TCP
Which way?
From: Port 587
To: Port 50000
Stop watching YouTube and answer your email.
From: Port 194
To: Port 60000
you're fired!!!
From: Port 80
To: Port 40000
Here's that YouTube video you asked for.
Slack
More specifically, each open connection on your computer.
(40000)
(50000)
(60000)
Ports at Layer 4
Port numbers help us distinguish between applications on the same computer.
Analogy: Room numbers.
From: YouTube server
To: Bob's computer
Next layer is TCP.
From: Port 80
To: Port 40000
[cat video]
Demultiplex: Which L4 protocol?
Demultiplex: Which L7 application?
Ports at Layer 4
Both end hosts in a connection have a port number.
Analogy: Room numbers.
From: Bob's computer
To: YouTube server
Next layer is TCP.
From: Port 40000
To: Port 80
give me cat video
From: YouTube server
To: Bob's computer
Next layer is TCP.
From: Port 80
To: Port 40000
[cat video]
Outgoing packet: Bob picks a random port number, but sends to YouTube's fixed port, 80.
Incoming reply: YouTube replies to Bob's chosen port. Bob's computer passes the packet to the correct application (Firefox, not Slack).
Caution – Terminology Conflict
In networking, there are two different things, both called "ports."
From: Port 80
To: Port 40000
[cat video]
Logical port: A number identifying an application. Exists in software.
Physical port: The hole you plug a cable into. Exists in hardware.
Implementing Layers in the End Host
Layers 1 and 2 are implemented in hardware, on the network interface card (NIC).
Layers 3 and 4 are implemented in software, in the operating system.
Layer 7 is the applications running in software.
Software
Operating
System
Network Interface Card (Hardware)
IP
TCP
UDP
Firefox
Zoom
Slack
Game
Layers 1–2
Layer 3
Layer 4
Layer 7
Thinks about packets.
Bridges the packet and connection abstractions.
Thinks about connections.
Implementing Layers in the End Host
Demultiplexing helps the operating system pass packets to the correct application.
Software
Operating
System
Network Interface Card (Hardware)
IP
TCP
UDP
Firefox
Zoom
Slack
Game
Layers 1–2
Layer 3
Layer 4
Layer 7
Implementing Layers in the End Host
Logical ports identify the attachment point between the application and the OS.
Software
Operating
System
Network Interface Card (Hardware)
IP
TCP
UDP
Firefox
Zoom
Slack
Game
Layers 1–2
Layer 3
Layer 4
Layer 7
End-to-End Principle
Lecture 2, CS 168, Spring 2025
Internet Design Principles
Designing Resource Sharing
The End-to-End Question
Recall: Layer 3 (Internet) is best-effort.
Why did we choose this design?
Should we implement reliability in the network?
The end-to-end principle will help us answer these questions.
Running Example – Simple Reliability Protocol
We haven't discussed Layer 4 protocols yet, so let's use a super-simple protocol.
R1
A
R2
R3
B
Sender
Recipient
Router
Router
Router
Solution 1 – Reliability in the Network
Solution 1 – Reliability in the network:
Bob trusts whatever the last packet says. He doesn't count the packets himself.
R1
A
R2
R3
B
Sender
Recipient
Router
Router
Router
Got all 10 packets!
Missed a packet. Fail.
Fail.
Fail.
Solution 1 – Reliability in the Network
Surprising fact: Solution 1 cannot guarantee correctness.
R1
A
R2
R3
B
Sender
Recipient
Router
Router
Router
Got all 10 packets!
Got all 10 packets!
Got all 10 packets!
R3 is buggy! It actually only got 9 packets.
Success!
Solution 2 – Reliability at End Hosts
Solution 2 – Reliability at end hosts:
R1
A
R2
R3
B
Sender
Recipient
Router
Router
Router
Got all 10 packets!
Which Solution is Better?
Solution 1 (only routers check) cannot be made correct.
Solution 2 (only end hosts check) can be correct by itself.
Solution 2 is strictly better!
End-to-end principle: Certain application features (e.g. reliability) must be implemented at the end host for correctness.
End-to-End Principle – Philosophy
Problem with Solution 1: The end host (Bob) had to trust the network for correctness.
In Solution 2, Bob only had to rely on himself for correctness.
Breaking the End-to-End Principle for Performance
The end-to-end principle is not an unbreakable rule.
Example: Links are very lossy.
10 links, 10% failure rate per link = ~65% end-to-end failure rate.
If each link sends 2 copies of every packet:�0.1% failure rate per link, ~1% end-to-end failure rate.
Sender
Recipient
Brief History of the End-to-End Principle
David D. Clark was the chief protocol architect for the Internet in the 1980s.
"The function in question can completely and correctly be implemented only with the knowledge and help of the application at the end points.
Therefore, providing that function as a feature of the communication system itself is not possible.
Sometimes an incomplete version of the function provided by the communication system may be useful as a performance enhancement."
Designing Resource Sharing: Statistical Multiplexing
Lecture 2, CS 168, Spring 2025
Internet Design Principles
Designing Resource Sharing
Sharing Network Resources
The network must support many simultaneous flows.
R1
A
R2
B
C
D
A and B want to exchange data.
C and D also want to exchange data.
They all have to share routers and links.
Sharing Network Resources
Two ways to allocate resources to users:
Network resources are statistically multiplexed.
Time
Time
Resources
Resources
Static Allocation
Statistical Multiplexing
Statistical Multiplexing is More Efficient
Statistical multiplexing (dynamic) is more efficient than static allocation (fixed).
Example:
In summary: peak of aggregate demand < aggregate of peak demands.
Statistical Multiplexing is More Efficient
In summary: peak of aggregate demand < aggregate of peak demands.
Time
Demand
Alice's demand
Bob's demand
Combined demand
Peak of aggregate
Time
Demand
Aggregate of peak
A's peak
B's peak
+
=
Statistical Multiplexing is More Efficient
In summary: peak of aggregate demand < aggregate of peak demands.
max(Σ fi) < Σ max(fi)
In practice, peak of aggregate is usually closer to the average of peak demands.
Peak of aggregate
Aggregate of peak
Time
Demand
Time
Demand
Circuit Switching vs.�Packet Switching
Lecture 2, CS 168, Spring 2025
Internet Design Principles
Designing Resource Sharing
Circuit Switching vs. Packet Switching
There are 2 canonical designs for implementing statistical multiplexing:
Analogy: In a restaurant, reservations vs. first-come, first-serve.
Circuit Switching
Reservations via circuit switching: Reserve capacity for the connection.
R5
R6
B
I need�5 Mbps
I need�5 Mbps
I need�5 Mbps
I need�5 Mbps
A
R1
R3
I need�5 Mbps
R2
R4
Circuit Switching
Reservations via circuit switching: Reserve capacity for the connection.
R5
R6
Done!
Done!
Done!
Done!
R1
A
R2
R4
R3
B
Done!
Packet Switching
Best-effort via packet switching: Allocate resources to each packet independently.
R1
A
R2
R5
R6
R4
R3
B
Potato
Potato
Potato
Potato
Potato
Potato
Circuit Switching vs. Packet Switching
Remember: Both approaches embody statistical multiplexing.
Packet Switching
Circuit Switching
Static Allocation
Statistical Multiplexing
Sharing Resources
Circuit vs. Packet Switching:�Which is Better?
Lecture 2, CS 168, Spring 2025
Internet Design Principles
Designing Resource Sharing
Circuit Switching vs. Packet Switching: Which is Better?
Which is better? We can compare along several dimensions.
Which is Better? (1/4) – Application Abstraction
As a programmer, circuit switching is more convenient.
Which is Better? (2/4) – Efficiency
Packet switching is typically more efficient.
Which is Better? (2/4) – Efficiency – Packet Burstiness
Circuit switching with bursty traffic leads to inefficient resource allocation.
Capacity = 30
A reserves 13.
B reserves 11.
Not enough for C!
Circuit switching:�Must reject one of the flows!
Packet switching:�All demands satisfied!
B's Demand
11
C's Demand
12
A's Demand
13
Time
Demand
Capacity = 30
Which is Better? (2/4) – Efficiency – Packet Burstiness
If demand over time is constant, circuit and packet switching both work well.
Capacity = 30
A reserves 10.
B reserves 10.
C reserves 10.
Circuit switching:�All demands satisfied!
Capacity = 30
Packet switching:�All demands satisfied!
B's Demand
10
C's Demand
10
A's Demand
10
Time
Demand
Which is Better? (2/4) – Efficiency – Packet Burstiness
Flows can be smooth or bursty.
Which is Better? (3/4) – Handling Failure
What happens if a link or router fails?
Packet switching is better at handling failure.
Circuit switching requires extra work from end hosts.
Which is Better? (3/4) – Handling Failure with Packet Switching
If a failure occurs in packet switching:
R1
A
R2
R5
R6
R4
R3
B
Potato
Potato
Potato
Potato
Potato
Potato
Which is Better? (3/4) – Handling Failure with Packet Switching
If a failure occurs in packet switching:
R1
A
R2
R5
R6
R4
R3
B
Banana
Banana
Banana
Banana
Banana
Banana
Router goes down!
Which is Better? (3/4) – Handling Failure with Circuit Switching
If a failure occurs in circuit switching:
R5
R6
R3
Router goes down!
Reserved
Reserved
Reserved
Reserved
R1
A
R2
R4
B
R3
Which is Better? (3/4) – Handling Failure with Circuit Switching
If a failure occurs in circuit switching:
R2
R3
Router goes down!
R1
A
R5
R6
R4
B
I need 5
I need 5
I need 5
I need 5
I need 5
Which is Better? (4/4) – Implementation Complexity
Packet switching is easier to implement.
Circuit switching implementation questions:
Which is Better? (4/4) – Implementation Complexity in Circuit Switching
Circuit switching implementation question:
How does R4 know if the previous routers accepted or rejected the packet?
R5
R6
B
I need�5 Mbps
I need�5 Mbps
I need�5 Mbps
I need�5 Mbps
A
R1
R3
I need�5 Mbps
R2
R4
Which is Better? (4/4) – Implementation Complexity in Circuit Switching
Circuit switching implementation question:
What if the teardown packet gets dropped? Doesn't reach R3 and R4.
R5
R6
Done!
Done!
Done!
Done!
R1
A
R2
R4
R3
B
Dropped!
R3 and R4 haven't torn down the circuit!
Circuit Switching vs. Packet Switching: Which is Better?
Circuit switching pros:
Packet switching pros:
Circuit vs. Packet Switching:�A Brief History
Lecture 2, CS 168, Spring 2025
Internet Design Principles
Designing Resource Sharing
Circuit vs. Packet Switching in Practice
Packet switching is the default in the modern Internet.
Circuit switching used in limited settings.
Circuit vs. Packet Switching – A Brief History
Early Internet (1970s, 1980s) used packet switching.
Next iteration (late 1980s, 1990s) tried to move toward circuit switching.
Spent 10+ years trying to realize the vision of circuit switching, but ultimately failed.
Summary: Internet Design Principles
Software
Operating
System
Network Interface Card (Hardware)
IP
TCP
UDP
Firefox
Zoom
Slack
Game
Layers 1–2
Layer 3
Layer 4
Layer 7
From: YouTube server
To: Bob's computer
Next layer is TCP.
From: Port 80
To: Port 40000
[cat video]
Demultiplex: Which L4 protocol?
Demultiplex: Which L7 application?
Summary: Designing Resource Sharing
Peak of aggregate
Aggregate of peak
Time
Demand
Time
Demand
Statistical Multiplexing
Static Allocation
Packet Switching
Circuit Switching
Static Allocation
Statistical Multiplexing
Sharing Resources