Docsity

Internet Protocol Stack - Lecture Slides | EECS 489, Study notes of Electrical and Electronics Engineering

Toggle sidebar
bg1
Internet Protocol Stack!
application: supporting network applications!
•!HTTP, SMTP, FTP, etc.!
transport: endhost-endhost data transfer!
•!TCP, UDP!
network: routing of datagrams from source
to destination!
•!IP, routing protocols!
link: data transfer between neighboring
network elements!
•!Ethernet, WiFi!
physical: bits “on the wire”!
application
transport
network
link
physical
TCP: Transmission Control Protocol !
Provides reliability on connectionless datagram network:!
•! !
•! !
•! !
Link layer already provides sequencing and error control!
Why do we need to provide reliability again at the
transport layer?!
•! !
•! !
Need for E2E Reliability!
1 0 1
1 0 1 1 1 1
1 1 1
2
1
5
3
4
6
7
1
2
3
5
4
7
E2E Reliability!
Causes of unreliable delivery!
•!re-routed packets!
•!bit error!
•!dropped/lost packets (due to congestion)!
•!system reboots!
How to achieve reliable delivery?!
Reliable delivery requires tools:!
•! !
•! !
•! !
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Internet Protocol Stack - Lecture Slides | EECS 489 and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

Internet Protocol Stack!

application: supporting network applications!

-! HTTP, SMTP, FTP, etc.! transport: endhost-endhost data transfer! -! TCP, UDP! network: routing of datagrams from source to destination! -! IP, routing protocols! link: data transfer between neighboring network elements! -! Ethernet, WiFi! physical: bits “on the wire”! application transport network link physical

TCP: Transmission Control Protocol!

Provides reliability on connectionless datagram network:!

-!! -!! -!! Link layer already provides sequencing and error control! Why do we need to provide reliability again at the transport layer?! -!! -!!

Need for E2E Reliability!

1 0 1 1 0 1 1 1^1 1 1 1 2 1 5 3 4 6 7 1 2 3 5 4 7

E2E Reliability!

Causes of unreliable delivery!

-! re-routed packets! -! bit error! -! dropped/lost packets (due to congestion)! -! system reboots! How to achieve reliable delivery?! Reliable delivery requires tools:! -!! -!! -!!

Sequence Number!

With ARQ, packets must be numbered, why?!

-!! -!! Sequence number space is finite. Issues:! 1.! sequence space size! 2.! sequence number wrap around! 3.! initial sequence number (ISN)!

Sequence Number Space Size!

If we had only 2 bits to keep track of sequence numbers:! What prevention?! S 2 1 0 3 2 1 0 D new? or rexmit? T MPL: Max. Pkt. Lifetime A MPL

Sequence Number Space Size!

Let:! A : time taken by receiver to ACK packet! T : time sender continues retransmitting if ACK not received! Maximum Seqment Lifetime (MSL): 2MPL + T + A Want: no seq. number may be duplicated within an MSL!

Sequence Number Wrap Around!

Sequence space is finite and sequence number can wrap around:! Assuming s 1 and s 2 are not more than N /2 apart, s 1 > s 2 if either:! 1.! s 1 > s 2 and |s 1 – s 2 | < N /2, or! 2.! s 1 < s 2 and |s 1 – s 2 | > N /2! 0 3 1 2 0 which is newer? pkt 3 queued/ delayed S2 S 0 N 0 N S1 (^) S

Connection Establishment!

First try:! Lesson: connection request must be ACKed! Sender S Destination D SYN ISN=X reboot SYN ISN=Z Expected Seq. # ESN = X+1, ESTABLISHED discard Z+ Z+ dropped, but connection with ESN = X+ still ESTABLISHED

Connection Establishment!

Second try:! Lesson: connection ACK must be ACKed or rejected! Sender S Destination D stray SYN ISN=X SYN ISN=Y ACK X+ ESN = X+ ESTABLISHED discard Y+

Connection Establishment!

Three-way handshake:! SYN uses a seq#! Sender S Destination D SYN ISN=X SYN ISN=Y ACK X+ X+ ESN = Y+ ESTABLISHED ESN = X+ ESTABLISHED ACK Y+

Three-Way Handshake!

How three-way handshake solves the original problems:! Sender S Destination D SYN ISN=X reboot SYN ISN=Z SYN ACK ISN=YX+ RST Y RST Z Sender S Destination D stray SYN ISN=X SYN ISN=Y ACK X+ ESN = X+ ESTABLISHED discard RST Y

Connection Tear-down!

When to release a connection?! I.e., how do you know the other side is done sending and all sent packets have arrived?! Use 3-way handshake to tear-down connection:! FIN also uses a seq#! Sender S Destination D FIN X ACK X+1 FIN Y ACK Y+

Connection Tear-down!

If the other side still has data to send:! Why not send ACK X+1 along with FIN Y?! Sender S Destination D FIN X ACK X+ ACK Y+ FIN Y More data pkts from D

Connection Tear-down!

Still depends on timeout:! Sender S Destination D FIN X ACK X+1 FIN Y ACK Y+ X rto FIN X ACK X+1 FIN Y Sender S Destination D FIN X ACK X+1 FIN Y ACK Y+1X^ rto times out and tears down connection unilaterally

