Ping - specifying size

When issuing the ping command on a Cisco IOS device, there are some extended commands that allow you to specify the size of the packet being sent. This can be done by either explicitly specifying the size or by using the sweep feature.

The size specified indicates the ICMP payload and does not take into account various headers and other overhead:

Understanding the Headers

  1. ICMP Payload:

    • When you specify a packet size for a ping command, that value represents the size of the payload that will be used by the ICMP packet.
  2. ICMP Header:

    • The ICMP header itself is 8 bytes.
  3. IP Header:

    • The IP header is 20 bytes (for IPv4 without options).
  4. Ethernet header:

    • The Ethernet header adds another 14 bytes.

Calculating the Actual Packet Size

For an ICMP packet, the total size over the wire will be:

  • IP Header (20 bytes) + ICMP Header (8 bytes) + ICMP Payload (specified size) = Total IP Packet Size

  • Then, add the Ethernet Header:

    Ethernet Header (14 bytes) + Total IP Packet Size = Total Ethernet Frame Size

Example

If you issue a ping with a size of 100 bytes on a Cisco router:

  • The ICMP payload would be 100 bytes.
  • The ICMP header adds 8 bytes.
  • The IP header adds another 20 bytes.

So, the total IP packet size would be:

20 (IP Header) + 8 (ICMP Header) + 100 (Payload) = 128 bytes

Now, adding the Ethernet header:

14 (Ethernet Header) + 128 (IP Packet Size) = 142 bytes

Thus, the total Ethernet frame size will be 142 bytes on the wire.

Important Points to Remember

  1. Ping Payload Size: When you set the size in a Cisco ping command (e.g., ping 192.168.1.1 size 100), you are only specifying the ICMP payload size, not the total packet size.

  2. MTU Consideration: If you want to test MTU or end-to-end packet sizes, take into account the overhead introduced by these headers. For example, if you need to test with a 1500-byte MTU, you should set the ping payload size to 1472 bytes to account for the 28-byte overhead (20 bytes IP + 8 bytes ICMP).