802.1Q-in-802.1Q (QinQ) expands VLAN space by adding an additional 802.1Q tag to 802.1Q tagged packets. It allows services in a private VLAN to be transparently transmitted over a public network.
Selective QinQ, also called VLAN stacking or QinQ stacking, is an extension of QinQ. Selective QinQ is performed based on interfaces and VLAN IDs. In addition to functions of basic QinQ, selective QinQ takes different actions for packets received by the same interface based on VLANs.
VLAN ID-based selective QinQ adds different outer VLAN tags to packets with different inner VLAN IDs.
When configuring selective QinQ on the switch, pay attention to the following points:
ES0D0G24SA00, ES0D0G24CA00, EH1D2G24SSA0, and EH1D2S24CSA0 cards
As shown in Figure 1, Internet access users (using PCs) and VoIP users (using VoIP phones) connect to the ISP network through SwitchA and SwitchB and communicate with each other through the ISP network.
In the enterprise, VLAN 100 is allocated to PCs and VLAN 300 is allocated to VoIP phones.
It is required that packets of PCs and VoIP phones are tagged VLAN 2 and VLAN 3 respectively when the packets are transmitted through the ISP network.
The configuration roadmap is as follows:
Create VLANs on SwitchA and SwitchB.
Configure link types of interfaces and add interfaces to VLANs on SwitchA and SwitchB.
Configure selective QinQ on interfaces of SwitchA and SwitchB.
# On SwitchA, create VLAN 2 and VLAN 3, that is, VLAN IDs of the outer VLAN tag to be added.
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan batch 2 3
# On SwitchB, create VLAN 2 and VLAN 3, that is, VLAN IDs of the outer VLAN tag to be added.
<HUAWEI> system-view [HUAWEI] sysname SwitchB [SwitchB] vlan batch 2 3
When a fixed switch is used, you must run the qinq vlan-translation enable command in the interface view to enable VLAN translation.
# Configure GE1/0/1 on SwitchA.
[SwitchA] interface gigabitethernet 1/0/1 [SwitchA-GigabitEthernet1/0/1] port link-type hybrid [SwitchA-GigabitEthernet1/0/1] port hybrid untagged vlan 2 3 //Add the hybrid interface to VLANs in untagged mode. [SwitchA-GigabitEthernet1/0/1] port vlan-stacking vlan 100 stack-vlan 2 //Configure the inner VLAN tag as VLAN 100 and add VLAN 2 in the outer VLAN tag. [SwitchA-GigabitEthernet1/0/1] port vlan-stacking vlan 300 stack-vlan 3 //Configure the inner VLAN tag as VLAN 300 and add VLAN 3 in the outer VLAN tag. [SwitchA-GigabitEthernet1/0/1] quit
# Configure GE1/0/1 on SwitchB.
[SwitchB] interface gigabitethernet 1/0/1 [SwitchB-GigabitEthernet1/0/1] port link-type hybrid [SwitchB-GigabitEthernet1/0/1] port hybrid untagged vlan 2 3 //Add the hybrid interface to VLANs in untagged mode. [SwitchB-GigabitEthernet1/0/1] port vlan-stacking vlan 100 stack-vlan 2 //Configure the inner VLAN tag as VLAN 100 and add VLAN 2 in the outer VLAN tag. [SwitchB-GigabitEthernet1/0/1] port vlan-stacking vlan 300 stack-vlan 3 //Configure the inner VLAN tag as VLAN 300 and add VLAN 3 in the outer VLAN tag. [SwitchB-GigabitEthernet1/0/1] quit
# Add GE1/0/2 on SwitchA to VLAN 2 and VLAN 3.
[SwitchA] interface gigabitethernet 1/0/2 [SwitchA-GigabitEthernet1/0/2] port link-type trunk [SwitchA-GigabitEthernet1/0/2] port trunk allow-pass vlan 2 3 [SwitchA-GigabitEthernet1/0/2] quit
# Add GE1/0/2 on SwitchB to VLAN 2 and VLAN 3.
[SwitchB] interface gigabitethernet 1/0/2 [SwitchB-GigabitEthernet1/0/2] port link-type trunk [SwitchB-GigabitEthernet1/0/2] port trunk allow-pass vlan 2 3 [SwitchB-GigabitEthernet1/0/2] quit
If the configurations on SwitchA and SwitchB are correct, you can obtain the following information:
PCs can communicate with each other through the ISP network.
VoIP phones can communicate with each other through the ISP network.
Configuration file of SwitchA
# sysname SwitchA # vlan batch 2 to 3 # interface GigabitEthernet1/0/1 port link-type hybrid port hybrid untagged vlan 2 to 3 port vlan-stacking vlan 100 stack-vlan 2 port vlan-stacking vlan 300 stack-vlan 3 # interface GigabitEthernet1/0/2 port link-type trunk port trunk allow-pass vlan 2 to 3 # return
Configuration file of SwitchB
# sysname SwitchB # vlan batch 2 to 3 # interface GigabitEthernet1/0/1 port link-type hybrid port hybrid untagged vlan 2 to 3 port vlan-stacking vlan 100 stack-vlan 2 port vlan-stacking vlan 300 stack-vlan 3 # interface GigabitEthernet1/0/2 port link-type trunk port trunk allow-pass vlan 2 to 3 # return