使用 Wireshark 選取你要抓包的網絡接口,並設置你的過濾器之后,當有數據通信后即可抓到對應的數據包,這里將分析其每一幀數據包的結構。
-
每一幀數據都有類似的結構組成,我這里使用抓到一個對應的ping 包進行分析。
-
這一幀包包含以下四種信息.
- Frame: 物理層的數據幀情況。
- Ethernet II , Src: 數據鏈路層以太網幀頭部信息。
- Internet Protocol Version 4, Src: 互聯網層IP包頭信息。
- Internet Control Message Protocol: 互聯網控制信息協議。ping 小包所使用的協議。
- 前三層基本上都是一樣的,第四層開始就可以出現TCP, UDP 協議,第五層就可能有HTTP 應用層協議等等。
-
第一層 : Frame: 物理層的數據幀概況
Frame 715: 98 bytes on wire (784 bits), 98 bytes captured (784 bits) on interface 0
//第715幀,有98個字節在線上,共784位,實際捕獲到784字節在0接口
Interface id: 0 (\Device\NPF_{B67BEA54-B193-42D8-9DA9-11312F90107A}) //接口ID:0
Encapsulation type: Ethernet (1) //封裝類型
Arrival Time: Mar 22, 2017 13:30:44.053763000 中國標准時間 //到達時間
Time shift for this packet: 0.000000000 seconds //包偏移時間,不懂。。.
Epoch Time: 1490160644.053763000 seconds //有可能是1990 到現在的時間
Time delta from previous captured frame: 0.000349000 seconds//兩幀之間的時間間隔
Time delta from previous displayed frame: 0.000000000 seconds//捕獲到顯示的間隔時間
Time since reference or first frame: 274.038861000 seconds //此包和第一幀的時間間隔
Frame Number: 715 //幀號
Frame Length: 98 bytes (784 bits) //幀長度
Capture Length: 98 bytes (784 bits) //捕獲的幀長度
Frame is marked: False //幀顯著標志
Frame is ignored: False //幀忽略標志
Protocols in frame: eth:ethertype:ip:icmp:data //幀內封裝的協議層次結構
Coloring Rule Name: ICMP //着色標記的協議
Coloring Rule String: icmp || icmpv6 //着色規則顯示的字符串
- 第二層: Ethernet II , Src: 數據鏈路層以太網幀頭部信息。
Ethernet II, Src: TexasIns_ce:a9:4b (68:c9:0b:ce:a9:4b), Dst: AplexTec_0d:4e (40:d8:55:16:ad:4e)
// 源MAC地址:TexasIns_ce:a9:4b (68:c9:0b:ce:a9:4b)
//目標MAC地址:AplexTec_0d:4e (40:d8:55:16:ad:4e)
Destination: AplexTec_0d:4e (40:d8:55:16:ad:4e) //目的MAC地址
Source: TexasIns_ce:a9:4b (68:c9:0b:ce:a9:4b) //源MAC地址
- 第三層: Internet Protocol Version 4, Src: 以太網協議層
Internet Protocol Version 4, Src: 192.168.0.199, Dst: 192.168.0.192
// IPv4 協議 源IP:192.168.0.199, 目的IP:192.168.0.192
0100 .... = Version: 4 // 版本4
.... 0101 = Header Length: 20 bytes (5) // 頭長度20字節
Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT) //差分服務區域
0000 00.. = Differentiated Services Codepoint: Default (0) // 差分服務字段
.... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0)
//明確的阻塞指示
Total Length: 84 // 總長度
Identification: 0x0000 (0) // 鑒別
Flags: 0x02 (Don't Fragment) // 標志
0... .... = Reserved bit: Not set // 保留位
.1.. .... = Don't fragment: Set // 不要分離碎片
..0. .... = More fragments: Not set // 分離
Fragment offset: 0 // 分的偏移量
Time to live: 64 // 生存期
Protocol: ICMP (1) // 協議名稱
Header checksum: 0xb7d1 [validation disabled] // 頭部校驗和
Header checksum status: Unverified // 頭部校驗和檢驗狀態:
Source: 192.168.0.199 // 源IP
Destination: 192.168.0.192 // 目的地IP
Source GeoIP: Unknown // 源的 基於IP 查詢地理位置 Geo IP: Geolocation IP
Destination GeoIP: Unknown
- 第四層: UDP, TCP, ICMP, 等等協議層
// 這里面描述了這些協議獨有的東西:
// ping 小包一般所使用的就是這種協議進行傳輸數據
Internet Control Message Protocol // 因特網控制信息協議
Type: 8 (Echo (ping) request) // 類型,ping 請求
Code: 0
Checksum: 0x6eb9 [correct] // 和校驗
Checksum Status: Good // 和檢驗狀態
Identifier (BE): 59906 (0xea02) // 標識符
Identifier (LE): 746 (0x02ea) // 標識符
Sequence number (BE): 5 (0x0005) // BE 序列號
Sequence number (LE): 1280 (0x0500) //LE 序列號
Data (56 bytes) // 數據
// ... ...