QinQ Principles
This section describes principles of QinQ.
Basic Principles
QinQ technology expands the VLAN space by adding another 802.1Q VLAN tag to a frame with an 802.1Q tag. QinQ technology converts single-tagged packets into double-tagged packets. The QinQ packet encapsulation format is as follows.
Format of a QinQ Frame
A QinQ frame has a fixed format, that is, the 802.1Q tag with another 802.1Q tag. A QinQ frame has four more bytes than an 802.1Q frame.
QinQ Encapsulation
QinQ technology converts single-tagged packets into double-tagged packets.
QinQ is classified into basic QinQ and selective QinQ depending on encapsulation data. Basic QinQ refers to interface-based QinQ, and selective QinQ includes VLAN ID-based QinQ and MQC-based QinQ.
Interface-based QinQ
Interface-based QinQ, also called QinQ tunneling, encapsulates the same outer VLAN tag to all Ethernet frames entering an interface. This encapsulation mode is inflexible and cannot distinguish users in fine-grained manner.
VLAN ID-based QinQ
VLAN ID-based QinQ encapsulates different outer tags into user packets to differentiate users. This encapsulation is also called selective QinQ.
MQC-based QinQ
MQC-based QinQ classifies traffic and encapsulates the outer tag of matching data flows. This encapsulation is also called selective QinQ.
Basic QinQ
- If the received packet carries one VLAN tag, the packet then has double tags.
- If the received packet does not carry any VLAN tag, the packet then carries the default VLAN tag of an interface.
Selective QinQ
- VLAN ID-based selective QinQ: adds different outer VLAN tags to packets with different inner VLAN IDs.
- MQC-based selective QinQ: adds different outer tags to packets based on QoS policies. MQC-based selective QinQ implements differentiated services.
Differences between basic QinQ and selective QinQ are as follows:
Basic QinQ: adds the same outer tag to all the frames arriving at the Layer 2 QinQ interface.
Selective QinQ: adds different outer tags to the frames with inner VLAN tags or frames matching traffic classification rules. VLAN assignment is more accurate.
TPID
Tag Protocol Identifier (TPID), a field in a VLAN tag, specifies the protocol type of the tag. The TPID value defined in IEEE 802.1Q is 0x8100.
Figure 5-66 shows the Ethernet frame format defined in IEEE 802.1Q. The 802.1Q Tag field locates between the Source Address (SA) and Length/Type fields. The device determines whether packets carry the VLAN tag according to the TPID. When an interface receives a packet, the interface compares the TPID of the device with that in the packet. If they are the same, the packet carries the VLAN tag. If they are different, the packet does not carry the VLAN tag.
To implement interworking between QinQ-capable devices of different vendors, devices of different vendors use 0x8100 as the inner TPID value but may use different values for the outer TPID. You can set the TPID value in outgoing QinQ packets on the device to be the same as the TPID value used by devices from other vendors so that the device can communicate with these devices.