tcpdump -n -v 'tcp[tcpflags] & (tcp-rst) != 0'
-n
表示不解析IP地址到主机名,可以加快tcpdump处理效率,避免丢包
17:37:49.579533 IP (tos 0x0, ttl 63, id 0, offset 0, flags [DF], proto: TCP (6), length: 40) 192.168.9.77.19313 > 192.168.1.47.38143: R, cksum 0x9799 (correct), 0:0(0) ack 198481846 win 0
17:37:49.584932 IP (tos 0x0, ttl 63, id 0, offset 0, flags [DF], proto: TCP (6), length: 40) 192.168.8.206.19313 > 192.168.1.47.33568: R, cksum 0x2891 (correct), 0:0(0) ack 120462787 win 0
17:37:49.585830 IP (tos 0x0, ttl 63, id 0, offset 0, flags [DF], proto: TCP (6), length: 40) 192.168.8.209.19311 > 192.168.1.47.57579: R, cksum 0x0bbe (correct), 0:0(0) ack 1813084134 win 0
17:37:49.587327 IP (tos 0x0, ttl 63, id 0, offset 0, flags [DF], proto: TCP (6), length: 40) 192.168.9.164.19312 > 192.168.1.47.52457: R, cksum 0x26c0 (correct), 0:0(0) ack 3267631455 win 0
cat retrans.txt | awk '{print $20}' | awk -F. '{print $1"."$2"."$3"."$4}' | sort | uniq -c
93 192.168.1.39
72 192.168.1.47
70 192.168.5.146
94 192.168.5.186
tshark -Y "tcp.analysis.retransmission" -Tfields -e ip.src -e ip.dst