Title: Midterm Review
1Midterm Review
- In class, 100-230 pm, Tu. 2/6
- Closed Book
- One 8.5 by 11 sheet of paper permitted (single
side)
2Lecture 1
- Internet Architecture
- Network Protocols
- Network Edge
- A taxonomy of communication networks
3A Taxonomy of Communication Networks
- The fundamental question how is data transferred
through net (including edge core)? - Communication networks can be classified based on
how the nodes exchange information
Communication Networks
SwitchedCommunication Network
BroadcastCommunication Network
Packet-SwitchedCommunication Network
Circuit-SwitchedCommunication Network
TDM
FDM
Datagram Network
Virtual Circuit Network
4Packet Switching Statistical Multiplexing
10 Mbs Ethernet
C
A
statistical multiplexing
1.5 Mbs
B
queue of packets waiting for output link
- Sequence of A B packets does not have fixed
pattern ? statistical multiplexing. - In TDM each host gets same slot in revolving TDM
frame.
5Packet Switching versus Circuit Switching
- Packet Switching
- Network resources (e.g., bandwidth) divided into
pieces for allocation - Resource piece idle if not used by owning call
(no sharing) - Dividing link bandwidth into pieces
- Great for bursty data
- NOT efficient !
- Circuit Switching
- Excessive congestion packet delay and loss
- protocols needed for reliable data transfer,
congestion control
6Datagram Packet Switching
- Each packet is independently switched
- Each packet header contains destination address
which determines next hop - Routes may change during session
- No resources are pre-allocated (reserved) in
advance - Example IP networks
7Virtual-Circuit Packet Switching
- Hybrid of circuit switching and packet switching
- All packets from one packet stream are sent along
a pre-established path ( virtual circuit) - Each packet carries tag (virtual circuit ID),
tag determines next hop - Guarantees in-sequence delivery of packets
- However, packets from different virtual circuits
may be interleaved - Example ATM (Asynchronous Transfer Mode) networks
8Lecture 2
- Network access and physical media
- Internet structure and ISPs
- Delay loss in packet-switched networks
- Protocol layers, service models
9Internet structure network of networks
- Tier-3 ISPs and local ISPs
- last hop (access) network (closest to end
systems) - Tier-3 Turkish Telecom, Minnesota Regional
Network
Tier 1 ISP
Tier 1 ISP
Tier 1 ISP
10Four sources of packet delay
- 1. processing
- check bit errors
- determine output link
- 2. queueing
- time waiting at output link for transmission
- depends on congestion level of router
11Delay in packet-switched networks
- 4. Propagation delay
- d length of physical link
- s propagation speed in medium (2x108 m/sec)
- propagation delay d/s
- 3. Transmission delay
- Rlink bandwidth (bps)
- Lpacket length (bits)
- time to send bits into link L/R
Note s and R are very different quantities!
12Internet protocol stack
- application supporting network applications
- FTP, SMTP, STTP
- transport host-host data transfer
- TCP, UDP
- network routing of datagrams from source to
destination - IP, routing protocols
- link data transfer between neighboring network
elements - PPP, Ethernet
- physical bits on the wire
13Application Layer
- Principles of app layer protocols
- Web and HTTP
- FTP
- Electronic Mail SMTP, POP3, IMAP
- DNS
- Socket Programming
- Web Caching
14HTTP connections
- Nonpersistent HTTP
- At most one object is sent over a TCP connection.
- HTTP/1.0 uses nonpersistent HTTP
- Persistent HTTP
- Multiple objects can be sent over single TCP
connection between client and server. - HTTP/1.1 uses persistent connections in default
mode
- HTTP Message, Format, Response, Methods
- HTTP cookies
15Response Time of HTTP
- Persistent without pipelining
- client issues new request only when previous
response has been received - one RTT for each referenced object
- Persistent with pipelining
- default in HTTP/1.1
- client sends requests as soon as it encounters a
referenced object - as little as one RTT for all the referenced
objects
- Nonpersistent HTTP issues
- requires 2 RTTs per object
- OS must work and allocate host resources for each
TCP connection - but browsers often open parallel TCP connections
to fetch referenced objects - Persistent HTTP
- server leaves connection open after sending
response - subsequent HTTP messages between same
client/server are sent over connection
16FTP separate control, data connections
- FTP client contacts FTP server at port 21,
specifying TCP as transport protocol - Client obtains authorization over control
connection - Client browses remote directory by sending
commands over control connection. - When server receives a command for a file
transfer, the server opens a TCP data connection
to client - After transferring one file, server closes
connection.
- Server opens a second TCP data connection to
transfer another file. - Control connection out of band
- FTP server maintains state current directory,
earlier authentication
17Electronic Mail SMTP RFC 2821
- uses TCP to reliably transfer email message from
client to server, port 25 - direct transfer sending server to receiving
server - three phases of transfer
- handshaking (greeting)
- transfer of messages
- closure
- command/response interaction
- commands ASCII text
- response status code and phrase
- messages must be in 7-bit ASCII
18DNS name servers
- no server has all name-to-IP address mappings
- local name servers
- each ISP, company has local (default) name server
- host DNS query first goes to local name server
- authoritative name server
- for a host stores that hosts IP address, name
- can perform name/address translation for that
hosts name
- Why not centralize DNS?
- single point of failure
- traffic volume
- distant centralized database
- maintenance
- doesnt scale!
19DNS example
root name server
- Root name server
- may not know authoritative name server
- may know intermediate name server who to contact
to find authoritative name server
6
2
3
7
5
4
1
8
authoritative name server dns.cs.nwu.edu
requesting host surf.eurecom.fr
www.cs.nwu.edu
20DNS iterated queries
root name server
- recursive query
- puts burden of name resolution on contacted name
server - heavy load?
- iterated query
- contacted server replies with name of server to
contact - I dont know this name, but ask this server
iterated query
2
3
4
7
5
6
1
8
authoritative name server dns.cs.umass.edu
requesting host surf.eurecom.fr
gaia.cs.umass.edu
21Web caches (proxy server)
Goal satisfy client request without involving
origin server
- user sets browser Web accesses via cache
- browser sends all HTTP requests to cache
- object in cache cache returns object
- else cache requests object from origin server,
then returns object to client - Why web caching?
origin server
Proxy server
HTTP request
HTTP request
client
HTTP response
HTTP response
HTTP request
HTTP response
client
origin server
22Caching example (3)
- Install cache
- suppose hit rate is .4
- Consequence
- 40 requests will be satisfied almost immediately
- 60 requests satisfied by origin server
- utilization of access link reduced to 60,
resulting in negligible delays (say 10 msec) - total delay Internet delay access delay
LAN delay - .62 sec .6.01 secs milliseconds lt 1.3
secs
origin servers
public Internet
1.5 Mbps access link
institutional network
10 Mbps LAN
institutional cache
23Transport Layer
- Transport-layer services
- Multiplexing and demultiplexing
- Connectionless transport UDP
- Principles of reliable data transfer
- TCP
- Segment structures
- Flow control
- Congestion control
24Demultiplexing
- UDP socket identified by two-tuple
- (dest IP address, dest port number)
- When host receives UDP segment
- checks destination port number in segment
- directs UDP segment to socket with that port
number
- TCP socket identified by 4-tuple
- source IP address
- source port number
- dest IP address
- dest port number
- recv host uses all four values to direct segment
to appropriate socket
25UDP User Datagram Protocol RFC 768
32 bits
- Why is there a UDP?
- no connection establishment (which can add delay)
- simple no connection state at sender, receiver
- small segment header
- no congestion control UDP can blast away as fast
as desired
source port
dest port
checksum
length
Application data (message)
UDP segment format
26UDP checksum
- Goal detect errors (e.g., flipped bits) in
transmitted segment
- Receiver
- addition of all segment contents checksum
- check if all bits are 1
- NO - error detected
- YES - no error detected. But maybe errors
nonetheless? More later .
- Sender
- treat segment contents as sequence of 16-bit
integers - checksum addition (1s complement sum) of
segment contents - sender puts checksum value into UDP checksum field
0110 0101 1011 0100
0110 0101 0100 1111
1s complement sum Addition
Addition 1s complement sum
27Rdt1.0 reliable transfer over a reliable channel
- underlying channel perfectly reliable
- no bit errors
- no loss of packets
- separate FSMs for sender, receiver
- sender sends data into underlying channel
- receiver read data from underlying channel
rdt_send(data)
rdt_rcv(packet)
Wait for call from below
Wait for call from above
extract (packet,data) deliver_data(data)
packet make_pkt(data) udt_send(packet)
sender
receiver
28Rdt2.0 channel with bit errors
- underlying channel may flip bits in packet
- recall UDP checksum to detect bit errors
- the question how to recover from errors
- acknowledgements (ACKs) receiver explicitly
tells sender that pkt received OK - negative acknowledgements (NAKs) receiver
explicitly tells sender that pkt had errors - sender retransmits pkt on receipt of NAK
- new mechanisms in rdt2.0 (beyond rdt1.0)
- error detection
- receiver feedback control msgs (ACK,NAK)
rcvr-gtsender
29rdt2.0 FSM specification
rdt_send(data)
receiver
snkpkt make_pkt(data, checksum) udt_send(sndpkt)
rdt_rcv(rcvpkt) isNAK(rcvpkt)
Wait for call from above
udt_send(sndpkt)
rdt_rcv(rcvpkt) isACK(rcvpkt)
L
sender
rdt_rcv(rcvpkt) notcorrupt(rcvpkt)
extract(rcvpkt,data) deliver_data(data) udt_send(A
CK)
30rdt2.0 has a fatal flaw!
- What happens if ACK/NAK corrupted?
- sender doesnt know what happened at receiver!
- cant just retransmit possible duplicate
- What to do?
- sender ACKs/NAKs receivers ACK/NAK? What if
sender ACK/NAK lost? - retransmit, but this might cause retransmission
of correctly received pkt!
- Handling duplicates
- sender adds sequence number to each pkt
- sender retransmits current pkt if ACK/NAK garbled
- receiver discards (doesnt deliver up) duplicate
pkt
Sender sends one packet, then waits for receiver
response
31rdt2.1 sender, handles garbled ACK/NAKs
rdt_send(data)
sndpkt make_pkt(0, data, checksum) udt_send(sndp
kt)
rdt_rcv(rcvpkt) ( corrupt(rcvpkt)
isNAK(rcvpkt) )
Wait for call 0 from above
udt_send(sndpkt)
rdt_rcv(rcvpkt) notcorrupt(rcvpkt)
isACK(rcvpkt)
rdt_rcv(rcvpkt) notcorrupt(rcvpkt)
isACK(rcvpkt)
L
L
rdt_rcv(rcvpkt) ( corrupt(rcvpkt)
isNAK(rcvpkt) )
rdt_send(data)
sndpkt make_pkt(1, data, checksum) udt_send(sndp
kt)
udt_send(sndpkt)
32rdt2.2 a NAK-free protocol
- same functionality as rdt2.1, using NAKs only
- instead of NAK, receiver sends ACK for last pkt
received OK - receiver must explicitly include seq of pkt
being ACKed - duplicate ACK at sender results in same action as
NAK retransmit current pkt
33rdt3.0 channels with errors and loss
- New assumption underlying channel can also lose
packets (data or ACKs) - checksum, seq. , ACKs, retransmissions will be
of help, but not enough - Q how to deal with loss?
- sender waits until it is certain that data or ACK
lost, then retransmits - yuck drawbacks?
- Approach sender waits reasonable amount of
time for ACK - retransmits if no ACK received in this time
- if pkt (or ACK) just delayed (not lost)
- retransmission will be duplicate, but use of
seq. s already handles this - receiver must specify seq of pkt being ACKed
- requires countdown timer
34rdt3.0 sender
rdt_send(data)
rdt_rcv(rcvpkt) ( corrupt(rcvpkt)
isACK(rcvpkt,1) )
sndpkt make_pkt(0, data, checksum) udt_send(sndp
kt) start_timer
L
rdt_rcv(rcvpkt)
L
timeout
udt_send(sndpkt) start_timer
rdt_rcv(rcvpkt) notcorrupt(rcvpkt)
isACK(rcvpkt,1)
rdt_rcv(rcvpkt) notcorrupt(rcvpkt)
isACK(rcvpkt,0)
stop_timer
stop_timer
timeout
udt_send(sndpkt) start_timer
rdt_rcv(rcvpkt)
L
rdt_send(data)
rdt_rcv(rcvpkt) ( corrupt(rcvpkt)
isACK(rcvpkt,0) )
sndpkt make_pkt(1, data, checksum) udt_send(sndp
kt) start_timer
L
35Go-Back-N
- Sender
- k-bit seq in pkt header
- window of up to N, consecutive unacked pkts
allowed
- ACK(n) ACKs all pkts up to, including seq n -
cumulative ACK - may deceive duplicate ACKs (see receiver)
- Single timer for all in-flight pkts
- timeout(n) retransmit pkt n and all higher seq
pkts in window
36Selective Repeat
- receiver individually acknowledges all correctly
received pkts - buffers pkts, as needed, for eventual in-order
delivery to upper layer - sender only resends pkts for which ACK not
received - sender timer for each unACKed pkt
- sender window
- N consecutive seq s
- again limits seq s of sent, unACKed pkts
37Selective repeat sender, receiver windows
38TCP segment structure
URG urgent data (generally not used)
counting by bytes of data (not segments!)
ACK ACK valid
PSH push data now (generally not used)
bytes rcvr willing to accept
RST, SYN, FIN connection estab (setup,
teardown commands)
Internet checksum (as in UDP)
39TCP Round Trip Time and Timeout
EstimatedRTT (1- ?)EstimatedRTT ?SampleRTT
- Exponential weighted moving average
- influence of past sample decreases exponentially
fast - typical value ? 0.125
40Fast Retransmit
- Time-out period often relatively long
- long delay before resending lost packet
- Detect lost segments via duplicate ACKs.
- Sender often sends many segments back-to-back
- If segment is lost, there will likely be many
duplicate ACKs.
- If sender receives 3 ACKs for the same data, it
supposes that segment after ACKed data was lost - fast retransmit resend segment before timer
expires
41TCP Flow control how it works
- Rcvr advertises spare room by including value of
RcvWindow in segments - Sender limits unACKed data to RcvWindow
- guarantees receive buffer doesnt overflow
- (Suppose TCP receiver discards out-of-order
segments) - spare room in buffer
- RcvWindow
- RcvBuffer-LastByteRcvd - LastByteRead
42TCP Congestion Control
- end-end control (no network assistance)
- sender limits transmission
- LastByteSent-LastByteAcked
- ? CongWin
- Roughly,
- CongWin is dynamic, function of perceived network
congestion
- How does sender perceive congestion?
- loss event timeout or 3 duplicate acks
- TCP sender reduces rate (CongWin) after loss
event - three mechanisms
- AIMD
- slow start
- conservative after timeout events
43TCP Slow Start
- When connection begins, increase rate
exponentially fast until first loss event
- When connection begins, CongWin 1 MSS
- Example MSS 500 bytes RTT 200 msec
- initial rate 20 kbps
- available bandwidth may be gtgt MSS/RTT
- desirable to quickly ramp up to respectable rate
44Refinement
Philosophy
- 3 dup ACKs indicates network capable of
delivering some segments - timeout before 3 dup ACKs is more alarming
- After 3 dup ACKs
- CongWin is cut in half
- window then grows linearly
- But after timeout event
- Enter slow start
- CongWin instead set to 1 MSS
- window then grows exponentially
- to a threshold, then grows linearly
45Why is TCP fair?
- Two competing sessions
- Additive increase gives slope of 1, as throughout
increases - multiplicative decrease decreases throughput
proportionally
R
equal bandwidth share
loss decrease window by factor of 2
congestion avoidance additive increase
Connection 2 throughput
loss decrease window by factor of 2
congestion avoidance additive increase
Connection 1 throughput
R