Professional Documents
Culture Documents
Switch
Networking II
Router
Internet
CS162
Operating Systems and
Systems Programming
Lecture 22
11/17/10
Lec 22.2
Networking
Routing
DNS
Routing
TCP/IP Protocols
11/17/10
Lec 22.3
Lec 22.4
Address Ranges in IP V4
IP address space divided into prefix-delimited ranges:
Class A: NN.0.0.0/8
Class B: NN.MM.0.0/16
subnet1
Router
Class C: NN.MM.LL.0/24
Transcontinental
Link
Router
subnet2
Other
subnets
Router
subnet3
11/17/10
Lec 22.5
Lec 22.6
Routing
Routing: the process of forwarding packets hop-by-hop
through routers to reach their destination
Need more than just a destination address!
Need a path
11/17/10
Lec 22.7
11/17/10
Lec 22.8
Name
In reality:
11/17/10
berkeley.edu
128.32.61.103
com
MIT
berkeley
11/17/10
Lec 22.10
Mit.edu
eecs.berkeley.edu
www
Is DNS Secure?
Top-level
www
calmail
eecs
Address
edu
169.229.131.81
Lec 22.11
11/17/10
Lec 22.12
Administrivia
Performance Considerations
Before we continue, need some performance metrics
Final Exam
Router
LW1
Lw3
Lec 22.13
11/17/10
NFS
Transport
RPC
Physical/Link
Lec 22.15
11/17/10
WWW
UDP
Network
Lec 22.14
Network Protocols
Protocol: Agreement between two parties as to how
information is to be transmitted
LR2
Sample Computations
E.g.: Ethernet within Soda
11/17/10
LW2
LR1
Contributions to Latency
11/17/10
Router
ssh
TCP
IP
Ethernet
ATM
Packet radio
Lec 22.16
Network Layering
Layering: building complex services from simpler ones
11/17/10
Limited Size
Unordered (sometimes)
Unreliable
Machine-to-machine
Only on local area net
Asynchronous
Insecure
Kubiatowicz CS162
Abstraction: Messages
Arbitrary Size
Ordered
Reliable
Process-to-process
Routed anywhere
Synchronous
Secure
UCB Fall 2010
Lec 22.17
IP Ver4
Time to
Live (hops)
Type of
transport
protocol
15 16
31
4
IHL
ToS
Total length(16-bits)
16-bit identification flags 13-bit frag off
TTL
protocol 16-bit header checksum
32-bit source IP address
32-bit destination IP address
options (if any)
11/17/10
Lec 22.18
IP Packet Format:
Size of datagram
(header+data)
IP Packet Format
IP Header
Length
Flags &
Fragmentation
to split large
messages
IP header
20 bytes
Data
UDP Data
11/17/10
Lec 22.19
11/17/10
Lec 22.20
Sequence Numbers
Ordered Messages
0,1,2,3,4..
If packets arrive out of order, reorder before delivering to
user application
For instance, hold onto #3 until #2 arrives, etc.
Using Acknowledgements
B
A
Lec 22.21
Lec 22.22
Timeout
Requirements:
Some questions:
11/17/10
Lec 22.23
Alternating-bit protocol:
A
Send one message at a time; dont send
next message until ack received
Sender keeps last message; receiver
tracks sequence # of last message received
Lec 22.24
N=5
Allows pipelining of packets
Window size (N) < queue at destination
Stream in:
Queue
Lec 22.25
11/17/10
260
300
340
380 400
Seq:380
Size:20
Seq:340
Size:40
Seq:300
Size:40
Seq:260
Size:40
Receiver
230
Seq:230
Size:30
Sender
190
Seq:190
Size:40
Not yet
received
140
Seq:140
Size:50
Received
Buffered
100
Seq:100
Size:40
Received
Given to app
Lec 22.26
Sequence Numbers
Not yet
sent
gfedcba
Sent
not acked
Router
TCP Details
Sent
acked
Router
..zyxwvuts
11/17/10
Stream out:
A:100/300
Seq:100
A:140/260
Seq:140
A:190/210
Seq:230
A:190/210
Seq:260
A:190/210
Seq:300
A:190/210
Sequence regions
Seq:190 Retransmit!
A:340/60
Seq:340
A:380/20
11/17/10
Lec 22.27
Seq:380
11/17/10
A:400/0
Lec 22.28
Sequence Number
Ack Number
IP Header
(20 bytes)
IP Header
(20 bytes)
Sequence Number
Ack Number
TCP Header
Congestion Avoidance
How long should timeout be for re-sending messages?
TCP Header
Selective Acknowledgement
11/17/10
Lec 22.29
Sequence-Number Initialization
How do you choose an initial sequence number?
11/17/10
Lec 22.30
On client:
11/17/10
Lec 22.31
11/17/10
Lec 22.32
server:
//Makes socket, binds addr/port, calls listen()
ServerSocket sock = new ServerSocket(6013);
while(true) {
Socket client = sock.accept();
PrintWriter pout = new
PrintWriter(client.getOutputStream(),true);
new
socket
connection
socket
Client
socket
Server
Things to remember:
Connection involves 5 values:
[ Client Addr, Client Port, Server Addr, Server Port, Protocol ]
Often, Client Port randomly assigned
Done by OS during client socket setup
Lec 22.33
Conclusion
DNS: System for mapping from namesIP addresses
Hierarchical mapping from authoritative domains
Recent flaws discovered
Ordered messages:
Reliable messages:
Use Acknowledgements
11/17/10
client.close();
Lec 22.35
}
client:
// Makes socket, binds addr/port, calls connect()
Socket sock = new Socket(169.229.60.38,6013);
BufferedReader bin =
new BufferedReader(
new InputStreamReader(sock.getInputStream));
String line;
while ((line = bin.readLine())!=null)
System.out.println(line);
sock.close();
11/17/10
Lec 22.34