大网数据广告活动
服务器运维问答

Different length between ping and tcpdump

· 52CE 我爱测

I do not why I am not able to see under tcpdump the correct length value which should be $((9706-28)) = 9678 , but I see 9686 . On both side there is a MTU set to 9706 which maximum value for the interface which I am using. I run…

问题原文

原帖链接 · sqr · CC BY-SA 4.0

I do not why I am not able to see under tcpdump the correct length value which should be $((9706-28)) = 9678, but I see 9686. On both side there is a MTU set to 9706 which maximum value for the interface which I am using.

I run command:

ping -D -s $((**9706**-28)) 192.11.14.28
PING u1428-11 (190.11.14.28): 9678 data bytes
**9686** bytes from 192.11.14.28: icmp_seq=0 ttl=64 time=0.249 ms
**9686** bytes from 192.11.14.28: icmp_seq=1 ttl=64 time=0.421 ms

And check tpcdump:

tcpdump -nevvvi mlnx0
192.11.14.29 > 192.11.14.28: ICMP echo request, id 23329, seq 1, length **9686**
11:41:35.881615 3a:db:46:ce:e8:b7 > 52:54:00:7d:3d:59, ethertype 802.1Q (0x8100), length 9724: vlan 100, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ICMP (1), length 9706)

已采纳解答

原帖链接 · Michael Hampton · CC BY-SA 4.0

The packet size you pass to the ping command does not include the 8 byte ICMP header, only the payload size. From the man page:

       -s packetsize
           Specifies the number of data bytes to be sent. The default is 56,
           which translates into 64 ICMP data bytes when combined with the 8
           bytes of ICMP header data.

Thus if you specify a payload size of 9678, the packet on the wire will be 9686 bytes.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2021-07-08)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。