7 TCP CONGESTION CONTROL AND FURTHER ON RDP
bidirectional packet loss. tcpdump on r-eth0
Code: Select all
root@r piconet> tc qdisc add dev r-eth0 root netem loss 20%
root@r piconet> tc qdisc add dev r-eth1 root netem loss 20%
root@r piconet> tcpdump -l -i r-eth0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on r-eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
15:03:12.310941 IP h1.60138 > h2.5001: Flags [S], seq 485904907, win 65535, options [mss 1024,sackOK,TS val 3018342000 ecr 0,nop,wscale 6], length 0
15:03:12.311081 IP h2.5001 > h1.60138: Flags [S.], seq 4195477387, ack 485904908, win 65160, options [mss 1460,sackOK,TS val 4245759091 ecr 3018342000,nop,wscale 6], length 0
15:03:12.311121 IP h1.60138 > h2.5001: Flags [.], ack 1, win 1024, options [nop,nop,TS val 3018342000 ecr 4245759091], length 0
this packet will be dropped by r-eth1
Code: Select all
15:03:12.312480 IP h1.60138 > h2.5001: Flags [P.], seq 1:1025, ack 1, win 1024, options [nop,nop,TS val 3018342002 ecr 4245759091], length 1024
15:03:12.313284 IP h2.5001 > h1.60138: Flags [.], ack 1025, win 1003, options [nop,nop,TS val 4245759093 ecr 3018342002], length 0
first data packet and acknowledgment
Code: Select all
15:03:12.314145 IP h1.60138 > h2.5001: Flags [P.], seq 1025:2049, ack 1, win 1024, options [nop,nop,TS val 3018342003 ecr 4245759093], length 1024
15:03:12.314533 IP h1.60138 > h2.5001: Flags [.], seq 2049:3061, ack 1, win 1024, options [nop,nop,TS val 3018342004 ecr 4245759093], length 1012
15:03:12.314599 IP h2.5001 > h1.60138: Flags [.], ack 3061, win 981, options [nop,nop,TS val 4245759095 ecr 3018342004], length 0
next two data packets (congestion window doubled in slow start) and ack
Code: Select all
15:03:12.314625 IP h1.60138 > h2.5001: Flags [P.], seq 3061:3073, ack 1, win 1024, options [nop,nop,TS val 3018342004 ecr 4245759095], length 12
15:03:12.314703 IP h2.5001 > h1.60138: Flags [.], ack 3073, win 1002, options [nop,nop,TS val 4245759095 ecr 3018342004], length 0
15:03:12.315652 IP h1.60138 > h2.5001: Flags [P.], seq 3073:4097, ack 1, win 1024, options [nop,nop,TS val 3018342005 ecr 4245759095], length 1024
15:03:12.316232 IP h1.60138 > h2.5001: Flags [.], seq 4097:5109, ack 1, win 1024, options [nop,nop,TS val 3018342005 ecr 4245759095], length 1012
this data packet seqno=4097 will be dropped by r-eth1
Code: Select all
15:03:12.316440 IP h1.60138 > h2.5001: Flags [.], seq 5109:6121, ack 1, win 1024, options [nop,nop,TS val 3018342006 ecr 4245759095], length 1012
next four data packets (cwnd is still increased)
Code: Select all
15:03:12.316673 IP h2.5001 > h1.60138: Flags [.], ack 4097, win 996, options [nop,nop,TS val 4245759097 ecr 3018342005,nop,nop,sack 1 {5109:6121}], length 0
sack included due to the lost packet
Code: Select all
15:03:12.316731 IP h1.60138 > h2.5001: Flags [P.], seq 6121:6145, ack 1, win 1024, options [nop,nop,TS val 3018342006 ecr 4245759097], length 24
continue to send new data packet after the sack
Code: Select all
15:03:12.317016 IP h2.5001 > h1.60138: Flags [.], ack 4097, win 996, options [nop,nop,TS val 4245759097 ecr 3018342005,nop,nop,sack 1 {5109:6145}], length 0
sack increased with the new packet
Code: Select all
15:03:12.319233 IP h1.60138 > h2.5001: Flags [.], seq 6145:7157, ack 1, win 1024, options [nop,nop,TS val 3018342008 ecr 4245759097], length 1012
15:03:12.319425 IP h1.60138 > h2.5001: Flags [.], seq 7157:8169, ack 1, win 1024, options [nop,nop,TS val 3018342008 ecr 4245759097], length 1012
15:03:12.319660 IP h1.60138 > h2.5001: Flags [.], seq 8169:9181, ack 1, win 1024, options [nop,nop,TS val 3018342008 ecr 4245759097], length 1012
15:03:12.319896 IP h1.60138 > h2.5001: Flags [.], seq 9181:10193, ack 1, win 1024, options [nop,nop,TS val 3018342008 ecr 4245759097], length 1012
continue to send new data packet after the 2nd sack
Code: Select all
15:03:12.329359 IP h1.60138 > h2.5001: Flags [.], seq 4097:5109, ack 1, win 1024, options [nop,nop,TS val 3018342018 ecr 4245759097], length 1012
retransmit the lost data packet at seqno=4097
Code: Select all
15:03:12.329566 IP h2.5001 > h1.60138: Flags [.], ack 8169, win 983, options [nop,nop,TS val 4245759110 ecr 3018342018], length 0
retransmitted data packet received and acked up to ackno=8169
Code: Select all
15:03:12.329685 IP h1.60138 > h2.5001: Flags [P.], seq 10193:10241, ack 1, win 1024, options [nop,nop,TS val 3018342019 ecr 4245759110], length 48
last data packet for a total of 10240 bytes tx'ed
Code: Select all
15:03:12.330142 IP h2.5001 > h1.60138: Flags [.], ack 8169, win 983, options [nop,nop,TS val 4245759110 ecr 3018342018,nop,nop,sack 1 {10193:10241}], length 0
sacked hinting the lost packet
Code: Select all
15:03:12.330167 IP h1.60138 > h2.5001: Flags [.], seq 8169:9181, ack 1, win 1024, options [nop,nop,TS val 3018342019 ecr 4245759110], length 1012
retransmit the second lost data packet at 8169
Code: Select all
15:03:12.330235 IP h2.5001 > h1.60138: Flags [.], ack 9181, win 968, options [nop,nop,TS val 4245759110 ecr 3018342019,nop,nop,sack 1 {10193:10241}], length 0
15:03:12.330257 IP h1.60138 > h2.5001: Flags [.], seq 9181:10193, ack 1, win 1024, options [nop,nop,TS val 3018342019 ecr 4245759110], length 1012
retransmit the third lost data packet at seqno=9181
Code: Select all
15:03:12.565517 IP h1.60138 > h2.5001: Flags [.], seq 9181:10193, ack 1, win 1024, options [nop,nop,TS val 3018342255 ecr 4245759110], length 1012
retransmit the third lost data packet at 9181
Code: Select all
15:03:12.565655 IP h2.5001 > h1.60138: Flags [.], ack 10241, win 997, options [nop,nop,TS val 4245759346 ecr 3018342255], length 0
the third lost packet has been received and acknowledged now
Code: Select all
15:03:12.565674 IP h1.60138 > h2.5001: Flags [F.], seq 10241, ack 1, win 1024, options [nop,nop,TS val 3018342255 ecr 4245759346], length 0
client (h1) to close its outgoing data flow
Code: Select all
15:03:12.579251 IP h2.5001 > h1.60138: Flags [F.], seq 1, ack 10242, win 1002, options [nop,nop,TS val 4245759359 ecr 3018342255], length 0
server (h2) acks and to close its outgoing data flow too
Code: Select all
15:03:12.579314 IP h1.60138 > h2.5001: Flags [.], ack 2, win 1024, options [nop,nop,TS val 3018342268 ecr 4245759359], length 0
last ack from the client (active close) to server (passive close)
and tcpdump on h2-eth0, i.e., what's tcp receiver sees
Code: Select all
15:03:12.311008 IP h1.60138 > h2.5001: Flags [S], seq 485904907, win 65535, options [mss 1024,sackOK,TS val 3018342000 ecr 0,nop,wscale 6], length 0
15:03:12.311051 IP h2.5001 > h1.60138: Flags [S.], seq 4195477387, ack 485904908, win 65160, options [mss 1460,sackOK,TS val 4245759091 ecr 3018342000,nop,wscale 6], length 0
15:03:12.312742 IP h1.60138 > h2.5001: Flags [P.], seq 1:1025, ack 1, win 1024, options [nop,nop,TS val 3018342002 ecr 4245759091], length 1024
the last packet of the three-way handshake lost, no impact
Code: Select all
15:03:12.313229 IP h2.5001 > h1.60138: Flags [.], ack 1025, win 1003, options [nop,nop,TS val 4245759093 ecr 3018342002], length 0
acknowledge the first data packet
Code: Select all
15:03:12.314273 IP h1.60138 > h2.5001: Flags [P.], seq 1025:2049, ack 1, win 1024, options [nop,nop,TS val 3018342003 ecr 4245759093], length 1024
15:03:12.314302 IP h2.5001 > h1.60138: Flags [.], ack 2049, win 988, options [nop,nop,TS val 4245759094 ecr 3018342003], length 0
second data packet and ack with reduced window size
Code: Select all
15:03:12.314559 IP h1.60138 > h2.5001: Flags [.], seq 2049:3061, ack 1, win 1024, options [nop,nop,TS val 3018342004 ecr 4245759093], length 1012
15:03:12.314575 IP h2.5001 > h1.60138: Flags [.], ack 3061, win 981, options [nop,nop,TS val 4245759095 ecr 3018342004], length 0
third data packet with reduced size
Code: Select all
15:03:12.314643 IP h1.60138 > h2.5001: Flags [P.], seq 3061:3073, ack 1, win 1024, options [nop,nop,TS val 3018342004 ecr 4245759095], length 12
15:03:12.314654 IP h2.5001 > h1.60138: Flags [.], ack 3073, win 1002, options [nop,nop,TS val 4245759095 ecr 3018342004], length 0
fourth data packet with reduced size
Code: Select all
15:03:12.315710 IP h1.60138 > h2.5001: Flags [P.], seq 3073:4097, ack 1, win 1024, options [nop,nop,TS val 3018342005 ecr 4245759095], length 1024
15:03:12.315910 IP h2.5001 > h1.60138: Flags [.], ack 4097, win 996, options [nop,nop,TS val 4245759096 ecr 3018342005], length 0
fifth data packet with the regular size
Code: Select all
15:03:12.316470 IP h1.60138 > h2.5001: Flags [.], seq 5109:6121, ack 1, win 1024, options [nop,nop,TS val 3018342006 ecr 4245759095], length 1012
15:03:12.316492 IP h2.5001 > h1.60138: Flags [.], ack 4097, win 996, options [nop,nop,TS val 4245759097 ecr 3018342005,nop,nop,sack 1 {5109:6121}], length 0
packet with seqno=4097 is lost; first dupack
Code: Select all
15:03:12.316824 IP h1.60138 > h2.5001: Flags [P.], seq 6121:6145, ack 1, win 1024, options [nop,nop,TS val 3018342006 ecr 4245759097], length 24
15:03:12.316844 IP h2.5001 > h1.60138: Flags [.], ack 4097, win 996, options [nop,nop,TS val 4245759097 ecr 3018342005,nop,nop,sack 1 {5109:6145}], length 0
second dupack
Code: Select all
15:03:12.319276 IP h1.60138 > h2.5001: Flags [.], seq 6145:7157, ack 1, win 1024, options [nop,nop,TS val 3018342008 ecr 4245759097], length 1012
15:03:12.319299 IP h2.5001 > h1.60138: Flags [.], ack 4097, win 998, options [nop,nop,TS val 4245759099 ecr 3018342005,nop,nop,sack 1 {5109:7157}], length 0
third dupack
Code: Select all
15:03:12.319538 IP h1.60138 > h2.5001: Flags [.], seq 7157:8169, ack 1, win 1024, options [nop,nop,TS val 3018342008 ecr 4245759097], length 1012
15:03:12.319558 IP h2.5001 > h1.60138: Flags [.], ack 4097, win 998, options [nop,nop,TS val 4245759099 ecr 3018342005,nop,nop,sack 1 {5109:8169}], length 0
more dupack with sack expanded as well
Code: Select all
15:03:12.329481 IP h1.60138 > h2.5001: Flags [.], seq 4097:5109, ack 1, win 1024, options [nop,nop,TS val 3018342018 ecr 4245759097], length 1012
15:03:12.329536 IP h2.5001 > h1.60138: Flags [.], ack 8169, win 983, options [nop,nop,TS val 4245759110 ecr 3018342018], length 0
retransmitted packet at 4097 received and thus acks 8169 for followings
Code: Select all
15:03:12.329710 IP h1.60138 > h2.5001: Flags [P.], seq 10193:10241, ack 1, win 1024, options [nop,nop,TS val 3018342019 ecr 4245759110], length 48
15:03:12.330111 IP h2.5001 > h1.60138: Flags [.], ack 8169, win 983, options [nop,nop,TS val 4245759110 ecr 3018342018,nop,nop,sack 1 {10193:10241}], length 0
15:03:12.330191 IP h1.60138 > h2.5001: Flags [.], seq 8169:9181, ack 1, win 1024, options [nop,nop,TS val 3018342019 ecr 4245759110], length 1012
15:03:12.330209 IP h2.5001 > h1.60138: Flags [.], ack 9181, win 968, options [nop,nop,TS val 4245759110 ecr 3018342019,nop,nop,sack 1 {10193:10241}], length 0
second lost packet at 8169 received
Code: Select all
15:03:12.565609 IP h1.60138 > h2.5001: Flags [.], seq 9181:10193, ack 1, win 1024, options [nop,nop,TS val 3018342255 ecr 4245759110], length 1012
15:03:12.565635 IP h2.5001 > h1.60138: Flags [.], ack 10241, win 997, options [nop,nop,TS val 4245759346 ecr 3018342255], length 0
third lost data packet received and acknowledgment for all data
Code: Select all
15:03:12.565688 IP h1.60138 > h2.5001: Flags [F.], seq 10241, ack 1, win 1024, options [nop,nop,TS val 3018342255 ecr 4245759346], length 0
15:03:12.579162 IP h2.5001 > h1.60138: Flags [F.], seq 1, ack 10242, win 1002, options [nop,nop,TS val 4245759359 ecr 3018342255], length 0
15:03:12.579365 IP h1.60138 > h2.5001: Flags [.], ack 2, win 1024, options [nop,nop,TS val 3018342268 ecr 4245759359], length 0