IP Packet Header 0 4 8 typeofservice identification











- Slides: 11
IP Packet Header 0 4 8 type-of-service identification time-to-live 31 total length flags protocol fragment offset header checksum source address destination address options (variable length) Basic header vers. # HLen 16 padding data See RFC-791 for detailed specifications ftp: //ftp. isi. edu/in-notes/rfc 791. txt CS 118/3 -14 -2000 1 Lixia Zhang/UCLA
UDP: User Datagram Protocol ©Each UDP message is called a datagram – unreliable delivery between application processes ©UDP 0 header 31 source port # destination port# checksum length data. . . – Length: # of bytes (including both header & data) – checksum: computed over » the pseudo header, and » UDP datagram (including both header and data) » if the field is 0, no checksum CS 118/3 -14 -2000 2 Lixia Zhang/UCLA
UDP (cont) UDP header: Source port Length pseudo header: destination port checksum source IP address destination IP address zero protocol UDP length addresses & protocol: copied from IP header 4 UDP length: already covered in the UDP header 4 pseudo header is not carried in the datagram, nor counted in length field 4 why pseudo header: UDP's self-protection against mis-delivered IP packets CS 118/3 -14 -2000 3 Lixia Zhang/UCLA
TCP header format 0 31 16 IP header source port destination port Data sequence number acknowledgment number Hlen unused u a p r s f r c s s y i g k h t n n window size checksum urgent pointer Options (viable length) data CS 118/3 -14 -2000 4 Lixia Zhang/UCLA
TCP connection: open and close ©Open: the initial seq# is randomly chosen server Passive open client open request(x) ack(x+1) + request(y) ack(y+1) (now in estab. state) Close: enter estab. state I-finished(M) ACK (M+1) I-finished(N) ack(N+1), wait for 2 MSL before deleting conn state CS 118/3 -14 -2000 Done, delete conn. state 5 Lixia Zhang/UCLA
Sliding Window flow control with go-back-N W=4 CS 118/3 -14 -2000 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 Ack(35) Ack(37) Ack(41) 6 Lixia Zhang/UCLA
Measuring Round Trip Time (RTT) SRTT: Smoothed RTT (exponential average) SRTT = x SRTT + (1 - ) x RTT(n), < 1 – a small (large) value makes SRTT adapts to network delay changes quickly (slowly) RTO: Retransmission Time. Out RTO = ? diff = |RTT - SRTT| SRTT = SRTT + x diff, = 1/8 = 0. 125 rttvar = rttvar + (diff - rttvar), =1/4 =0. 25 RTO = SRTT + 4 x rttvar in case of retransmission: don’t measure RTT, but double RTO after each timeout CS 118/3 -14 -2000 7 Lixia Zhang/UCLA
An Example Assuming SRTT = 500 msec, rttvar = 120, RTT(3)=600 ms, = |RTT - SRTT| = 100 ms SRTT = 500 + 0. 125 * 100 = 512. 5 rttvar = 120 + 0. 25 (100 - 120) = 115 RTO = SRTT + 4 * rttvar = 512. 5 + 460 = 972. 5 ms RTT(4)=650 ms, = |RTT - SRTT| =137 ms SRTT = 512 + 0. 125 * 137 = 529 rttvar = rttvar + 0. 25 (137 - 115) = 120 600 sender 3 650 4 receiver CS 118/3 -14 -2000 8 Lixia Zhang/UCLA
TCP Flow & Congestion Control © TCP has a receiver-controlled window size © sender uses a congestion window, cwnd transmission window = MIN(cwnd, receive-window) adjusts cwnd by observing network congestion level © cwnd adjustment: additive increase, multiplicative decrease (AIMD) © sender – in the absence of congestion, increase cwnd by one mss per round trip – upon packet losses, decrease cwnd by half CS 118/3 -14 -2000 9 Lixia Zhang/UCLA
Additive congestion window increase Source © Initialize: cwnd=1 mss © upon each ack arrival: cwnd += mss Destination 1 st RTT cwnd=1 mss © if the product is large, may take long to increase cwnd to proper size 2 nd RTT cwnd=2 mss TCP Slow-Start: à increase cwnd by 1 MSS upon receiving every ACK à increase cwnd value exponentially: doubling cwnd every round trip time CS 118/3 -14 -2000 10 Lixia Zhang/UCLA
implementation ©Initialize ©upon cwnd=1 mss, ssthresh=win-size receiving an ACK – if (cwnd < ssthresh) cwnd += mss – else cwnd += mss x mss/cwnd ©upon timeout: – ssthresh = cwnd / 2 – cwnd = 1 MSS cwnd: 500 1000 timeout 2000 2500 ssthresh=1250 cwnd=500 Assume mss=500 B, ssthresh=2000 B, CS 118/3 -14 -2000 11 Lixia Zhang/UCLA