Packet sizes for ping and traceroute
Why is a ping packet's data length 32 while a traceroute packet's data length is 64 bytes? Is there any reason for that? Or are there any advantages for this difference?
The reality is a bit more complicated:
-
Both ping and traceroute have options to modify packet size:
ping's option modifies the payload size, e.g. running
ping -s 1 www.google.com
will ping google with 29 byte total packet (20 bytes IP header + 8 bytes ICMP header + 1 byte data).tracerote's option modifies the total size, e.g. running
traceroute www.google.com 80
will send UDP packets with the total size of 80 bytes (20 bytes IP header + 8 bytes UDP + 52 bytes data).
Different versions of ping and traceroute have different defaults. However, they all are in sub-100 byte range, and the exact number of bytes is not important. If your ping's default is 32, then the total size of a packet is 60 bytes, not much different from your traceroute's.
Total size of a packet may differ depending if you're using IPv4 or IPv6, IP options set, etc.
The most common reason to increase both ping's and traceroute's packet size is to debug MTU problems, other then that, the defaults work just fine.