QinQ报文帧格式
QinQ是对802.1Q(VLAN)的扩展,其核心思想是将用户私网VLAN tag封装到公网VLAN tag中,报文带着两层tag穿越服务商的骨干网络,从而为用户提供一种较为简单的二层VPN隧道。QinQ报文有固定的格式,就是在802.1Q的标签之上再打一层802.1Q标签,QinQ报文比802.1Q(VLAN)报文多4字节。
一、 QinQ报文帧格式
+-----------+-----------+-----------+-----------+-------------+------------------+----------+
| DMAC | SMAC | ETPE | TAG | LEN/ETYPE | Data | FCS |
| 6 Bytes | 6 Bytes | 2 Bytes | 2 Bytes | 2 Bytes | Variable length | 4 Bytes |
+-----------+-----------+-----------+-----------+-------------+------------------+----------+
| |
| | |
| | |
| | |
| | |
+-----------+-----------+-----------+-----------+-----------+-----------+-------------+------------------+----------+
| DMAC | SMAC | ETPE | TAG | ETPE | TAG | LEN/ETYPE | Data | FCS |
| 6 Bytes | 6 Bytes | 2 Bytes | 2 Bytes | 2 Bytes | 2 Bytes | 2 Bytes | Variable length | 4 Bytes |
+-----------+-----------+-----------+-----------+-----------+-----------+-------------+------------------+----------+
| | |
| | |
| | |
| | |
+-----------+--------------+---------+--------------+
| 0x8100 | Priority | CFI | VLAN ID |
|
字段 |
长度 |
含义 |
|
DMAC |
6字节 |
目的MAC地址,该字段标识帧的接收者。 |
|
SMAC |
6字节 |
源MAC地址,该字段标识帧的发送者。 |
|
TPID |
2字节 |
TPID(Tag Protocol Identifier,标签协议标识)表示帧类型。取值为0x8100时表示802.1Q Tag帧。如果不支持802.1Q的设备收到这样的帧,会将其丢弃。 对于内层的802.1Q Tag,该值设置为0x8100;对于外层的802.1Q Tag,不同厂商所使用的值可能不相同: · 0x8100:Huawei路由器使用 · 0x88A8:802.1ad规定外层802.1Q Tag中的TPID为0x88a8 · 0x9100:Juniper路由器使用 · 0x9200:Several路由器使用 在使用VRP®(Versatile Routing Platform)软件的华为设备上,外层802.1Q Tag缺省情况下值为0x8100,可以通过命令行调整该值。 |
|
PRI |
3比特 |
Priority,长度为3比特,表示帧的优先级,取值范围为0~7,值越大优先级越高。当网络拥塞时,优先级高的数据包优先发送。 |
|
CFI/DEI |
1比特 |
CFI (Canonical Format Indicator,标准格式指示),长度为1比特,表示MAC地址是否是标准格式。CFI为0说明是标准格式(以太网帧的MAC地址采用低字节在前),CFI为1表示为非标准格式(以太网帧的MAC地址采用高字节在前)。CFI可用于区分以太网帧、FDDI(Fiber Distributed Digital Interface)帧和令牌环网帧。在以太网中,CFI的值为0。 DEI(Drop Eligible Indicator,丢弃优先级指示),配合PRI字段使用,共同指示帧的丢弃优先级,也就是系统发生了拥塞时,这些报文会被优先丢弃。 说明: IEEE 802.1Q定义了CFI字段,而IEEE 802.1ad标准重新定义了CFI字段,规定S-Tag里面的是DEI,C-Tag里面的是CFI。 实际应用中,可以根据需要将此比特位用作CFI或者用作DEI。 |
|
VID |
12比特 |
VID(LAN ID),长度为12比特,表示该帧所属的VLAN。在使用VRP®(Versatile Routing Platform)软件的华为设备上,可配置的VLAN ID取值范围为1~4094。协议规定0和4095为保留的VLAN ID。 |
|
Length/Type |
2字节 |
该字段有两种含义: · Length:如果该字段值小于或等于二进制1500(或十六进制0x05DC)时,该字段指后续数据的字节长度,但不包括FCS字段。 · Type:如果该字段值大于或等于二进制1536(或十六进制0x0600)时,该字段指链路直接封装的上层协议类型。 |
|
Data |
-38~1500字节 |
QinQ帧的负载(可能包含填充位)。 QinQ帧的长度必须为整数字节,因此帧的负载长度不足整数字节,需插入填充字段以保证数据帧的长度为整数字节。 说明: IEEE 802.1Q和IEEE 802.1ad标准中并没有定义QinQ帧的最小长度和最大长度。 |
|
CRC |
4字节 |
帧校验序列FCS(Frame Check Sequence)是为接收网卡提供判断是否传输错误的一种方法,如果发现错误,丢弃此帧。 FCS只是通用叫法,具体的FCS还可以细分多种校验方法。在以太帧中,FCS通常采用循环冗余码校验CRC(Cyclical Redundancy Check)。 |
二、QinQ报文帧示例
Frame 1: 391 bytes on wire (3128 bits), 391 bytes captured (3128 bits)
Arrival Time: Nov 17, 2011 18:52:25.161695000
Epoch Time: 1321527145.161695000 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: 391 bytes (3128 bits)
Capture Length: 391 bytes (3128 bits)
[Frame is marked: False]
[Frame is ignored: False]
[Protocols in frame: eth:ip:udp:bootp]
[Coloring Rule Name: UDP]
[Coloring Rule String: udp]
Ethernet II (VLAN tagged), Src: HuaweiTe_75:ad:21 (54:89:98:75:ad:21), Dst: RealtekS_88:35:39 (00:e0:4c:88:35:39)
Destination: RealtekS_88:35:39 (00:e0:4c:88:35:39)
Address: RealtekS_88:35:39 (00:e0:4c:88:35:39)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
Source: HuaweiTe_75:ad:21 (54:89:98:75:ad:21)
Address: HuaweiTe_75:ad:21 (54:89:98:75:ad:21)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
VLAN tag: VLAN=100, Priority=Controlled Load
Identifier: 802.1Q Virtual LAN (0x8100)
100. .... .... .... = Priority: Controlled Load (4)
...0 .... .... .... = CFI: Canonical (0)
.... 0000 0110 0100 = VLAN: 100
VLAN tag: VLAN=200, Priority=Controlled Load
Identifier: 802.1Q Virtual LAN (0x8100)
100. .... .... .... = Priority: Controlled Load (4)
...0 .... .... .... = CFI: Canonical (0)
.... 0000 1100 1000 = VLAN: 200
Type: IP (0x0800)
Internet Protocol Version 4, Src: 192.168.112.1 (192.168.112.1), Dst: 192.168.112.100 (192.168.112.100)
Version: 4
Header length: 20 bytes
Differentiated Services Field: 0x80 (DSCP 0x20: Class Selector 4; ECN: 0x00: Not-ECT (Not ECN-Capable Transport))
1000 00.. = Differentiated Services Codepoint: Class Selector 4 (0x20)
.... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable Transport) (0x00)
Total Length: 369
Identification: 0x8ab5 (35509)
Flags: 0x00
0... .... = Reserved bit: Not set
.0.. .... = Don't fragment: Not set
..0. .... = More fragments: Not set
Fragment offset: 0
Time to live: 16
Protocol: UDP (17)
Header checksum: 0xbc90 [correct]
[Good: True]
[Bad: False]
Source: 192.168.112.1 (192.168.112.1)
Destination: 192.168.112.100 (10.168.112.100)
User Datagram Protocol, Src Port: bootps (67), Dst Port: bootps (67)
Source port: bootps (67)
Destination port: bootps (67)
Length: 349
Checksum: 0x0000 (none)
[Good Checksum: False]
[Bad Checksum: False]
Bootstrap Protocol
Message type: Boot Request (1)
Hardware type: Ethernet
Hardware address length: 6
Hops: 1
Transaction ID: 0x7a31a29f
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
0... .... .... .... = Broadcast flag: Unicast
.000 0000 0000 0000 = Reserved flags: 0x0000
Client IP address: 0.0.0.0 (0.0.0.0)
Your (client) IP address: 0.0.0.0 (0.0.0.0)
Next server IP address: 0.0.0.0 (0.0.0.0)
Relay agent IP address: 100.1.1.1 (100.1.1.1)
Client MAC address: IntelCor_7b:75:58 (00:27:10:7b:75:58)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (t=53,l=1) DHCP Message Type = DHCP Discover
Option: (53) DHCP Message Type
Length: 1
Value: 01
Option: (t=116,l=1) DHCP Auto-Configuration = AutoConfigure
Option: (116) DHCP Auto-Configuration
Length: 1
Value: 01
Option: (t=61,l=7) Client identifier
Option: (61) Client identifier
Length: 7
Value: 010027107b7558
Hardware type: Ethernet
Client MAC address: IntelCor_7b:75:58 (00:27:10:7b:75:58)
Option: (t=50,l=4) Requested IP Address = 169.254.145.113
Option: (50) Requested IP Address
Length: 4
Value: a9fe9171
Option: (t=12,l=13) Host Name = "cda101059953g"
Option: (12) Host Name
Length: 13
Value: 63646131303130353939353367
Option: (t=60,l=8) Vendor class identifier = "MSFT 5.0"
Option: (60) Vendor class identifier
Length: 8
Value: 4d53465420352e30
Option: (t=55,l=11) Parameter Request List
Option: (55) Parameter Request List
Length: 11
Value: 010f03062c2e2f1f21f92b
1 = Subnet Mask
15 = Domain Name
3 = Router
6 = Domain Name Server
44 = NetBIOS over TCP/IP Name Server
46 = NetBIOS over TCP/IP Node Type
47 = NetBIOS over TCP/IP Scope
31 = Perform Router Discover
33 = Static Route
249 = Private/Classless Static Route (Microsoft)
43 = Vendor-Specific Information
Option: (t=43,l=2) Vendor-Specific Information
Option: (43) Vendor-Specific Information
Length: 2
Value: dc00
Option: (t=82,l=35) Agent Information Option
Option: (82) Agent Information Option
Length: 35
Value: 010c303330422d303030302d474502134855415745492d30...
Agent Circuit ID: 303330422d303030302d4745
Agent Remote ID: 4855415745492d303330422d303030302d4745
End Option
三、QinQ帧参考标准
|
标准 |
描述 |
|
RFC 3069 |
VLAN Aggregation for Efficient IP Address Allocation |
|
IEEE 802.1Q |
IEEE Standards for Local and Metropolitan Area Networks : Virtual Bridged Local Area Networks |
|
IEEE 802.1ad |
IEEE Standards for Local and Metropolitan Area Networks: Virtual Bridged Local Area Networks- Amendment 4 |

发表评论