速查:
如果拆包了第二个包的IP标志位Flags中会看到 Fragment offset: xxx
如果拆包了第一个包的IP标志位Flags中会看到 More fragments: Set
如果强制客户端不允许拆包会看到 Don't fragment: Set
**拆包大小一般是1500字节:
这个1500是只得IP头+ICMP报文的大小,所以ICMP报文超过1480就会拆包
**不是ICMP的话从IP头算起(包括IP头20字节)后面的长度等于ip header中的length,也就是拆包依据源端机器:192.168.10.45
目标机器:192.168.10.46
三次测试两边抓包
ping -c 3 192.168.10.46ping -c 3 -s 1500 192.168.10.46ping -c 3 -s 1500 -M do 192.168.10.46注意这里 PING 192.168.10.46 (192.168.10.46) 56(84) bytes of data.
其中的84指的是ICMP报文内容+ 头=64+20=84
# 45上抓包 单网卡eth0
tcpdump -i eth0 -s 0 -w p100c.pcap host 192.168.10.46
# 46上抓包 单网卡eth0
# tcpdump -i eth0 -s 0 -w p100s.pcap host 192.168.10.45
# 45上ping
ping -c 3 192.168.10.46
PING 192.168.10.46 (192.168.10.46) 56(84) bytes of data.
64 bytes from 192.168.10.46: icmp_seq=1 ttl=64 time=0.249 ms
64 bytes from 192.168.10.46: icmp_seq=2 ttl=64 time=0.157 ms
64 bytes from 192.168.10.46: icmp_seq=3 ttl=64 time=0.165 ms
--- 192.168.10.46 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.157/0.190/0.249/0.043 msclient端分析

IP头站20字节,注意这个Total Length是IP头+ICMP报文的长度,总长度还要加上前面
所以ping默认的64字节指的是ICMP实际报文长度64字节
PING 192.168.10.46 (192.168.10.46) 1500(1528) bytes of data.
实际1528=IP报文头+1500对齐后=20+1508=1528
# 45上抓包 单网卡eth0
tcpdump -i eth0 -s 0 -w p1500c.pcap host 192.168.10.46
ping -c 3 -s 1500 192.168.10.46
PING 192.168.10.46 (192.168.10.46) 1500(1528) bytes of data.
1508 bytes from 192.168.10.46: icmp_seq=1 ttl=64 time=0.293 ms
1508 bytes from 192.168.10.46: icmp_seq=2 ttl=64 time=0.193 ms
1508 bytes from 192.168.10.46: icmp_seq=3 ttl=64 time=0.185 ms
--- 192.168.10.46 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.185/0.223/0.293/0.052 msclient端分析第一个包

第二个包:拆包大小一般是1500字节,这个1500是只得IP头+ICMP报文的大小,所以ICMP报文超过1480就会拆包

# 45上抓包 单网卡eth0
tcpdump -i eth0 -s 0 -w telnetc.pcap host 192.168.10.46
# 45上telnet 46
telnet 192.168.10.46 22icmp报文没有tcp部分,所以IP头中的长度只算了ip头20+icmp长度。
这里的报文要ip头+tcp+ssh三部分等于总长度73
