The port vlan-mapping vlan map-vlan command enables the interface to map single tags of packets.
The undo port vlan-mapping command cancels the interface to map single tags of packets.
By default, the interface does not map tags of packets.
port vlan-mapping vlan vlan-id1 [ to vlan-id2 ] map-vlan vlan-id3 [ remark-8021p 8021p-value ]
undo port vlan-mapping { all | vlan vlan-id1 [ to vlan-id2 ] [ map-vlan vlan-id3 ]}
S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-HI, S6730-H, S6730S-H, S6730-S, and S6730S-S do not support the N:1 VLAN Mapping.
Parameter |
Description |
Setting |
---|---|---|
vlan vlan-id1 [ to vlan-id2 ] |
Specifies the VLAN ID in a received packet.
|
The value of vlan-id1 or vlan-id2 is an integer that ranges from 1 to 4094. |
map-vlan vlan-id3 |
Specifies the VLAN ID in the mapped tag. |
The value is an integer that ranges from 1 to 4094. |
remark-8021p 8021p-value |
Specifies the re-marked 802.1p priority of the mapped tag. The 802.1p priority is specified by a 3-bit PRI (priority) field in an 802.1Q packet. When congestion occurs on a switch, packets with a higher priority are sent first. If the parameter remark-8021p is configured, the interface changes the 802.1p priority in the packet to the value of 8021p-value specified by users. |
The value is an integer that ranges from 0 to 7. A larger value indicates a higher priority. |
all |
Specifies all VLAN mapping entries configured 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 mapping, also called VLAN translation, implements communication between different VLANs. VLAN mapping takes effect after outbound interfaces on a switch forward the packets received by inbound interfaces. This command allows an interface to map the VLAN ID in a tagged packet to an S-VLAN ID.
After the port vlan-mapping vlan vlan-id1 [ to vlan-id2 ] map-vlan vlan-id3 [ remark-8021p 8021p-value ] command is used on an interface, vlan-id1 [ to vlan-id2 ] is mapped to vlan-id3 in the inbound direction, and vlan-id3 is mapped to vlan-id1 [ to vlan-id2 ] in the outbound direction.
Precautions
VLAN mapping can be configured only on a trunk or hybrid interface, and the hybrid interfaces on the devices except the must be added to the translated VLAN in tagged mode.
When N:1 VLAN mapping is configured (VLAN IDs can be incontiguous before mapping), the interface needs to be added to these VLANs in tagged mode, and the VLAN specified by map-vlan cannot be a VLAN corresponding to a VLANIF interface.
If VLAN mapping and DHCP are configured on the same interface, it is recommended to add the interface to the original VLANs (VLANs before mapping) in tagged mode.
N:1 VLAN mapping is not supported in a stack scenario.
A maximum of 16 original VLAN IDs can be specified on an interface.
If the VLANs before and after mapping are the same, return packets may fail to be forwarded. To solve the problem, map the VLAN to itself. For example, packets with VLAN 10 and VLAN 20 (before mapping) need to be sent to the network side and S-VLAN 20 (after mapping) is assigned to users, run the port vlan-mapping vlan 10 map-vlan 20 command. To ensure that return packets are correctly forwarded, run the port vlan-mapping vlan 20 map-vlan 20 command.
# Configure VLAN mapping on the GE0/0/1 and map VLAN 100 of a received packet to VLAN 10 before the packet is forwarded.
<HUAWEI> system-view [HUAWEI] interface gigabitethernet0/0/1 [HUAWEI-GigabitEthernet0/0/1] port link-type trunk [HUAWEI-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 [HUAWEI-GigabitEthernet0/0/1] qinq vlan-translation enable [HUAWEI-GigabitEthernet0/0/1] port vlan-mapping vlan 100 map-vlan 10