Standards/Ethernet/Ping

From UIT
Jump to: navigation, search

Contents

Frame examples

Ping echo request

Typing in a terminal:

ping -c 1 -s 10 -p 0102 192.168.2.128

creates the frame:

00 0c 29 7d ae c7 00 50 56 c0 00 08 08 00 45 00
00 26 ba 96 00 00 40 01 3a 6f c0 a8 02 01 c0 a8
02 80 08 00 ee dd 12 04 00 00 56 dd 33 e1 00 01
6b 5c 01 02

This frame contains the Ethernet header, with destination and source MAC addresses and IP Ethertype (0800):

00 0c 29 7d ae c7 00 50 56 c0 00 08 08 00

the IP header with protocol 01:

                                          45 00
00 26 ba 96 00 00 40 01 3a 6f c0 a8 02 01 c0 a8
02 80

an ICMP header with echo request (0800) type:

      08 00 ee dd 12 04 00 00

and 10 bytes data:

                              56 dd 33 e1 00 01
6b 5c 01 02

The first 8 data bytes provide an identifier and a sequence number. The last 2 bytes come from the pattern requested in the ping command.

Ping echo reply

The previous echo request receives as answer:

00 50 56 c0 00 08 00 0c 29 7d ae c7 08 00 45 00
00 26 fa 0b 00 00 80 01 ba f9 c0 a8 02 80 c0 a8
02 01 00 00 f6 dd 12 04 00 00 56 dd 33 e1 00 01
6b 5c 01 02

The ICMP header now has echo reply code (0000). It provides the same data as the echo request message.

ICMP header

byte\bit offset 0 – 7 8 – 15
0 Type Code
2 Checksum

Type and code

The ICMP control messages are specified by a type and a code which serves as a subtype.

For ping, we have:

Checksum

The checksum is the 16-bit ones's complement of the one's complement sum of the ICMP message starting with the ICMP Type. For computing the checksum , the checksum field is set to zero. If the total length is odd, the data is padded with one octet of zeros for computing the checksum.

Personal tools
Namespaces
Variants
Actions
Navigation
Browse
Toolbox