ping 基于 ICMPv6 信息报文实现:
1)Echo Request(Type=128;Code=0;):用于发送到目标节点,以使目标节点立即发回 Echo Reply 应答报文;
2)Echo Reply(Type=129;Code=0;):当收到一个Echo Request报文时,ICMPv6会用Echo Reply报文响应;
/2_Network_Layer_Protocols/ICMPv6/1.Terms_and_Work_Details/ping_(ICMPv6)/pasted_image.png)
报文格式
Echo request
Frame 1: 118 bytes on wire (944 bits), 118 bytes captured (944 bits) on interface -, id 0
Ethernet II, Src: HuaweiTe_7d:28:b1 (00:e0:fc:7d:28:b1), Dst: HuaweiTe_64:0e:22 (00:e0:fc:64:0e:22)
Internet Protocol Version 6, Src: 2003::2, Dst: 2003::1
0110 .... = Version: 6
.... 0000 0000 .... .... .... .... .... = Traffic Class: 0x00 (DSCP: CS0, ECN: Not-ECT)
.... 0000 00.. .... .... .... .... .... = Differentiated Services Codepoint: Default (0)
.... .... ..00 .... .... .... .... .... = Explicit Congestion Notification: Not ECN-Capable Transport (0)
.... .... .... 0000 0000 0000 0000 0000 = Flow Label: 0x00000
Payload Length: 64
Next Header: ICMPv6 (58)
Hop Limit: 64
Source Address: 2003::2
Destination Address: 2003::1
Internet Control Message Protocol v6
Type: Echo (ping) request (128)
Code: 0
Checksum: 0x99d9 [correct]
[Checksum Status: Good]
Identifier: 0xd2ab
Sequence: 256
[Response In: 2]
Data (56 bytes)
Data: c4b91800696e6973747261746976656c000102030405060708090a0b0c0d0e0f10111213…
[Length: 56]
Echo reply
Frame 2: 118 bytes on wire (944 bits), 118 bytes captured (944 bits) on interface -, id 0
Ethernet II, Src: HuaweiTe_64:0e:22 (00:e0:fc:64:0e:22), Dst: HuaweiTe_7d:28:b1 (00:e0:fc:7d:28:b1)
Internet Protocol Version 6, Src: 2003::1, Dst: 2003::2
0110 .... = Version: 6
.... 0000 0000 .... .... .... .... .... = Traffic Class: 0x00 (DSCP: CS0, ECN: Not-ECT)
.... 0000 00.. .... .... .... .... .... = Differentiated Services Codepoint: Default (0)
.... .... ..00 .... .... .... .... .... = Explicit Congestion Notification: Not ECN-Capable Transport (0)
.... .... .... 0000 0000 0000 0000 0000 = Flow Label: 0x00000
Payload Length: 64
Next Header: ICMPv6 (58)
Hop Limit: 64
Source Address: 2003::1
Destination Address: 2003::2
Internet Control Message Protocol v6
Type: Echo (ping) reply (129)
Code: 0
Checksum: 0x98d9 [correct]
[Checksum Status: Good]
Identifier: 0xd2ab
Sequence: 256
[Response To: 1]
[Response Time: 0.000 ms]
Data (56 bytes)
Data: c4b91800696e6973747261746976656c000102030405060708090a0b0c0d0e0f10111213…
[Length: 56]