01-11 VLAN Mapping Configuration
01-11 VLAN Mapping Configuration
Switches
Configuration Guide - Ethernet Switching 11 VLAN Mapping Configuration
Definition
VLAN mapping technology changes VLAN tags in packets to map different VLANs.
Purpose
Two Layer 2 user networks in the same VLAN can be connected through a
backbone network. To ensure Layer 2 connectivity between users, and to
uniformly deploy Layer 2 protocols, the two user networks need to interwork
seamlessly. However, the backbone network cannot directly transmit VLAN packets
from the user networks, because the VLAN plans on the backbone and user
networks are different.
To solve this problem, configure VLAN mapping. When VLAN packets from a user
network enter the backbone network, an edge device on the backbone network
changes the customer VLAN (C-VLAN) ID to the service VLAN (S-VLAN ID). After
the packets are transmitted, the edge device reverts the VLAN ID change. This
ensures seamless interworking between the two user networks. The other method
is to configure a Layer 2 tunneling technology such as QinQ or VPLS to
encapsulate VLAN packets into packets on the backbone network so that VLAN
packets are transparently transmitted. However, this method increases extra cost
because packets are encapsulated. In addition, Layer 2 tunneling technology may
not support transparent transmission of packets of some protocol packets. The
other method is to configure VLAN mapping. When VLAN packets from a user
network enter the backbone network, an edge device on the backbone network
changes the C-VLAN ID to the S-VLAN ID. After the packets are transmitted to the
other side, the edge device changes the S-VLAN ID to the C-VLAN ID. This method
implements seamless interworking between two user networks.
Configuring VLAN mapping on the switch connecting the two user networks
allows a user to manage the two networks as a single Layer 2 network, despite
the differing VLAN plans of the user networks.
Working Mechanism
Depending on whether a packet is tagged or untagged, the switch processes a
received packet as follows:
● Tagged packed: Based on the VLAN mapping mode, the switch determines
whether a single tag, double tags, or the outer tag is to be replaced. The
switch then learns the MAC addresses in the packet. The switch updates the
MAC address entries in the VLAN mapping table based on the source MAC
address and mapped VLAN ID. It then searches for the MAC address entries
based on the destination MAC address and the mapped VLAN ID. If the
destination MAC address matches an entry, the switch forwards the packet
through the corresponding outbound interface. If not, the switch broadcasts
the packet in the specified VLAN.
● Untagged packet: Based on the VLAN creation mode, the switch determines
whether to add a VLAN tag. If the packet can be added to a VLAN, the switch
adds a VLAN tag to it and learns the MAC addresses. The switch then
performs Layer 2 forwarding based on the destination MAC address. If the
packet cannot be added to a VLAN, the switch either delivers the packet to
the CPU or discards it.
Figure 11-1 shows VLAN mapping between VLAN 2 and VLAN 3 configured on
PORT 1. Before sending packets from VLAN 2 to VLAN 3, PORT 1 replaces the
VLAN tags with VLAN 3 tags. When receiving packets from VLAN 3 to VLAN 2,
PORT 1 replaces the VLAN tags with VLAN 2 tags. This implements
communication between devices in VLAN 2 and VLAN 3.
VLAN 2 VLAN 3
2 3
PORT1
3
Switch Switch
A B
3
2
3
172.16.0.1/16 172.16.0.7/16
IPTV
VLAN 2 Corridor
Switch
HSI
VLAN 2->VLAN 202
Residential VLAN 3->VLAN 302
Gateway VLAN 4->VLAN 402
VLAN 3
IPTV
Residential
Gateway
VoIP
VLAN 4
In the networking diagram shown in Figure 11-2, services (HSI, IPTV, and
VoIP) of each user are transmitted on different VLANs. Same services are
transmitted on the same C-VLAN. To differentiate users, deploy Corridor
Switch to allow the same services used by different users to be transmitted on
different VLANs, which implements 1:1 VLAN mapping. 1:1 VLAN mapping
requires a large number of VLANs to isolate services of different users;
however, the VLAN quantity provided by the network access device at the
aggregation layer is limited. To resolve this problem, configure the VLAN
aggregation function to allow the same services to be transmitted on the
same VLAN (N:1 VLAN mapping).
● 2:1 VLAN mapping
When the interface receives a double-tagged packet, the interface maps the
outer VLAN tag in the packet to an S-VLAN tag and transparently transmits
the inner VLAN tag.
2:1 VLAN mapping applies to the network shown in Figure 11-3.
Internet
Aggregation Switch
Community
Switch IP 501 2~3
S5
IP 501 4
IP 201 2 ~3
S3 Corridor S4
Switch
IP 401 4
Residential
S1 Gateway S2
Switch2 Switch3
Internet
outside tag:50
inner tag:60
Switch1 Switch4
Licensing Requirements
VLAN mapping configuration commands are available only after the S1720GW,
S1720GWR, and S1720X have the license (WEB management to full management
Electronic RTU License) loaded and activated and the switches are restarted. VLAN
mapping configuration commands on other models are not under license control.
For details about how to apply for a license, see S Series Switch License Use
Guide.
Version Requirements of 1:1 mode and N:1 mode for 1 to 1VLAN Mapping
S2710SI V100R006(C03&C05)
S5710-C-LI V200R001C00
S5730SI V200R011C10
S5730S-EI V200R011C10
NOTE
To know details about software mappings, see Hardware Query Tool.
Version Requirements of 1:1 mode and N:1 mode for 2 to 1 VLAN Mapping
S5730SI V200R011C10
NOTE
The S5730SI does not support N:1 VLAN mapping.
S5730S-EI V200R011C10
NOTE
The S5730S-EI does not support N:1 VLAN mapping.
S5730SI V200R011C10
S5730S-EI V200R011C10
Feature Limitations
● VLAN mapping can be configured only on a trunk or hybrid interface, and the
hybrid interface must be added to the translated VLAN in tagged mode.
● When N:1 VLAN mapping is configured, the interface needs to join the
original VLAN in tagged mode.
● When VLAN mapping is configured, it is not recommended that map-vlan be
configured for the VLAN corresponding to the 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 takes effect only when the packets with original VLANs
are sent first. In this case, if packets are sent from the S-VLAN first, the C-
VLAN to be mapped cannot be determined because no ACL entry is
generated. As a result, the packets are discarded.
● N:1 VLAN mapping is not supported in a stack scenario.
● N:1 VLAN mapping does not take effect for reverse BUM traffic.
● A VLAN bound to a BD cannot be specified as the value of map-vlan (the
outer VLAN ID in the mapped tag) in VLAN mapping commands. Similarly, a
VLAN specified as the value of map-vlan in VLAN mapping commands cannot
be bound to a BD.
Pre-configuration Tasks
Before configuring VLAN ID-based VLAN mapping, complete the following tasks:
● Create the specified VLAN.
● Add the primary interface to the mapped VLAN.
NOTE
The port vlan-mapping ingress command is only supported by S1720GFR, S1720GW,
S1720GWR, S1720X, S1720GW-E, S1720GWR-E, S1720X-E, S2750EI, S2720EI, S5700S-LI,
S5700LI, S5720LI, S5720S-LI, S6720LI, S6720S-LI, S5710-X-LI, S5730SI, S5730S-EI, S6720SI,
S6720S-SI, S5720SI, and S5720S-SI.
Pre-configuration Tasks
Before configuring 1:1 VLAN mapping, complete the following tasks:
● Create the specified VLAN.
● Add the primary interface to the translated VLAN.
Procedure
Step 1 Run system-view
The system view is displayed.
NOTE
● VLAN mapping can be configured only on a trunk or hybrid interface, and the hybrid
interface must be added to the translated VLAN in tagged mode.
● When N:1 VLAN mapping is configured (VLAN IDs can be non-contiguous 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.
● Configuring mac-limit and N:1 VLAN mapping simultaneously causes a high CPU usage
on some low-end switches. Therefore, such configuration is not recommended.
● N:1 VLAN mapping takes effect only when the packets with original VLANs are sent
first. In this case, if packets are sent from the S-VLAN first, the C-VLAN to be mapped
cannot be determined because no ACL entry is generated. As a result, the packets are
discarded.
----End
Context
When receiving a tagged packet, an interface maps the VLAN ID in the packet to
an S-VLAN ID.
NOTE
Only the S1720X, S1720X-E, S5720HI, S5720EI, S5730SI, S5730S-EI, S6720LI, S6720S-LI,
S6720SI, S6720S-SI, S6720EI, and S6720S-EI support this configuration.
Procedure
Step 1 Run system-view
The system view is displayed.
Step 5 Run port vlan-mapping vlan vlan-id1 inner-vlan vlan-id2 [ to vlan-id3 ] map-
vlan vlan-id4 [ remark-8021p 8021p-value ]
----End
Context
QinQ is used to send double-tagged packets, which prevents the conflict between
C-VLAN IDs and S-VLAN IDs and differentiates services and users. However, the
interface will discard the packets because C-VLAN IDs are different from S-VLAN
IDs. To ensure communication continuity, configure 2:2 VLAN mapping on the PE
and replace double C-VLAN tags with double S-VLAN tags.
NOTE
Only the S1720X, S1720X-E, S5720HI, S5720EI, S5730SI, S5730S-EI, S6720LI, S6720S-LI,
S6720SI, S6720S-SI, S6720EI, and S6720S-EI support this configuration.
Procedure
Step 1 Run system-view
Step 5 Run port vlan-mapping vlan vlan-id1 inner-vlan vlan-id2 map-vlan vlan-id3
map-inner-vlan vlan-id4 [ remark-8021p 8021p-value ]
----End
Procedure
● Run the display vlan vlan-id command to check whether the interface is
added to the translated S-VLAN.
● Run the display current-configuration command to check the VLAN
mapping configuration on the interface.
----End
Procedure
1. Configure a traffic classifier.
a. Run system-view
The system view is displayed.
b. Run traffic classifier classifier-name [ operator { and | or } ]
A traffic classifier is created and the traffic classifier view is displayed, or
an existing traffic classifier view is displayed.
and is the logical operator between the rules in the traffic classifier,
which means that:
▪ If the traffic classifier contains ACL rules, packets match the traffic
classifier only when they match one ACL rule and all the non-ACL
rules.
▪ If the traffic classifier does not contain any ACL rules, packets match
the traffic classifier only when they match all the rules in the
classifier.
The logical operator or means that packets match the traffic classifier if
they match one of the rules in the classifier.
By default, the relationship between rules in a traffic classifier is OR.
c. Configure matching rules according to the following table.
NOTE
Only the S5720EI, S6720EI, and S6720S-EI support traffic classifiers with
advanced ACLs containing the ttl-expired field.
When a traffic classifier contains if-match ipv6 acl { acl-number | acl-name },
the S5720HI does not support remark 8021p [ 8021p-value | inner-8021p ],
remark cvlan-id cvlan-id, remark vlan-id vlan-id, or mac-address learning
disable.
d. Run quit
Exit from the traffic classifier view.
2. Configure a traffic behavior.
a. Run traffic behavior behavior-name
A traffic behavior is created and the traffic behavior view is displayed.
b. Run remark vlan-id vlan-id
The traffic behavior is configured. The outer VLAN ID of the packet is re-
marked.
c. (Optional) Run remark cvlan-id vlan-id
The traffic behavior is configured. The inner VLAN ID of the packet is re-
marked.
NOTE
Only the S5720HI, S5720EI, S6720EI, and S6720S-EI support this configuration.
d. Run quit
Exit from the traffic behavior view.
e. Run quit
Exit from the system view.
3. Configure a traffic policy.
a. Run traffic policy policy-name [ match-order { auto | config } ]
A traffic policy is created and the traffic policy view is displayed, or the
view of an existing traffic policy is displayed. If you do not specify a
matching order for traffic classifiers in the traffic policy, the default
matching order config is used.
After a traffic policy is applied, you cannot use the traffic policy
command to modify the matching order of traffic classifiers in the traffic
policy. To modify the matching order, delete the traffic policy, create a
traffic policy, and specify the matching order.
When creating a traffic policy, you can specify the matching order of its
matching rules. The matching order can be either automatic order or
configuration order:
If more than 128 ACL rules defining CAR are configured, a traffic policy must be
applied to an interface, a VLAN, and the system in sequence in the outbound
direction. In the preceding situation, if you need to update ACL rules, delete the
traffic policy from the interface, VLAN, and system and reconfigure it in
sequence.
b. Run classifier classifier-name behavior behavior-name
A traffic behavior is bound to a traffic classifier in the traffic policy.
c. Run quit
Exit from the traffic policy view.
d. Run quit
Exit from the system view.
4. Apply the traffic policy.
– Applying a traffic policy to an interface
i. Run system-view
The system view is displayed.
ii. Run interface interface-type interface-number
The interface view is displayed.
iii. Run traffic-policy policy-name { inbound | outbound }
A traffic policy is applied to the interface.
A traffic policy can be applied to only one direction on an interface,
but a traffic policy can be applied to different directions on different
interfaces. After a traffic policy is applied to an interface, the system
performs traffic policing for all the incoming or outgoing packets
that match traffic classification rules on the interface.
– Applying a traffic policy to a VLAN
i. Run system-view
The system view is displayed.
ii. Run vlan vlan-id
The VLAN view is displayed.
iii. Run traffic-policy policy-name { inbound | outbound }
A traffic policy is applied to the VLAN.
Only one traffic policy can be applied to a VLAN in the inbound or
outbound direction.
After a traffic policy is applied, the system performs traffic policing
for the packets that belong to a VLAN and match traffic classification
rules in the inbound or outbound direction.
– Applying a traffic policy to the system
i. Run system-view
The system view is displayed.
ii. Run traffic-policy policy-name global { inbound | outbound } [ slot
slot-id ]
A traffic policy is applied to the system.
Only one traffic policy can be applied to the system or slot in one
direction. A traffic policy cannot be applied to the same direction in
the system and slot simultaneously.
○ In a stack, a traffic policy that is applied to the system takes
effect on all the interfaces and VLANs of all the member
switches in the stack. The system then performs traffic policing
for all the incoming and outgoing packets that match traffic
classification rules on all the member switches. A traffic policy
that is applied to a specified slot takes effect on all the
interfaces and VLANs of the member switch with the specified
stack ID. The system then performs traffic policing for all the
incoming and outgoing packets that match traffic classification
rules on this member switch.
○ On a standalone switch, a traffic policy that is applied to the
system takes effect on all the interfaces and VLANs of the local
switch. The system then performs traffic policing for all the
incoming and outgoing packets that match traffic classification
rules on the local switch. Traffic policies applied to the slot and
system have the same functions.
Context
During VLAN Mapping configuration, VLAN translation resources may be
insufficient. You can run commands to view the total number of inbound/
outbound VLAN translation resources, the number of used VLAN translation
resources, and the number of remaining VLAN translation resources. The
command output helps you locate faults.
Procedure
Step 1 Run the display vlan-translation resource [ slot slot-number ] command in any
view to view VLAN translation resource usage.
NOTE
Only the S5720HI, S5720EI, S6720EI, and S6720S-EI support this command.
Step 2 Run the display spare-bucket resource [ slot slot-number ] command in any
view to view the usage of backup resources when VLAN translation resources
conflict.
NOTE
Only the S5720HI supports this command.
----End
Community1 Community2
VLAN6 VLAN5
172.16.0.2/16 172.16.0.6/16
172.16.0.1/16 172.16.0.3/16 172.16.0.5/16 172.16.0.7/16
Configuration Roadmap
The configuration roadmap is as follows:
1. Add the switch port connecting to community 1 to VLAN6 and add the switch
port connecting to community 2 to VLAN5.
2. Configure VLAN mapping on GE0/0/1 of PE1 and PE2 and map C-VLAN IDs to
S-VLAN IDs so that users in different VLANs can communicate with each
other.
Procedure
Step 1 Add downlink interfaces on switches to specified VLANs.
# Configure CE1.
<HUAWEI> system-view
[HUAWEI] sysname CE1
[CE1] vlan 6
[CE1-vlan6] quit
[CE1] interface gigabitethernet 0/0/1
[CE1-GigabitEthernet0/0/1] port link-type access
[CE1-GigabitEthernet0/0/1] port default vlan 6
[CE1-GigabitEthernet0/0/1] quit
[CE1] interface gigabitethernet 0/0/2
[CE1-GigabitEthernet0/0/2] port link-type access
[CE1-GigabitEthernet0/0/2] port default vlan 6
[CE1-GigabitEthernet0/0/2] quit
[CE1] interface gigabitethernet 0/0/3
[CE1-GigabitEthernet0/0/3] port link-type trunk
[CE1-GigabitEthernet0/0/3] port trunk allow-pass vlan 6
[CE1-GigabitEthernet0/0/3] quit
# Configure CE2.
<HUAWEI> system-view
[HUAWEI] sysname CE2
[CE2] vlan 5
[CE2-vlan5] quit
[CE2] interface gigabitethernet 0/0/1
[CE2-GigabitEthernet0/0/1] port link-type access
[CE2-GigabitEthernet0/0/1] port default vlan 5
[CE2-GigabitEthernet0/0/1] quit
[CE2] interface gigabitethernet 0/0/2
[CE2-GigabitEthernet0/0/2] port link-type access
[CE2-GigabitEthernet0/0/2] port default vlan 5
[CE2-GigabitEthernet0/0/2] quit
[CE2] interface gigabitethernet 0/0/3
[CE2-GigabitEthernet0/0/3] port link-type trunk
[CE2-GigabitEthernet0/0/3] port trunk allow-pass vlan 5
[CE2-GigabitEthernet0/0/3] quit
# Configure PE2.
<HUAWEI> system-view
[HUAWEI] sysname PE2
[PE2] vlan 10
[PE2-vlan10] quit
[PE2] interface gigabitethernet 0/0/1
[PE2-GigabitEthernet0/0/1] port link-type trunk
[PE2-GigabitEthernet0/0/1] port trunk allow-pass vlan 10
[PE2-GigabitEthernet0/0/1] qinq vlan-translation enable
[PE2-GigabitEthernet0/0/1] port vlan-mapping vlan 5 map-vlan 10
[PE2-GigabitEthernet0/0/1] quit
Configuration Files
● CE1 configuration file
#
sysname CE1
#
vlan batch 6
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 6
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 6
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 6
#
return
● CE2 configuration file
#
sysname CE2
#
vlan batch 5
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 5
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 5
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 5
#
return
● PE1 configuration file
#
sysname PE1
#
vlan batch 10
#
interface GigabitEthernet0/0/1
port link-type trunk
qinq vlan-translation enable
port trunk allow-pass vlan 10
Networking Requirements
In Figure 11-6, a large number of switches need to be deployed at the corridor so
that the same service used by different users can be sent on different VLANs. To
save VLAN resources, configure the VLAN aggregation function (N:1) on the
switches so that same services are sent on the same VLAN.
Internet
Switch GE0/0/1
VLAN100~109
SwitchA
…… …… ……
Configuration Roadmap
The configuration roadmap is as follows:
1. Create the original VLAN and the translated VLAN on the Switch and add
GE0/0/1 to the VLANs in tagged mode.
2. Configure VLAN mapping on GE0/0/1 on the Switch.
Procedure
Step 1 Configure the Switch.
# Create a VLAN.
<HUAWEI> system-view
[HUAWEI] sysname Switch
[Switch] vlan batch 10 100 to 109
----End
Configuration Files
● Switch configuration file
#
sysname Switch
#
vlan batch 10 100 to 109
#
interface gigabitethernet0/0/1
port link-type hybrid
qinq vlan-translation enable
port hybrid tagged vlan 10 100 to 109
port vlan-mapping vlan 100 to 109 map-vlan 10
#
return
Only the S1720X, S1720X-E, S5720HI, S5720EI, S5730SI, S5730S-EI, S6720LI, S6720S-LI,
S6720SI, S6720S-SI, S6720EI, and S6720S-EI support this example.
Internet
Community GE0/0/3
Switch IP 2 ~3 501
S5
GE0/0/2 GE0/0/1 IP 4 501
S1 GE0/0/4 GE0/0/4 S2
Residential
Gateway
GE
1
1
GE
/0/
GE0/0/2
GE0/0/2
/0/
0/0
0/0
0
0
GE
GE
/3
/3
Configuration Roadmap
The configuration roadmap is as follows:
1. Add switch ports connecting to users to specified VLANs to distinguish
different services.
2. Configure the QinQ function on the Corridor Switch to distinguish users and
services.
3. Configure VLAN mapping on the Community Switch to save VLAN resources.
Procedure
Step 1 Add downlink interfaces of S1 and S2 to specified VLANs.
# Configure S1.
<HUAWEI> system-view
[HUAWEI] sysname S1
[S1] vlan batch 2 to 4
[S1] interface gigabitethernet 0/0/1
[S1-GigabitEthernet0/0/1] port link-type access
[S1-GigabitEthernet0/0/1] port default vlan 2
[S1-GigabitEthernet0/0/1] quit
[S1] interface gigabitethernet 0/0/2
[S1-GigabitEthernet0/0/2] port link-type access
[S1-GigabitEthernet0/0/2] port default vlan 3
[S1-GigabitEthernet0/0/2] quit
[S1] interface gigabitethernet 0/0/3
[S1-GigabitEthernet0/0/3] port link-type access
[S1-GigabitEthernet0/0/3] port default vlan 4
[S1-GigabitEthernet0/0/3] quit
[S1] interface gigabitethernet 0/0/4
[S1-GigabitEthernet0/0/4] port link-type trunk
[S1-GigabitEthernet0/0/4] port trunk allow-pass vlan 2 to 4
[S1-GigabitEthernet0/0/4] quit
# Configure S2.
<HUAWEI> system-view
[HUAWEI] sysname S2
[S2] vlan batch 2 to 4
[S2] interface gigabitethernet 0/0/1
[S2-GigabitEthernet0/0/1] port link-type access
[S2-GigabitEthernet0/0/1] port default vlan 2
[S2-GigabitEthernet0/0/1] quit
[S2] interface gigabitethernet 0/0/2
[S2-GigabitEthernet0/0/2] port link-type access
[S2-GigabitEthernet0/0/2] port default vlan 3
[S2-GigabitEthernet0/0/2] quit
[S2] interface gigabitethernet 0/0/3
[S2-GigabitEthernet0/0/3] port link-type access
[S2-GigabitEthernet0/0/3] port default vlan 4
[S2-GigabitEthernet0/0/3] quit
[S2] interface gigabitethernet 0/0/4
[S2-GigabitEthernet0/0/4] port link-type trunk
[S2-GigabitEthernet0/0/4] port trunk allow-pass vlan 2 to 4
[S2-GigabitEthernet0/0/4] quit
Step 2 Configure the QinQ function on the Corridor Switch to allow the Corridor Switch
to send double-tagged packets to the Community Switch.
# Configure S3.
<HUAWEI> system-view
[HUAWEI] sysname S3
[S3] vlan batch 201 401
[S3] interface gigabitethernet 0/0/1
[S3-GigabitEthernet0/0/1] port link-type hybrid
[S3-GigabitEthernet0/0/1] port hybrid untagged vlan 201 401
[S3-GigabitEthernet0/0/1] qinq vlan-translation enable
[S3-GigabitEthernet0/0/1] port vlan-stacking vlan 2 to 3 stack-vlan 201
[S3-GigabitEthernet0/0/1] port vlan-stacking vlan 4 stack-vlan 401
[S3-GigabitEthernet0/0/1] quit
[S3] interface gigabitethernet 0/0/2
[S3-GigabitEthernet0/0/2] port link-type trunk
[S3-GigabitEthernet0/0/2] port trunk allow-pass vlan 201 401
[S3-GigabitEthernet0/0/2] quit
# Configure S4.
<HUAWEI> system-view
[HUAWEI] sysname S4
[S4] vlan batch 201 401
[S4] interface gigabitethernet 0/0/1
[S4-GigabitEthernet0/0/1] port link-type hybrid
[S4-GigabitEthernet0/0/1] port hybrid untagged vlan 201 401
Configuration Files
● Configuration file of S1
#
sysname S1
#
vlan batch 2 to 4
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 2
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 3
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 4
#
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 2 to 4
#
return
● Configuration file of S2
#
sysname S2
#
vlan batch 2 to 4
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 2
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 3
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 4
#
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 2 to 4
#
return
● Configuration file of S3
#
sysname S3
#
vlan batch 201 401
#
interface GigabitEthernet0/0/1
port link-type hybrid
qinq vlan-translation enable
port hybrid untagged vlan 201 401
port vlan-stacking vlan 2 to 3 stack-vlan 201
port vlan-stacking vlan 4 stack-vlan 401
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 201 401
#
return
● Configuration file of S4
#
sysname S4
#
vlan batch 201 401
#
interface GigabitEthernet0/0/1
port link-type hybrid
qinq vlan-translation enable
port hybrid untagged vlan 201 401
port vlan-stacking vlan 2 to 3 stack-vlan 201
port vlan-stacking vlan 4 stack-vlan 401
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 201 401
#
return
● Configuration file of S5
#
sysname S5
#
vlan batch 501
#
interface GigabitEthernet0/0/1
port link-type trunk
qinq vlan-translation enable
port trunk allow-pass vlan 501
port vlan-mapping vlan 201 inner-vlan 2 to 3 map-vlan
501
port vlan-mapping vlan 401 inner-vlan 4 map-vlan 501
#
interface GigabitEthernet0/0/2
port link-type trunk
qinq vlan-translation enable
port trunk allow-pass vlan 501
port vlan-mapping vlan 201 inner-vlan 2 to 3 map-vlan
501
port vlan-mapping vlan 401 inner-vlan 4 map-vlan 501
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 501
#
return
Only the S1720X, S1720X-E, S5720HI, S5720EI, S5730SI, S5730S-EI, S6720LI, S6720S-LI,
S6720SI, S6720S-SI, S6720EI, and S6720S-EI support this example.
QinQ is used to send double-tagged packets, which prevents the conflict between
C-VLAN IDs and S-VLAN IDs and differentiates services and users. However, the
interface will discard the packets because C-VLAN IDs are different from S-VLAN
IDs. To ensure communication continuity, configure 2:2 VLAN mapping on the PE
and replace double C-VLAN tags with double S-VLAN tags.
In Figure 11-8, users send double-tagged packets to the ISP network. These
packets cannot be sent successfully because the VLAN IDs are different from the
S-VLAN IDs. To solve this problem, ensure that the users of the Switch5 and
Switch6 can communicate.
Switch2 Switch3
ISP
outside tag:50
inner tag:60
GE0/0/1 GE0/0/1
GE0/0/2 GE0/0/2
Switch1 Switch4
GE0/0/1 GE0/0/1
GE0/0/2
GE0/0/2
Switch5 Switch6
GE0/0/1 GE0/0/1
VLAN 10 VLAN 30
VLAN Mapping
Configuration Roadmap
The configuration roadmap is as follows:
Procedure
Step 1 Add downlink interfaces on switches to specified VLANs.
# Configure Switch5.
<HUAWEI> system-view
[HUAWEI] sysname Switch5
[Switch5] vlan 10
[Switch5-vlan10] quit
[Switch5] interface gigabitethernet 0/0/1
[Switch5-GigabitEthernet0/0/1] port link-type access
[Switch5-GigabitEthernet0/0/1] port default vlan 10
[Switch5-GigabitEthernet0/0/1] quit
[Switch5] interface gigabitethernet 0/0/2
[Switch5-GigabitEthernet0/0/2] port link-type trunk
[Switch5-GigabitEthernet0/0/2] port trunk allow-pass vlan 10
# Configure Switch6.
<HUAWEI> system-view
[HUAWEI] sysname Switch6
[Switch6] vlan 30
[Switch6-vlan30] quit
[Switch6] interface gigabitethernet 0/0/1
[Switch6-GigabitEthernet0/0/1] port link-type access
[Switch6-GigabitEthernet0/0/1] port default vlan 30
[Switch6-GigabitEthernet0/0/1] quit
[Switch6] interface gigabitethernet 0/0/2
[Switch6-GigabitEthernet0/0/2] port link-type trunk
[Switch6-GigabitEthernet0/0/2] port trunk allow-pass vlan 30
Step 2 Configure the QinQ function on Switch1 and Switch4 so that packets sent to the
ISP network are double-tagged.
# Configure Switch 1.
<HUAWEI> system-view
[HUAWEI] sysname Switch1
[Switch1] vlan 20
[Switch1-vlan20] quit
[Switch1] interface gigabitethernet 0/0/1
[Switch1-GigabitEthernet0/0/1] port link-type hybrid
[Switch1-GigabitEthernet0/0/1] port hybrid untagged vlan 20
[Switch1-GigabitEthernet0/0/1] qinq vlan-translation enable
[Switch1-GigabitEthernet0/0/1] port vlan-stacking vlan 10 stack-vlan 20
[Switch1-GigabitEthernet0/0/1] quit
[Switch1] interface gigabitethernet 0/0/2
[Switch1-GigabitEthernet0/0/2] port link-type trunk
[Switch1-GigabitEthernet0/0/2] port trunk allow-pass vlan 20
[Switch1-GigabitEthernet0/0/2] quit
# Configure Switch 4.
<HUAWEI> system-view
[HUAWEI] sysname Switch4
[Switch4] vlan 40
[Switch4-vlan40] quit
[Switch4] interface gigabitethernet 0/0/1
[Switch4-GigabitEthernet0/0/1] port link-type hybrid
[Switch4-GigabitEthernet0/0/1] port hybrid untagged vlan 40
[Switch4-GigabitEthernet0/0/1] qinq vlan-translation enable
[Switch4-GigabitEthernet0/0/1] port vlan-stacking vlan 30 stack-vlan 40
[Switch4-GigabitEthernet0/0/1] quit
[Switch4] interface gigabitethernet 0/0/2
[Switch4-GigabitEthernet0/0/2] port link-type trunk
[Switch4-GigabitEthernet0/0/2] port trunk allow-pass vlan 40
[Switch4-GigabitEthernet0/0/2] quit
Step 3 Configure 2:2 VLAN mapping on switches connected to the ISP network.
# Configure Switch2.
<HUAWEI> system-view
[HUAWEI] sysname Switch2
[Switch2] interface gigabitethernet 0/0/1
[Switch2-GigabitEthernet0/0/1] port link-type hybrid
[Switch2-GigabitEthernet0/0/1] port hybrid tagged vlan 50
[Switch2-GigabitEthernet0/0/1] qinq vlan-translation enable
[Switch2-GigabitEthernet0/0/1] port vlan-mapping vlan 20 inner-vlan 10 map-vlan 50 map-inner-vlan
60
# Configure Switch3.
<HUAWEI> system-view
[HUAWEI] sysname Switch3
[Switch3] interface gigabitethernet 0/0/1
[Switch3-GigabitEthernet0/0/1] port link-type hybrid
[Switch3-GigabitEthernet0/0/1] port hybrid tagged vlan 50
Verify that users connected to Switch5 and users connected to Switch6 can
communicate with each other.
----End
Configuration Files
● Switch1 configuration file
#
sysname Switch1
#
vlan batch 20
#
interface GigabitEthernet0/0/1
port link-type hybrid
qinq vlan-translation enable
port hybrid untagged vlan 20
port vlan-stacking vlan 10 stack-vlan 20
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
return
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 40
#
return
ISP network
VLAN10
SwitchC SwitchD
GE0/0/1 GE0/0/1
SwitchA SwitchB
VLAN6 GE0/0/1 GE0/0/1 VLAN5
GE0/0/2 GE0/0/3 GE0/0/3
GE0/0/2
Procedure
1. In the user view, run the display vlan command to verify that the translated
VLAN (map-vlan) is created.
– If the translated VLAN has not been created, run the vlan command to
create it.
– If the translated VLAN is created, go to the next step.
2. In the interface view, run the display this command to verify that the
interfaces configured with VLAN mapping have been added to the translated
VLAN in tagged mode.
NOTE
● VLAN mapping can be configured only on a trunk or hybrid interface, and the hybrid
interface must be added to the translated VLAN in tagged mode.
● If a range of original VLANs is specified by vlan-id1 to vlan-id2 on an interface, the
interface must be added to all the original VLANs in tagged mode, and the translated
VLAN cannot have a VLANIF interface.
● Limiting MAC address learning on an interface may affect N:1 VLAN mapping on the
interface.
– If the interfaces configured with VLAN mapping have not been added to
the translated VLAN in tagged mode, run the port trunk allow-pass vlan
or port hybrid tagged vlan command in the interface view to add the
interfaces to the translated VLAN in tagged mode.
– If the interfaces have been added to the translated VLAN in tagged
mode, go to the next step.
3. In the interface view, run the display this command to verify that the
translated VLAN ID configured on the interface is the same as the S-VLAN ID
assigned by the carrier.
– If the translated VLAN ID on an interface is different from the S-VLAN ID
assigned by the carrier, run the undo port vlan-mapping command on
the interface to delete the VLAN mapping configuration, and run the
port vlan-mapping vlan command to set the translated VLAN ID to the
S-VLAN ID.
– If the translated VLAN ID is the same as the S-VLAN ID assigned by the
carrier, go to the next step.
4. In the user view, run the display vlan vlan-id command to verify that user-
side interfaces are added to C-VLANs.
If the user-side interfaces are not in the C-VLANs, run the port trunk allow-
pass vlan, port hybrid tagged vlan, or port default vlan command to add
the interfaces to the C-VLANs.