Computer Hope

Internet & Networking => Networking => Topic started by: Zaeem on September 12, 2011, 05:23:59 AM

Title: Ping Command Output
Post by: Zaeem on September 12, 2011, 05:23:59 AM
If we are pinging with 56 bytes, why does it show 64 bytes when actually pinging?

PING www.example.com (192.0.43.10) 56(84) bytes of data.
64 bytes from 43-10.any.icann.org (192.0.43.10): icmp_seq=1 ttl=250 time=80.5 ms

Similarly here:

PING localhost (127.0.0.1) 100(128) bytes of data.
108 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.022 ms

Why is it showing 108 bytes instead of 100 bytes?
Title: Re: Ping Command Output
Post by: Geek-9pm on September 12, 2011, 10:27:45 AM
Is tis a quiz?
Title: Re: Ping Command Output
Post by: Salmon Trout on September 12, 2011, 11:11:38 AM
If we are pinging with 56 bytes, why does it show 64 bytes when actually pinging?

PING www.example.com (192.0.43.10) 56(84) bytes of data.
64 bytes from 43-10.any.icann.org (192.0.43.10): icmp_seq=1 ttl=250 time=80.5 ms

Similarly here:

PING localhost (127.0.0.1) 100(128) bytes of data.
108 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.022 ms

Why is it showing 108 bytes instead of 100 bytes?

All ICMP packets have an 8 byte header and variable sized data section. The first 4 bytes of the header will be consistent. The first byte is for the ICMP type. The second byte is for the ICMP code. The third and fourth bytes are a checksum of the entire ICMP message. The contents of the remaining 4 bytes of the header will vary based on the ICMP type and code. In this case (ICMP echo request and replies), they will be composed of identifier (16 bits) and sequence number (16 bits).