The port vlan-stacking command configures VLAN stacking.
The undo port vlan-stacking command cancels the configuration.
By default, VLAN stacking is not configured.
port vlan-stacking vlan vlan-id1 [ to vlan-id2 ] stack-vlan vlan-id3 [ remark-8021p 8021p-value1 ]
port vlan-stacking vlan vlan-id1 stack-vlan vlan-id3 [ remark-8021p 8021p-value1 ] map-vlan vlan-id4 [ remark-inner-8021p 8021p-value2 ]
undo port vlan-stacking vlan vlan-id1 [ to vlan-id2 ] [ stack-vlan vlan-id3 ]
undo port vlan-stacking all
Parameter |
Description |
Value |
---|---|---|
vlan vlan-id1 [ to vlan-id2 ] |
Specifies the VLAN ID in a received tagged frame.
|
The value of vlan-id1 is an integer that ranges from 1 to 4094. The value of vlan-id2 is an integer that ranges from 1 to 4094. |
stack-vlan vlan-id3 |
Specifies the outer VLAN ID added to a frame. |
The value is an integer that ranges from 1 to 4094. |
remark-8021p 8021p-value1 |
Specifies the re-marked 802.1p priority in the outer tag added to a frame. |
The value is an integer that ranges from 0 to 7. A larger value indicates a higher priority. |
map-vlan vlan-id4 |
Specifies the mapped VLAN ID in the stacked inner tag. |
The value is an integer that ranges from 1 to 4094. |
remark-inner-8021p 8021p-value2 |
Specifies the re-marked 802.1p priority in the mapped inner tag. |
The value is an integer that ranges from 0 to 7. A larger value indicates a higher priority. |
all |
Deletes all VLAN stacking configurations on the interface. |
- |
Ethernet interface view, GE interface view, XGE interface view, 40GE interface view, 100GE interface view, MultiGE interface view, Eth-Trunk interface view, port group view, 25GE interface view
Usage Scenario
VLAN stacking, also called selective QinQ, is a Layer 2 technology that enables a device to add outer VLAN tags based on VLAN IDs.
A VLAN stacking port can be configured with multiple outer VLAN tags so that the port can add different outer VLAN tags to different VLAN frames.
A VLAN stacking interface can add the outer tag to received frames. After an interface joins the stacked VLAN in untagged mode, the interface removes the outer tag from outgoing frames.
When a network edge device needs to act as a user-side device and the received single-tagged packets are from one type of service, the same service from different users needs to be sent in different VLANs. That is, 1:1 VLAN mapping is implemented. After mapped VLAN tags enter the carrier network, VLAN stacking needs to be enabled on the network edge device to distinguish different users and services, because the number of VLANs that can be provided by the carrier network is limited. In addition, specified tags need to be added to packets of different users and services. Outer tags are the same as those provided by the carrier network and can be transmitted over the carrier network, and inner tags are transparently transmitted over the carrier network, enabling communication between different users. You need to run the port vlan-stackingvlanvlan-id1stack-vlanvlan-id2 [ remark-8021p8021p-value1 ] map-vlanvlan-id4 [ remark-inner-8021p8021p-value2 ] command to enable both VLAN mapping and VLAN stacking functions. remark-8021p8021p-value1 and remark-inner-8021p8021p-value2 specify 802.1p priorities of inner and outer VLAN tags.
If you want to implement both VLAN mapping and VLAN stacking, you cannot enable them separately by running the corresponding commands. This is because the VLAN ID that is mapped based on VLAN mapping cannot be mapped again based on VLAN stacking. For example, if port vlan-stacking vlan 210 stack-vlan 2010 and port vlan-mapping vlan 10 map-vlan 210 are configured on a device, the device maps VLAN 10 to VLAN 210 based on port vlan-mapping vlan 10 map-vlan 210. However, VLAN 210 after mapping will not be mapped to VLAN 2010 based on port vlan-stacking vlan 210 stack-vlan 2010. To implement both VLAN stacking and VLAN mapping, run the port vlan-stacking vlanvlanid1stack-vlanvlanid2map-vlanvlanid3 command.
Precautions
When an interface configured with VLAN stacking needs to remove the outer tag from outgoing frames, the interface must join the VLAN specified by stack-vlan in untagged mode. If the outer VLAN does not need to be removed, the interface must join the VLAN specified by stack-vlan in tagged mode.
When map-vlan vlan-id4 is configured to perform VLAN stacking and VLAN mapping concurrently, on switches other than the S5720-EI, S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720-HI, S6720S-EI, S6730-H, S6730S-H, S6730-S, and S6730S-S, the same outer VLAN tag cannot be added to packets from different user VLANs. On the S5720-EI, S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720-HI, S6720S-EI, S6730-H, S6730S-H, S6730-S, and S6730S-S, the same outer VLAN tag cannot be added to packets from different user VLANs, and different inner VLAN tags in packets from different user VLANs cannot be matched to the same VLAN tag. For example, if packets containing VLAN IDs 10 and 20 respectively are received on an interface, the port vlan-stacking vlan 10 stack-vlan 100 map-vlan 200 and port vlan-stacking vlan 20 stack-vlan 100 map-vlan 200 commands cannot be configured together.
# On GE0/0/1, configure selective QinQ and outer VLAN tag 100 to the tagged frames with the inner VLAN tags 10 to 13.
<HUAWEI> system-view [HUAWEI] interface gigabitethernet 0/0/1 [HUAWEI-GigabitEthernet0/0/1] port link-type hybrid [HUAWEI-GigabitEthernet0/0/1] qinq vlan-translation enable [HUAWEI-GigabitEthernet0/0/1] port hybrid untagged vlan 100 [HUAWEI-GigabitEthernet0/0/1] port vlan-stacking vlan 10 to 13 stack-vlan 100