專注電子技術(shù)學(xué)習(xí)與研究
當(dāng)前位置:單片機教程網(wǎng) >> MCU設(shè)計實例 >> 瀏覽文章

關(guān)于icmp報文解碼

作者:劉溫電   來源:本站原創(chuàng)   點擊數(shù):  更新時間:2013年11月24日   【字體:

最近在寫tcp/ip的下位機,所以學(xué)了不少關(guān)于網(wǎng)絡(luò)和協(xié)議的東西。總體上來說,很復(fù)雜。不過還是有據(jù)可循的。

這是通過wireshark抓包得到的

這是一個簡單的ping命令,得到的數(shù)據(jù)。

Frame 207: 74 bytes on wire (592 bits), 74 bytes captured (592 bits) 線路上傳輸了74字節(jié),實際接收74個字節(jié)

 

Arrival Time: Jan  1, 2000 08:09:10.326362000 中國標(biāo)準(zhǔn)時間 時間

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 協(xié)議層級

Coloring Rule Name: ICMP 包含協(xié)議

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地址                               目標(biāo)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地址                 目標(biāo)ip地址

Version: 4     版本號

Header length: 20 bytes     頭字節(jié)長度

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

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

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

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

Total Length: 60 IP包長度

Identification: 0x31e7 (12775) 標(biāo)志字段 不一樣,具體為什么不知道

Flags: 0x00 標(biāo)記字段

Fragment offset: 0 分段偏移

Time to live: 64 生存期

Protocol: ICMP (1) 包內(nèi)封裝協(xié)議

Header checksum: 0xc519 [correct] 頭校驗

Source: 192.168.1.111 (192.168.1.111) ip

Destination: 192.168.1.1 (192.168.1.1) 目標(biāo)ip

 

 

Internet Control Message Protocol

 

Type: 8 (Echo (ping) request) 類型:請求

Code: 0 代碼:0

Checksum: 0x495c [correct] 校驗

Identifier: 0x0300 標(biāo)識碼

Sequence number: 256 (0x0100) 序列碼,應(yīng)該是ping一次加一次

Sequence number (LE): 1 (0x0001)

Data (32 bytes) 數(shù)據(jù)

Data: 6162636465666768696a6b6c6d6e6f707172737475767761...

Length: 32

 

 

 

mac地址    目標(biāo)mac地址         ip類型     版本與字節(jié)數(shù)

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

Ip包長     標(biāo)志段     標(biāo)記 偏移  生存期  icmp包  頭檢驗   源ip    

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

目標(biāo)ip          類型     校驗   標(biāo)識碼   序列碼         數(shù)據(jù)

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            

關(guān)閉窗口

相關(guān)文章