专注电子技术学习与研究
当前位置:单片机教程网 >> MCU设计实例 >> 浏览文章

关于icmp报文解码

作者:刘温电   来源:本站原创   点击数:  更新时间:2013年11月24日   【字体:

最近在写tcp/ip的下位机,所以学了不少关于网络和协议的东西。总体上来说,很复杂。不过还是有据可循的。

这是通过wireshark抓包得到的

这是一个简单的ping命令,得到的数据。

Frame 207: 74 bytes on wire (592 bits), 74 bytes captured (592 bits) 线路上传输了74字节,实际接收74个字节

 

Arrival Time: Jan  1, 2000 08:09:10.326362000 中国标准时间 时间

Epoch Time: 946685350.326362000 seconds 包间隔时间

Time delta from previous captured frame: 0.087277000 seconds

Time delta from previous displayed frame: 0.087277000 seconds

Time since reference or first frame: 12.473428000 seconds

Frame Number: 207

Frame Length: 74 bytes (592 bits) 帧长度

Capture Length: 74 bytes (592 bits) 捕获长度

Frame is marked: False

Frame is ignored: False

Protocols in frame: eth:ip:icmp:data 协议层级

Coloring Rule Name: ICMP 包含协议

Coloring Rule String: icmp || icmpv6

 

Ethernet II, Src: D-Link_60:3b:42 (f0:7d:68:60:3b:42), Dst: Tp-LinkT_4f:6f:f2 (94:0c:6d:4f:6f:f2)

mac地址                               目标mac地址

Destination: Tp-LinkT_4f:6f:f2 (94:0c:6d:4f:6f:f2)

Address: Tp-LinkT_4f:6f:f2 (94:0c:6d:4f:6f:f2)

.... ...0 .... .... .... .... = IG bit: Individual address (unicast)

. ... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)

Type: IP (0x0800) ip类型

 

Internet Protocol, Src: 192.168.1.111 (192.168.1.111), Dst: 192.168.1.1 (192.168.1.1)

ip地址                 目标ip地址

Version: 4     版本号

Header length: 20 bytes     头字节长度

Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00) 差分服务字段

0000 00.. = Differentiated Services Codepoint: Default (0x00)

.... ..0. = ECN-Capable Transport (ECT): 0

.... ...0 = ECN-CE: 0

Total Length: 60 IP包长度

Identification: 0x31e7 (12775) 标志字段 不一样,具体为什么不知道

Flags: 0x00 标记字段

Fragment offset: 0 分段偏移

Time to live: 64 生存期

Protocol: ICMP (1) 包内封装协议

Header checksum: 0xc519 [correct] 头校验

Source: 192.168.1.111 (192.168.1.111) ip

Destination: 192.168.1.1 (192.168.1.1) 目标ip

 

 

Internet Control Message Protocol

 

Type: 8 (Echo (ping) request) 类型:请求

Code: 0 代码:0

Checksum: 0x495c [correct] 校验

Identifier: 0x0300 标识码

Sequence number: 256 (0x0100) 序列码,应该是ping一次加一次

Sequence number (LE): 1 (0x0001)

Data (32 bytes) 数据

Data: 6162636465666768696a6b6c6d6e6f707172737475767761...

Length: 32

 

 

 

mac地址    目标mac地址         ip类型     版本与字节数

94  0c  6d  4f  6f  f2      f0  7d  68  60  3b  42       08  00          45  00 

Ip包长     标志段     标记 偏移  生存期  icmp包  头检验   源ip    

00  3c       31  e7           00      00      40          01          c5  19       c0  a8  01  6f  

目标ip          类型     校验   标识码   序列码         数据

c0  a8 01  01  08     00    49  5c    03  00     01  00      61  62  63  64  65  66

   

67  68  69  6a  6b  6c  6d  6e  6f  70  71  72  73  74  75  76

   

77  61  62  63  64  65  66  67  68  69            

关闭窗口

相关文章