Professional Documents
Culture Documents
01-06 QinQ Configuration
01-06 QinQ Configuration
01-06 QinQ Configuration
Switches
Configuration Guide - Ethernet Switching 6 QinQ Configuration
6 QinQ Configuration
Definition
QinQ expands VLAN space by adding an additional 802.1Q tag to 802.1Q tagged
packets. A packet carries two 802.1Q tags: a public VLAN tag and a private VLAN
tag.
Purpose
Ethernet is widely used on ISP networks, but 802.1Q VLANs are unable to identify
and isolate large numbers of users on metro Ethernet networks because the 12-bit
VLAN tag field defined in IEEE 802.1Q only identifies a maximum of 4096 VLANs.
QinQ was developed to expand VLAN space beyond 4096 VLANs so that a larger
number of users can be identified on a metro Ethernet network.
In addition to expanding VLAN space, QinQ is applied in other scenarios with the
development of metro Ethernet networks and carriers' requirements on refined
service operation. The outer and inner VLAN tags can be used to differentiate
packets based on users and services. For example, the inner tag represents a user,
while the outer tag represents a service. Moreover, QinQ is used as a simple and
practical virtual private network (VPN) technology because inner tags of QinQ
packets are transparently transmitted over a public network. It extends core
multiprotocol label switching (MPLS) VPN services to metro Ethernet networks to
establish an end-to-end VPN.
Benefits
QinQ offers the following benefits:
● Extends VLANs to isolate and identify more users.
● Facilitates service deployment by allowing the inner and outer tags to
represent different information. For example, use the inner tag to identify a
user and the outer tag to identify a service.
VLAN 4 VLAN 3
Customer Customer
network A network B
CE1 CE2
VLAN 1~10 VLAN 1~20
As shown in Figure 6-1, customer network A is divided into private VLANs 1 to 10,
and customer network B is divided into private VLANs 1 to 20. The carrier
allocates public VLANs 3 and 4 to customer networks A and B respectively. When
tagged packets from networks A and B arrive at the carrier network, the packets
are tagged outer VLANs 3 and 4. Therefore, the packets from different customer
networks are separated on the carrier network, even though the customer
networks use overlapping VLAN ranges. When the packets reach the PE on the
other side of the carrier network, the PE removes public VLAN tags from the
packets and forwards the packets to the CE of the respective customer network.
NOTE
Because a QinQ packet has 4 more bytes than an 802.1Q packet, the maximum frame
length allowed by each interface on the carrier network should be at least 1504 bytes. The
default frame length allowed by interfaces of a switch is larger than 1504 bytes, so you do
not need to adjust it. For details on how to configure the frame length allowed by an
interface, see Setting the Jumbo Frame Length Allowed on an Interface.
QinQ
Encapsulation
DA SA 802.1Q TAG 802.1Q TAG LEN/ETYPE DATA FCS
6 Bytes 6 Bytes 4 Bytes 4 Bytes 2 Bytes 46 Bytes~1500 Bytes 4 Bytes
QinQ Implementation
QinQ can be implemented in either of the following ways:
1. Basic QinQ
Basic QinQ is implemented based on interfaces. After basic QinQ is
configured on an interface, the device adds the default VLAN tag of this
interface to all packets regardless of whether the packets carry VLAN tags.
– If a single-tagged packet is received, the packet becomes a double-
tagged packet.
– If an untagged packet is received, the packet is tagged with the default
VLAN ID of the local interface.
2. Selective QinQ
Selective QinQ is implemented based on interfaces and VLAN IDs. That is, an
interface can forward packets based on a single VLAN tag or double VLAN
tags. In addition, the device processes packets received on an interface as
follows based on their VLAN IDs:
– Adds different outer VLAN tags to packets carrying different inner VLAN
IDs.
– Marks outer 802.1p fields and adds different outer VLAN tags to packets
according to the 802.1p fields in inner VLAN tags.
In addition to separating carrier and customer networks, selective QinQ
provides extensive service features and allows flexible networking.
QinQ Encapsulation
QinQ technology converts single-tagged packets into double-tagged packets.
QinQ is classified into basic QinQ and selective QinQ depending on the data
encapsulated:
● Interface-based QinQ encapsulation
This encapsulation mode is also called QinQ tunneling. It encapsulates
packets arriving at the same interface with the same outer VLAN tag, and
therefore cannot distinguish users and services at the same time.
● VLAN ID-based QinQ encapsulation
VLAN ID-based QinQ encapsulation, also called selective QinQ, encapsulates
packets with different outer tags to differentiate users.
● MQC-based QinQ encapsulation
MQC-based QinQ encapsulation, also called selective QinQ, classifies traffic
and encapsulates outer tags of matching data flows.
● Selective QinQ: adds different outer tags to the frames with inner VLAN tags
or frames matching traffic classification rules. VLAN assignment is more
accurate.
6.2.4 TPID
The Tag Protocol Identifier (TPID) specifies the protocol type of a VLAN tag. The
TPID value defined in IEEE 802.1Q is 0x8100.
Figure 6-3 shows the Ethernet packet format defined in IEEE 802.1Q. An IEEE
802.1Q tag lies between the Source Address field and the Length/Type field. A
device determines whether packets carry the specified VLAN tag according to the
TPID. When an interface receives a packet, the device compares the configured
TPID 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.
SwicthA SwicthB
Interface3 Core/Backbone Interface3
network
Interface1 Interface2 Interface1 Interface2
Tenant 1 2 to 500 10
Configure QinQ on SwitchA and SwitchB so that tenants using the same service in
different branches are allowed to communicate and tenants using different
services need to be isolated.
● Configure SwitchA to encapsulate outer VLAN 10 to packets entering
Interface1 and outer VLAN 20 to packets entering Interface2.
● Configure SwitchB to encapsulate outer VLAN 10 to packets entering
Interface1 and outer VLAN 20 to packets entering Interface2.
● Configure Interface3 on SwitchA and SwitchB to allow packets from VLAN 10
and VLAN 20.
backbone network. To ensure service security and save VLAN IDs of the core/
backbone network, it is required that traffic in positions A and B be transmitted
through the core/backbone network, users using the same service be allowed to
communicate, and users using different services be isolated. You can configure
VLAN ID-based selective QinQ to meet the requirements.
Interface1 Interface1
User
User
VLAN10~
VLAN10~
VLAN50
VLAN50
Configure selective QinQ on SwitchA and SwitchB so that users using the same
service in different branches are allowed to communicate, and users using
different services are isolated.
● On SwitchA, add VLAN 100 to packets that have inner VLAN IDs 10 to 30 and
enter Interface1, and VLAN 200 to packets that have inner VLAN IDs 31 to 50
and enter Interface1.
● On SwitchB, add VLAN 100 to packets that have inner VLAN IDs 10 to 30 and
enter Interface1, and VLAN 200 to packets that have inner VLAN IDs 31 to 50
and enter Interface1.
● Configure Interface2 on SwitchA and SwitchB to allow packets from VLAN 100
and VLAN 200.
Licensing Requirements
QinQ is a basic function of the switch, and as such is controlled by the license for
basic software functions. The license for basic software functions has been loaded
and activated before delivery. You do not need to manually activate it.
Version Requirements
CE8860EI V100R006C00
CE8861EI/CE8868EI V200R005C10
CE8850-32CQ-EI V200R002C50
CE8850-64CQ-EI V200R005C00
CE7850EI V100R003C00
CE7855EI V200R001C00
CE6810EI V100R003C00
CE6810-48S4Q-LI/CE6810-48S- V100R003C10
LI
CE6810-32T16S4Q-LI/ V100R005C10
CE6810-24S2Q-LI
CE6850EI V100R001C00
CE6850-48S6Q-HI V100R005C00
CE6850-48T6Q-HI/CE6850U-HI/ V100R005C10
CE6851HI
CE6855HI V200R001C00
CE6856HI V200R002C50
CE6857EI V200R005C10
CE6860EI V200R002C50
CE6865EI V200R005C00
CE6870-24S6CQ-EI V200R001C00
CE6870-48S6CQ-EI V200R001C00
CE6870-48T6CQ-EI V200R002C50
CE6875-48S4CQ-EI V200R003C00
CE6880EI V200R002C50
CE5810EI V100R002C00
CE5850EI V100R001C00
CE5850HI V100R003C00
CE5855EI V100R005C10
CE5880EI V200R005C10
NOTE
For details about the mapping between software versions and switch models, see the
Hardware Query Tool.
Feature Limitations
● Selective QinQ based on the VLAN ID can be only enabled on hybrid or trunk
interfaces in the inbound direction.
● The outer VLAN ID must exist and the interface must be added to the outer
VLAN in untagged mode.
● The interface learns the MAC address in the VLAN specified by the outer
VLAN tag of packets.
● The MUX VLAN and selective QinQ based on the VLAN ID cannot be
configured on the same interface.
● If only single-tagged packets from a VLAN need to be transparently
transmitted, do not specify the VLAN as the inner VLAN for selective QinQ.
● If forwarding resources exceed the specifications, VLAN stacking can be
configured. However, after the device restarts, the invalid VLAN stacking
configuration may become valid and valid VLAN stacking configuration may
become invalid.
● If VLAN stacking is configured on an interface corresponding to the VLAN,
VBST negotiation for this VLAN will fail.
● QinQ cannot be used with features such as DHCP, ARP, and IGMP.
● Starting from V200R003C00, for the CE6875EI and CE6870EI, when original
packets carry two or three VLAN tags and the device is configured with IPv6
VXLAN and VLAN stacking, tags in forwarded packets are incorrect. Please
deploy VLAN stacking on the neighboring device.
● The original VLAN specified in the port vlan-stacking command cannot be
the same as the outer VLAN configured on a QinQ Layer 2 sub-interface.
● For the CE6857EI, CE6865EI, CE8861EI, and CE8868EI, no extra VLAN tag can
be added to the original double-tagged packets, even if VLAN stacking is
configured.
● M-LAG cannot be configured together with VLAN Mapping or VLAN Stacking.
Context
Basic QinQ enables the device to add a public tag to incoming packets so that
user packets can be forwarded on the public network. To separate private
networks from public networks and conserve VLAN resources, configure double
802.1Q tags on QinQ interfaces of the device. Inner VLAN tags are used on
internal networks and outer VLAN tags are used on external networks. QinQ
expands VLAN space to 4094x4094 VLANs and allows packets on different private
networks with the same VLAN IDs to be transparently transmitted.
Procedure
Step 1 Run system-view
The VLAN ID of the public VLAN tag, that is, the default VLAN of the interface, is
configured.
----End
Context
Selective QinQ based on the VLAN ID enables the device to add different outer
VLAN tags to received data frames according to VLAN IDs in the frames.
NOTE
● Selective QinQ based on the VLAN ID can be only enabled on hybrid or trunk interfaces
in the inbound direction.
● The outer VLAN ID must exist and the interface must be added to the outer VLAN in
untagged mode.
● The interface learns the MAC address in the VLAN specified by the outer VLAN tag of
packets.
● The MUX VLAN and selective QinQ based on the VLAN ID cannot be configured on the
same interface.
● The original VLAN specified in the port vlan-stacking command cannot be the same as
the outer VLAN configured on a QinQ Layer 2 sub-interface.
Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run interface interface-type interface-number
The interface view is displayed.
Step 3 Run port link-type { hybrid | trunk }
The link type of the interface is configured as hybrid or trunk.
By default, the link type of an interface is access.
Step 4 Add the interface to a VLAN.
Run the following command as required.
● Trunk interface
Run the port trunk allow-pass vlan { { vlan-id1 [ to vlan-id2 ] }&<1-40> |
all } command to add the trunk interface to the stacked VLAN.
● Hybrid interface
Run the port hybrid untagged vlan vlan-id command to add the hybrid
interface to the stacked VLAN in untagged mode.
The VLAN ID specified by vlan-id must already exist on the device. The original
VLAN can be not created.
Step 5 Run port vlan-stacking vlan vlan-id1 [ to vlan-id2 ] stack-vlan vlan-id3
[ remark-8021p 8021p-value ]
Selective QinQ based on the VLAN ID is configured.
NOTE
If the port vlan-stacking command has been executed at least three times with specified
VLAN ranges and VLAN ranges are combined twice at least, the configuration of each
command must be committed. Otherwise, packets may be lost. For example, when port
vlan-stacking vlan 31 to 60 stack-vlan 100, port vlan-stacking vlan 20 to 30 stack-vlan
100, and port vlan-stacking vlan 61 to 70 stack-vlan 100 commands are used, VLAN
ranges 20 to 60 and 20 to 70 are combined twice. Therefore, commit the configuration of
each command.
For the CE6865EI, CE6857EI, CE8861EI, and CE8868EI, the qinq protocol and port vlan-
stacking commands cannot be configured together.
Context
MQC-based selective QinQ uses a traffic classifier to classify packets based on
VLAN IDs and associates the traffic classifier with a traffic behavior that defines
the action of adding outer VLAN tags, so that the device can add outer VLAN tags
to packets matching the traffic classifier.
NOTE
Procedure
1. Configure a traffic classifier.
a. Run system-view
The system view is displayed.
b. Run traffic classifier classifier-name [ type { and | or } ]
A traffic classifier is created and the traffic classifier view is displayed, or
the view of an existing traffic classifier is displayed.
and is the logical operator between rules in a traffic classifier, which
means that:
▪ If a traffic classifier does not contain any ACL rules, packets match
the traffic classifier only if they match all the rules in the classifier.
The logical operator or means that packets match a traffic classifier if
they match one or more rules in the classifier.
NOTE
● Run one of the following commands to display data of a traffic policy that
has been applied:
– display system tcam service traffic-policy { global | vlan vlan-id |
interface interface-type interface-number | vpn-instance vpn-instance-
name | qos group group-id | bridge-domain bd-id } policy-name
{ inbound | outbound } [ slot slot-id [ chip chip-id ] ]
NOTE
Context
To enable interoperation between devices from different vendors, set the same
TPID value in outer VLAN tags on the devices. Devices from different vendors or in
different network plans may use different TPID values in VLAN tags of VLAN
packets. To adapt to an existing network plan, the switch supports TPID value
configuration. You can set the TPID value on the switch to be the same as the
TPID value in the network plan to ensure compatibility with the current network.
NOTE
● To implement interoperability with a non-Huawei device, ensure that the protocol type
in the outer VLAN tag added by the switch can be identified by the non-Huawei device.
● The qinq protocol command identifies incoming packets, and adds or changes the TPID
value of outgoing packets.
● For the CE6865EI, CE6857EI, CE8861EI, and CE8868EI, the qinq protocol and port vlan-
stacking commands cannot be configured together.
Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run interface interface-type interface-number
The interface view is displayed.
Networking Requirements
As shown in Figure 6-7, tenant 1 and tenant 2 in a data center are located in
different positions. SwitchA and SwitchB are at the edge of the data center and
connected through the core/backbone network.
The requirements are as follows:
● Tenant 1 and tenant 2 plan their VLANs independently.
● Traffic of the two tenants is transparently transmitted on the core/backbone
network. Devices using the same services in the two branches are allowed to
communicate and devices using different services are isolated.
You can configure QinQ to meet the preceding requirements. VLAN 100 and VLAN
200 provided by the core/backbone network can be used to implement
communication of tenant 1 and tenant 2 respectively.
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure VLAN 100 and VLAN 200 on both SwitchA and SwitchB, and set the
link type of interfaces connected to tenants to QinQ and add the interfaces to
VLAN so that different outer VLAN tags are added to different tenants.
2. Add interfaces connected to the core/backbone network on SwitchA and
SwitchB to VLAN 100 and VLAN 200 to permit packets from these VLANs to
pass through.
Procedure
Step 1 Create VLANs.
# Create VLAN 100 and VLAN 200 on SwitchA.
<HUAWEI> system-view
[~HUAWEI] sysname SwitchA
[*HUAWEI] commit
[~SwitchA] vlan batch 100 200
[*SwitchA] commit
Step 3 Configure the interface connected to the core/backbone network on the switch.
# Add 10GE1/0/3 on SwitchA to VLAN 100 and VLAN 200. The configuration of
SwitchB is similar to the configuration of SwitchA, and is not mentioned here.
[~SwitchA] interface 10ge 1/0/3
[~SwitchA-10GE1/0/3] port link-type trunk
[*SwitchA-10GE1/0/3] port trunk allow-pass vlan 100 200
[*SwitchA-10GE1/0/3] commit
[~SwitchA-10GE1/0/3] quit
On a server in a VLAN of tenant 2, ping another server in the same VLAN. The
ping operation succeeds, indicating that devices in tenant 2 can communicate with
each other.
On a server in a VLAN of tenant 2, ping another server in the same VLAN. The
ping operation fails, indicating that tenants are isolated.
----End
Configuration Files
● SwitchA configuration file
#
sysname SwitchA
#
vlan batch 100 200
#
interface 10GE1/0/1
port link-type dot1q-tunnel
port default vlan 100
#
interface 10GE1/0/2
port link-type dot1q-tunnel
port default vlan 200
#
interface 10GE1/0/3
port link-type trunk
port trunk allow-pass vlan 100 200
#
return
● SwitchB configuration file
#
sysname SwitchB
#
vlan batch 100 200
#
interface 10GE1/0/1
port link-type dot1q-tunnel
port default vlan 100
#
interface 10GE1/0/2
port link-type dot1q-tunnel
port default vlan 200
#
interface 10GE1/0/3
port link-type trunk
port trunk allow-pass vlan 100 200
#
return
SwitchA SwitchB
10GE1/0/2 Core/Backbone 10GE1/0/2
Network
VLAN100
VLAN200
10GE1/0/1 10GE1/0/1
User
User
VLAN10~
VLAN10~
VLAN50
VLAN50
Manufacturing Service: VLAN10 ~ VLAN30
A Office Service: VLAN31 ~ VLAN50 B
Configuration Roadmap
You can configure VLAN ID-based selective QinQ to meet the preceding
requirements. Production service servers communicate in VLAN 100 and office
service servers communicate in VLAN 200 of the core/backbone network, and
different service servers are isolated.
The configuration roadmap is as follows:
1. Create VLAN 100 and VLAN 200 on SwitchA and SwitchB, and configure
selective QinQ on interfaces of SwitchA and SwitchB so that different VLAN
tags are added to different packets of services.
2. Add interfaces of SwitchA and SwitchB connected to the core/backbone
network to VLANs so that packets from VLAN 100 and VLAN 200 are allowed
to pass through.
Procedure
Step 1 Create VLANs.
# Create VLAN 100 and VLAN 200 on SwitchA.
<HUAWEI> system-view
[~HUAWEI] sysname SwitchA
[*HUAWEI] commit
[~SwitchA] vlan batch 100 200
[*SwitchA] commit
[*HUAWEI] commit
[~SwitchB] vlan batch 100 200
[*SwitchB] commit
----End
Configuration Files
● Configuration file of SwitchA
#
sysname SwitchA
#
vlan batch 100 200
#
interface 10GE1/0/1
port link-type hybrid
Networking Requirements
As shown in Figure 6-9, servers on a data center network store video and data
information. The MAC addresses of data and video servers are 0003-0003-0003
and 0004-0004-0004 respectively. A school network transmits teachers' office and
multimedia services, and servers are connected through the enterprise backbone
network. The enterprise backbone network allocates VLAN 2 to teachers' office
service and VLAN 3 to multimedia service. SwitchB and SwitchC are edge devices
of the enterprise backbone network.
The requirements are as follows:
● Video and data servers are allocated to different VLANs, so they do not affect
each other.
● Traffic is transparently transmitted on the enterprise backbone network.
Teachers' office service is only transmitted to the data server and multimedia
service is only transmitted to the video server so that services can be
differentiated.
MQC-based selective QinQ can be configured on SwitchB to meet the preceding
requirements.
Data server
10
GE
/2
1/0
1/
SwitchA SwitchB SwitchC SwitchD E
0/
0G
2
Enterprise 1
10GE1/0/1 10GE1/0/2 Teachers' VLAN200
Backbone office
10GE1/0/1 Network 10GE1/0/1
Video server 10
/3 10GE1/0/2 VLAN2,3 10GE1/0/1 GE
E1/0 1 /0/
10G 3
VLAN300
Traffic direction
Multimedia VLAN300
room
Campus
Configuration Roadmap
The configuration roadmap is as follows:
1. Create VLANs on SwitchB and configure SwitchB to add different VLAN tags
to packets of different services.
2. Configure traffic classifiers, traffic behaviors, and bind them in a traffic policy
on SwitchB.
3. Apply the traffic policy to interfaces of SwitchB to implement selective QinQ.
Procedure
Step 1 Create VLANs.
# Create VLAN 200 and VLAN 300 on SwitchA and add interfaces connected to
servers to VLAN 200 and VLAN 300. The configuration of SwitchD is similar to the
configuration of SwitchA, and is not mentioned here.
<HUAWEI> system-view
[~HUAWEI] sysname SwitchA
[*HUAWEI] commit
[~SwitchA] vlan batch 200 300
[*SwitchA] interface 10ge 1/0/2
[*SwitchA-10GE1/0/2] port default vlan 200
[*SwitchA-10GE1/0/2] quit
[*SwitchA] interface 10ge 1/0/3
[*SwitchA-10GE1/0/3] port default vlan 300
[*SwitchA-10GE1/0/3] quit
[*SwitchA] commit
# On SwitchB, create VLAN 2 and VLAN 3, that is, outer VLAN IDs added to
packets.
<HUAWEI> system-view
[~HUAWEI] sysname SwitchB
[*HUAWEI] commit
[~SwitchB] vlan batch 2 3
[*SwitchB] commit
Step 2 Configure traffic classifiers, traffic behaviors, and bind them in a traffic policy on
SwitchB.
[~SwitchB] traffic classifier name1
[*SwitchB-classifier-name1] if-match source-mac 0003-0003-0003
[*SwitchB-classifier-name1] quit
[*SwitchB] traffic behavior name1
[*SwitchB-behavior-name1] vlan-stacking vlan 2
[*SwitchB-behavior-name1] quit
[*SwitchB] traffic classifier name2
[*SwitchB-classifier-name2] if-match source-mac 0004-0004-0004
[*SwitchB-classifier-name2] quit
[*SwitchB] traffic behavior name2
[*SwitchB-behavior-name2] vlan-stacking vlan 3
[*SwitchB-behavior-name2] quit
[*SwitchB] traffic policy name1
[*SwitchB-trafficpolicy-name1] classifier name1 behavior name1
[*SwitchB-trafficpolicy-name1] classifier name2 behavior name2
[*SwitchB-trafficpolicy-name1] quit
[*SwitchB] commit
# Add 10GE 1/0/1 on SwitchA to VLAN 200 and VLAN 300. The configuration of
SwitchD is similar to the configuration of SwitchA, and is not mentioned here.
[~SwitchA] interface 10ge 1/0/1
[~SwitchA-10GE1/0/1] port link-type trunk
[*SwitchA-10GE1/0/1] port trunk allow-pass vlan 200 300
[*SwitchA-10GE1/0/1] quit
[*SwitchA] commit
----End
Configuration Files
● SwitchA configuration file
#
sysname SwitchA
#
vlan batch 200 300
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 200 300
#
interface 10GE1/0/2
port default vlan 200
#
interface 10GE1/0/3
port default vlan 300
#
return
● SwitchB configuration file
#
sysname SwitchB
#
vlan batch 2 to 3
#
traffic classifier name1 type or
if-match source-mac 0003-0003-0003 ffff-ffff-ffff
#
traffic classifier name2 type or
if-match source-mac 0004-0004-0004 ffff-ffff-ffff
#
traffic behavior name1
vlan-stacking vlan 2
#
traffic behavior name2
vlan-stacking vlan 3
#
traffic policy name1