IP in IP报文格式
IP in IP是指使用IPv4报文封装IPv4报文。IPinIP报文的内、外层IPv4头部格式与普通IPv4头部格式相同。
一、IP in IP报文格式
0 3 7 15 23 31
+---------------------------------------------------------------+
|Version| IHL |Type of Service| Total Length |
+---------------------------------------------------------------+
| Identification | Flags | Fragment Offset |
+---------------------------------------------------------------+
| Time to Live | Protocol | Header Checksum |
+---------------------------------------------------------------+
| Source Address |
+---------------------------------------------------------------+
| Destination Address |
+---------------------------------------------------------------+
| Options | Options |
+---------------------------------------------------------------+
二、IP in IP报文外层IP头的设置规则
字段 | 含义 |
---|---|
Version | 设置为4。 |
IHL | 指外层IP头部长度,以32比特为计算单位。 |
Type of Service | 从内层IP头部复制。 |
Total Length | 指整个IP负载的长度,包括外层IP头,内层IP头和IP负载。 |
Identification, Flags, Fragment Offset | 这三个字段的含义与RFC791的定义相同。注意,如果内层IP头部的DF位置位,外层IP头部的DF位也必须置位。如果内层IP头的DF未置位,外层IP头部的DF位可以置位也可以不置位。 |
Time to Live | 外层IP头部的TTL域设置为发送该数据包到隧道目的端的合适的值。 |
Protocol | 设置为4。 |
Header Checksum | 外层IP头部的校验字段。 |
Source Address | 执行该IPinIP隧道头封装的隧道入口设备的IP地址。 |
Destination Address | 执行该IPinIP隧道头解封装的隧道出口设备的IP地址。 |
Options | 内层IP头部的任何选项字段通常不被复制到外层IP头部。隧道路径上的设备可以添加新的选项字字段。内层IP头部的安全选项字段的类型可能影响外层IP头部的安全选项字段的选择。 |
三、IP in IP报文报文示例
Frame 1: 134 bytes on wire (1072 bits), 134 bytes captured (1072 bits)
Arrival Time: Jun 21, 2008 20:12:06.059907000
Epoch Time: 1214050326.059907000 seconds
[Time delta from previous captured frame: 0.000000000 seconds]
[Time delta from previous displayed frame: 0.000000000 seconds]
[Time since reference or first frame: 0.000000000 seconds]
Frame Number: 1
Frame Length: 134 bytes (1072 bits)
Capture Length: 134 bytes (1072 bits)
[Frame is marked: False]
[Frame is ignored: False]
[Protocols in frame: eth:ip:ip:icmp:data]
[Coloring Rule Name: ICMP]
[Coloring Rule String: icmp || icmpv6]
Ethernet II, Src: c2:00:57:75:00:00 (c2:00:57:75:00:00), Dst: c2:01:57:75:00:00 (c2:01:57:75:00:00)
Destination: c2:01:57:75:00:00 (c2:01:57:75:00:00)
Address: c2:01:57:75:00:00 (c2:01:57:75:00:00)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
.... ..1. .... .... .... .... = LG bit: Locally administered address (this is NOT the factory default)
Source: c2:00:57:75:00:00 (c2:00:57:75:00:00)
Address: c2:00:57:75:00:00 (c2:00:57:75:00:00)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
.... ..1. .... .... .... .... = LG bit: Locally administered address (this is NOT the factory default)
Type: IP (0x0800)
Internet Protocol Version 4, Src: 10.0.0.1 (10.0.0.1), Dst: 10.0.0.2 (10.0.0.2)
Version: 4
Header length: 20 bytes
Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00: Not-ECT (Not ECN-Capable Transport))
0000 00.. = Differentiated Services Codepoint: Default (0x00)
.... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable Transport) (0x00)
Total Length: 120
Identification: 0x0014 (20)
Flags: 0x00
0... .... = Reserved bit: Not set
.0.. .... = Don't fragment: Not set
..0. .... = More fragments: Not set
Fragment offset: 0
Time to live: 255
Protocol: IPIP (4)
Header checksum: 0xa76b [correct]
[Good: True]
[Bad: False]
Source: 10.0.0.1 (10.0.0.1)
Destination: 10.0.0.2 (10.0.0.2)
Internet Protocol Version 4, Src: 10.1.1.1 (10.1.1.1), Dst: 10.2.2.2 (10.2.2.2)
Version: 4
Header length: 20 bytes
Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00: Not-ECT (Not ECN-Capable Transport))
0000 00.. = Differentiated Services Codepoint: Default (0x00)
.... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable Transport) (0x00)
Total Length: 100
Identification: 0x0014 (20)
Flags: 0x00
0... .... = Reserved bit: Not set
.0.. .... = Don't fragment: Not set
..0. .... = More fragments: Not set
Fragment offset: 0
Time to live: 255
Protocol: ICMP (1)
Header checksum: 0xb57f [correct]
[Good: True]
[Bad: False]
Source: 10.1.1.1 (10.1.1.1)
Destination: 10.2.2.2 (10.2.2.2)
Internet Control Message Protocol
Type: 8 (Echo (ping) request)
Code: 0
Checksum: 0x4305 [correct]
Identifier (BE): 4 (0x0004)
Identifier (LE): 1024 (0x0400)
Sequence number (BE): 0 (0x0000)
Sequence number (LE): 0 (0x0000)
Data (72 bytes)
Data: 0000000000093b38abcdabcdabcdabcdabcdabcdabcdabcd...
[Length: 72]
四、IP in IP封装协议栈结构
+-------------------------------------+
| Inner IPv4 payload |
+-------------------------------------+
| Inner IPv4 header |
+-------------------------------------+
| Outer IPv4 header (Protocol = 0x04) |
+-------------------------------------+
| L2 |
+-------------------------------------+
| L1 |
+-------------------------------------+
发表评论