Connection Tear-down!

Still depends on timeout:! TCP connection tear-down depends on timers for correctness, but uses 3-way handshake for performance improvement! Sender S Destination D FIN X ACK X+1 FIN Y FIN X X rto times out and tears down connection unilaterally X FIN X rto rto ACK X+1 FIN Y X after n attempts tears down connection unilaterally

TCP Flow Control!

receive side of TCP connection has a receive buffer:! application process may be slow at reading from the buffer! sender won’t overflow! receiver’s buffer by! transmitting too much,! too fast! flow control! Receiver advertises buffer space available by including the current value of rwnd in TCP header! Sender limits unACKed data to rwnd !guarantees receiver buffer doesn’t overflow!

TCP Flow Control Problems!

Two flow-control problems:! 1.! receiver too slow (silly-window syndrome)! 2.! sender’s data comes in small amount (Nagle’s algorithm)! Silly-window syndrome:! receiver window opens only by " a small amount, hence sender " can send only a small amount " of data at a time! Why is this not good?! 1.!! 2.!! Sender S Destination D w = 2500 0 (size 1000) 2000 (500) 2500 (1) application reads out 1 byte w = 1 application out 1 byte reads w = 1 2501 (1) 1000 (1000)

Solution to Silly-window Syndrome!

Don’t advertise window until it opens “significantly”" (> #MSS or #rwnd)! Implementation alternatives:!

-! ACK with rwnd=0: " sender probes after " persistence timer goes off! -! delayed ACK, but! -! not more than 500 ms, or! -! ACK every other segment! (why?)! Sender S Destination D w = 2500 0 (1000) 1000 (1000) 2000 (500) probe 2499 (1) application out 1 byte reads w = 0 w = 2000 persist timer

TCP Delayed ACK Generation!

Event at Receiver!

Arrival of in-order segment with! expected seq #. All data up to! expected seq # already ACKed! Arrival of in-order segment with! expected seq #. One other! segment has ACK pending! Arrival of out-of-order segment! higher-than-expect seq. # .! Gap detected! Arrival of segment that! partially or completely fills gap!

TCP Receiver action!

Delayed ACK. Wait up to 500ms! for next segment. If no next segment,! send ACK! Immediately send single cumulative! ACK, ACKing both in-order segments! Immediately send duplicate ACK,! indicating seq. # of next expected byte! Immediately send ACK, provided that! segment starts at lower end of gap!

Characteristics of"

Interactive Applications!

User sends only a small amount of data, e.g., telnet sends one character at a time! Problem: 40-byte header for every byte sent!! Solution: “clumping,” sender clumps data together, i.e., sender waits for a “reasonable” amount of time before sending! How long is “reasonable”?!

Nagle Algorithm!

-! send first segment immediately! -! accumulate data until ACK returns, or! -! # sender window or # MSS amount of data has been accumulated! Advantages:! -! bulk transfer is not held up! -! data sent as fast as network can deliver! Can be disabled by setsockopt(TCP_NODELAY)

Nagle Algorithm!

Nagle sends data as fast as network can deliver:! Sender S Receiver round-trip^ R time (rtt) ACKs pkts (^12) 3 w (^12) 3 w

.. . (^). .. . .. .. . bytes^ w+ in 2rtts Sender S Receiver round-trip^ R time (rtt) (^1) 2 to w+ 1 w+ in 2rtts^ bytes 2 to w+

Retransmission Timeout!

ARQ depends on retransmission to achieve reliability! Retransmission timeout (RTO) computed from round- trip time (RTT)! On the Internet, RTT of a path varies over time, due to:!

-!! -!! Varying RTT complicates the " computation of:! 1.! retransmission timeout (RTO)! 2.! optimal sender’s window size! Sender S Receiver R !! round-trip time (rtt) ACKs Pkts (^12) (^34) (^12) (^34) retransmission timeout (rto)

ACK Ambiguity!

Which retransmitted packet to associate with an ACK?! 1.! original packet: " RTO can grow unbounded! 2.! retransmitted packet: RTO shrinks! There is a feedback loop between RTO computation and RTT estimate! Sender S Destination D rto rtt rto rtt rto 0 0 1 1 2 Sender S Destination D rto rtt X rto^ X X rtt rto 0 0 1 1 2

ACK Ambiguity: Karn’s Algorithm!

Karn’s algorithm:!

-! adjust RTT estimate only from non-retransmitted samples! -! however, ignoring retransmissions could lead to insensitivity to long delays! -! so, back off RTO upon retransmission: " RTOnew= # RTOold, # typically = 2!

RTT Spread Too Wide!

RTT estimate computed using exponential weighted average gives only a good mean! Jacobson’s algorithm:!

-! estimate the variance in sampleRTT! -! use the deviation in sampleRTT ( D ) in RTO computation! -! D new=! D old + (1- !) |sampleRTT – estimatedRTT| -! compute new estimatedRTT! -! RTO = estimatedRTT + 4 D pdf rtt samples rtt mean rto 2 rtt = pkts rtt must bewith these rexmitted

Timers Used in TCP!

1.! TIME_WAIT: 2* MSL!

2.! persistence timer! 3.! RTO! 4.! keep-alive timer: probe if connection idle too long! may be turned on/off and idle period may be set using setsockopt()