COS 461: Computer Networks: Jennifer Rexford
COS 461: Computer Networks: Jennifer Rexford
Jennifer Rexford
Princeton University
1
Goals for Today’s Class
• COS 461 overview
– Goals of the course
– Structure of the course
– Learning the material
– Programming assignments
– Course grading
– Academic policies
• Looking underneath IP
– Link technologies (Ethernet, wireless, …)
4
Structure of the Course (2nd Half)
• And how to get the traffic from here to there
– Internet routing architecture (the “inter” in Internet)
– Intradomain and interdomain routing protocols
• Building applications
– Web and content-distribution networks
– E-mail
– Peer-to-peer file sharing
– Multimedia streaming and voice-over-IP
8
Key Concepts in Networking
• Protocols
– Speaking the same language
– Syntax and semantics
• Layering
– Standing on the shoulders of giants
– A key to managing complexity
• Resource allocation
– Dividing scare resources among competing parties
– Memory, link bandwidth, wireless spectrum, paths, …
– Distributed vs. centralized algorithms
• Naming
– What to call computers, services, protocols, …
9
Protocols: Calendar Service
• Making an appointment with your advisor
Please
Pleasemeet with me for
Please meet
meet with
with me
me for
for
1.5
1.5hours starting at
1.5 hours
hours starting
starting atat
1:30pm
3:00pmon February 8, 2006?
4:30pm on
on February
February 8,
8, 2006?
2006?
I can’t.
I can’t.
Yes!
11
Well, Not Quite Enough
• Student #1: When can you meet for 1.5 hours during the
next two weeks?
• Advisor: 10:30am on Feb 8 and 1:15pm on Feb 9.
• Student #2: When can you meet for 1.5 hours during the
next two weeks?
• Advisor: 10:30am on Feb 8 and 1:15pm on Feb 9.
• Student #1: Book me for 1.5 hours at 10:30am on Feb 8.
• Advisor: Yes.
• Student #2: Book me for 1.5 hours at 10:30am on Feb 8.
• Advisor: Uh… well… I can no longer can meet then. I’m
free at 1:15pm on Feb 9.
• Student #2: Book me for 1.5 hours at 1:15pm on Feb 9.
• Advisor: Yes. 12
Specifying the Details
• How to identify yourself?
– Name? Social security number?
• How to represent dates and time?
– Time, day, month, year? In what time zone?
– Number of seconds since Jan 1, 1970?
• What granularities of times to use?
– Any possible start time and meeting duration?
– Multiples of five minutes?
• How to represent the messages?
– Strings? Record with name, start time, and duration?
• What do you do if you don’t get a response?
– Ask again? Reply again? 13
Example: HyperText Transfer Protocol
HTTP/1.1 200 OK
Date: Mon, 6 Feb 2006 13:09:03 GMT
Server: Netscape-Enterprise/3.5.1
Last-Modified: Mon, 6 Feb 2006 11:12:23 GMT
Response Content-Length: 21
CRLF
Site under construction
14
Example: IP Packet
4-bit
4-bit Header 8-bit Type of 16-bit Total Length (Bytes)
Version Length Service (TOS)
3-bit
16-bit Identification 13-bit Fragment Offset
Flags
Payload
15
IP: Best-Effort Packet Delivery
• Packet switching
– Send data in packets
– Header with source & destination address
• Best-effort delivery
– Packets may be lost
– Packets may be corrupted
– Packets may be delivered out of order
source destination
IP network
16
Example: Transmission Control Protocol
• Communication service (socket)
– Ordered, reliable byte stream
– Simultaneous transmission in both directions
Application
Application-to-application channels
Host-to-host connectivity
Link hardware
19
IP Suite: End Hosts vs. Routers
host host
HTTP message
HTTP HTTP
TCP segment
TCP TCP
router router
20
The Internet Protocol Suite
Waist
IP
Data Link
NET1 NET2 … NETn
Physical
User A User B
Get index.html
Connection ID
Source/Destination
Link Address
22
What if the Data Doesn’t Fit?
Problem: Packet size
GET index.html
23
Protocol Demultiplexing
• Multiple choices at each layer
TCP UDP
Network IP TCP/UDP
IP
Type Protocol Port
Field Field Number
NET1 NET2 … NETn
24
Demultiplexing: Port Numbers
• Differentiate between multiple transfers
– Knowing source and destination host is not enough
– Need an id for each transfer between the hosts
HTTP transfers
FTP transfer
25
Is Layering Harmful?
• Layer N may duplicate lower level functionality
– E.g., error recovery to retransmit lost data
• Layers may need same information
– E.g., timestamps, maximum transmission unit size
• Strict adherence to layering may hurt performance
– E.g., hiding details about what is really going on
• Some layers are not always cleanly separated
– Inter-layer dependencies for performance reasons
– Some dependencies in standards (header checksums)
• Headers start to get really big
– Sometimes more header bytes than actual content
26
Resource Allocation: Queues
GET index.html
Internet
GET index.html
GET index.html
Internet
GET index.html
28
What if the Data is Out of Order?
Problem: Out of Order
GET x.htindeml
GET index.html
29
Resource Allocation: Congestion Control
30
Transmission Control Protocol
• Flow control: window-based
– Sender limits number of outstanding bytes (window size)
– Receiver window ensures data does not overflow receiver
• Congestion control: adapting to packet losses
– Congestion window tries to avoid overloading the network (increase
with successful delivery, decrease with loss)
– TCP connection starts with small initial congestion window
congestion window
congestion avoidance
slow start
time
31
Naming: Domain Name System (DNS)
• Properties of DNS
– Hierarchical name space divided into zones
– Translation of names to/from IP addresses
– Distributed over a collection of DNS servers
• Client application
– Extract server name (e.g., from the URL)
– Invoke system call to trigger DNS resolver code
E.g., gethostbyname() on “www.cs.princeton.edu”
• Server application
– Extract client IP address from socket
– Optionally invoke system call to translate into name
E.g., gethostbyaddr() on “12.34.158.5”
32
Domain Name System
unnamed root
foo my usr 34
my.east.bar.edu usr.cam.ac.uk
56
33
12.34.56.0/24
DNS Resolver and Local DNS Server
Root server
3
4
Application DNS cache
5
Top-level
DNS query
1 10 Local DNS 6 domain server
2
server
DNS resolver 7
DNS response 9
8
Second-level
domain server
35