4-VLAN Mapping Configuration
4-VLAN Mapping Configuration
This chapter describes how to configure VLAN mapping. VLAN mapping is configured on
the edge device of the public network so that the VLANs of private networks are isolated
from S-VLANs. This saves S-VLAN resources.
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.
11.2 Principles
Working Mechanism
Depending on whether a packet is tagged or untagged, the switch processes a received packet
as follows:
l 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.
l 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
2
3
2
172.16.0.1/16 172.16.0.7/16
If devices in two VLANs need to communicate based on VLAN mapping, the IP addresses of
these devices must be on the same network segment. If their IP addresses are on different
network segments, communication between these devices must be implemented using Layer 3
routes, which makes VLAN mapping invalid.
switch can re-mark the VLAN ID in packets matching the traffic classifier. MQC-based
VLAN mapping implements differentiated services.
11.3 Applications
l 1:1 VLAN mapping
When receiving a single-tagged packet, the interface maps the VLAN tag to a specified
single VLAN tag.
1:1 VLAN mapping applies to the network shown in Figure 11-2.
IPTV
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).
l 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
Corridor IP 201 2 ~3
S3 S4
Switch IP 401 4
Residential
S1 Gateway S2
In the networking diagram shown in Figure 11-3, Residential Gateway, Corridor Switch,
and Community Switch are connected to the aggregation layer on the network. To
differentiate users and services to facilitate network management and charging, configure
the QinQ function for Corridor Switch. To save VLAN resources, configure VLAN
mapping on Community Switch to transmit the same services on the same VLAN.
Switch2 Switch3
Internet
outside tag:50
inner tag:60
Switch1 Switch4
In the networking diagram shown in Figure 11-4, 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.
License Support
VLAN mapping is a basic feature of a switch and is not under license control.
NOTE
To know details about software mappings, see Version Mapping Search for Huawei Switches.
Pre-configuration Tasks
Before configuring VLAN ID-based VLAN mapping, complete the following tasks:
l Create the specified VLAN.
l Add the primary interface to the mapped VLAN.
Context
When receiving a tagged packet, an interface maps the VLAN ID in the packet to an S-VLAN
ID.
Procedure
Step 1 Run:
system-view
NOTE
l 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.
l N:1 VLAN mapping takes effect only when the packets with original VLANs are sent first.
l LE1D2S04SEC0, LE1D2X32SEC0, and LE1D2H02QEC0 cards, and X series cards, and SA boards
of S series cards do not support N:1 VLAN mapping.
l N:1 VLAN mapping is not supported on the Eth-Trunk interface.
----End
Context
When receiving a tagged packet, an interface maps the VLAN ID in the packet to an S-VLAN
ID.
NOTE
The LE0MG24CA and LE0MG24SA cards do not support VLAN mapping for double-tagged packets.
Procedure
Step 1 Run:
system-view
Step 3 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
The LE0MG24CA and LE0MG24SA cards do not support VLAN mapping for double-tagged packets.
Procedure
Step 1 Run:
system-view
Step 2 Run:
interface interface-type interface-number
Step 3 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
l Run the display vlan vlan-id command to check whether the interface is added to the
translated S-VLAN.
l Run the display current-configuration command to check the VLAN mapping
configuration on the interface.
----End
Procedure
l Configuring VLAN mapping on the inbound interface based on the 802.1p priority
a. Run:
system-view
VLAN mapping based on the 802.1p priority is not supported on the SA boards of S series.
l (Optional) Configuring VLAN mapping on the outbound interface based on the 802.1p
priority
If the DiffServ domain is created on the inbound interface and VLAN mapping is
configured based on the priority, the internal priority may be different from the 802p.1
priority. You are advised to configure VLAN mapping on the outbound interface based
on the 802.1p priority.
a. Run:
system-view
The DiffServ domain is created, and the DiffServ domain view is displayed.
c. Run:
8021p-outbound service-class color map 8021p-value
The internal priority of VLAN packets on the outbound interface in the DiffServ
domain is mapped to the 802.1p priority.
d. Run:
quit
The DiffServ domain is bound on the interface and the mapping in the DiffServ
domain is applied.
By default, an internal priority remains the same after being mapped to an external
priority.
----End
Procedure
1. Configure a traffic classifier.
a. Run:
system-view
A traffic classifier is created and the traffic classifier view is displayed, or the
existing traffic classifier view is displayed.
and is the logical operator between the rules in the traffic classifier, which means
that:
n 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.
n 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 as long as
they match one of 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
The if-match ip-precedence and if-match tcp commands are only valid for IPv4 packets.
The LE1D2S04SEC0, LE1D2X32SEC0, and LE1D2H02QEC0 cards, and X series cards do
not support traffic classifiers with advanced ACLs containing the ttl-expired field or user-
defined ACLs.
When a traffic classifier contains if-match ipv6 acl { acl-number | acl-name }, the
LE1D2S04SEC0, LE1D2X32SEC0, and LE1D2H02QEC0 cards, and X series cards do not
support add-tag vlan-id vlan-id, remark 8021p [ 8021p-value | inner-8021p ], remark
cvlan-id cvlan-id, remark vlan-id vlan-id, or mac-address learning disable.
d. Run:
quit
The traffic behavior is configured. The outer VLAN ID of the packet is re-marked.
c. (Optional) Run:
remark cvlan-id vlan-id4
The traffic behavior is configured. The inner VLAN ID of the packet is re-marked.
d. Run:
quit
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
change the matching order of traffic classifiers in the traffic policy. To change the
matching order, delete the traffic policy and create a traffic policy with the required
matching order.
When creating a traffic policy, you can specify the matching order of traffic
classifiers in the traffic policy. The traffic classifiers can be matched in automatic
order (auto) or configuration order (config):
n If the matching order is auto, traffic classifiers are matched in descending
order of priorities pre-defined in the system: traffic classifiers based on Layer
2 and Layer 3 information, traffic classifiers based on Layer 2 information, and
finally traffic classifiers based on Layer 3 information. If a data flow matches
multiple traffic classifiers that are associated with conflicting traffic behavior,
the traffic behavior associated with the traffic classifier of the highest priority
takes effect.
n If the matching order is config, traffic classifiers are matched in descending
order of priorities either manually or dynamically allocated to them. This is
determined by the precedence value; a traffic classifier with a smaller
precedence value has a higher priority and is matched earlier. If you do not
specify precedence-value when creating a traffic classifier, the system
allocates a precedence value to the traffic classifier. The allocated value is
[(max-precedence + 5)/5] x 5, where max-precedence is the greatest value
among existing traffic classifiers.
NOTE
If more than 128 rate limiting ACL rules are configured in the system, traffic policies must
be applied to the interface view, VLAN view, and system view in sequence. To update an
ACL rule, delete all the associated traffic policies from the interface, VLAN, and system.
Then, reconfigure the traffic policies and reapply them to the interface, VLAN, and system.
b. Run:
classifier classifier-name behavior behavior-name
Context
During VLAN Mapping configuration, VLAN translation resources may be insufficient. You
can run command 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.
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.
NOTE
Only the LE1D2S04SEC0, LE1D2X32SEC0, and LE1D2H02QEC0 cards, and X series cards support
this command.
----End
Networking Requirements
Users in different communities use the same services, such as the web, IPTV, and VoIP
services. To facilitate management, the network administrator of each community adds
different services to different VLANs. For communities in different VLANs to use the same
services, communication between VLANs must be implemented.
In Figure 11-5, community 1 and community 2 have the same services, but belong to
different VLANs. Communication between them needs to be implemented with low costs.
C o m m u n ity 1 C o m m u n ity 2
VLAN 6 VLAN 5
1 7 2 .1 6 .0 .2 /1 6 1 7 2 .1 6 .0 .6 /1 6
1 7 2 .1 6 .0 .1 /1 6 1 7 2 .1 6 .0 .3 /1 6 1 7 2 .1 6 .0 .5 /1 6 1 7 2 .1 6 .0 .7 /1 6
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 GE1/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.
<Quidway> system-view
[Quidway] sysname CE1
[CE1] vlan 6
[CE1-vlan6] quit
[CE1] interface gigabitethernet 1/0/1
[CE1-GigabitEthernet1/0/1] port link-type access
[CE1-GigabitEthernet1/0/1] port default vlan 6
[CE1-GigabitEthernet1/0/1] quit
[CE1] interface gigabitethernet 1/0/2
[CE1-GigabitEthernet1/0/2] port link-type access
[CE1-GigabitEthernet1/0/2] port default vlan 6
[CE1-GigabitEthernet1/0/2] quit
[CE1] interface gigabitethernet 1/0/3
[CE1-GigabitEthernet1/0/3] port link-type trunk
[CE1-GigabitEthernet1/0/3] port trunk allow-pass vlan 6
[CE1-GigabitEthernet1/0/3] quit
# Configure CE2.
<Quidway> system-view
[Quidway] sysname CE2
[CE2] vlan 5
[CE2-vlan5] quit
[CE2] interface gigabitethernet 1/0/1
[CE2-GigabitEthernet1/0/1] port link-type access
[CE2-GigabitEthernet1/0/1] port default vlan 5
[CE2-GigabitEthernet1/0/1] quit
[CE2] interface gigabitethernet 1/0/2
[CE2-GigabitEthernet1/0/2] port link-type access
[CE2-GigabitEthernet1/0/2] port default vlan 5
[CE2-GigabitEthernet1/0/2] quit
[CE2] interface gigabitethernet 1/0/3
[CE2-GigabitEthernet1/0/3] port link-type trunk
[CE2-GigabitEthernet1/0/3] port trunk allow-pass vlan 5
[CE2-GigabitEthernet1/0/3] quit
# Configure PE2.
<Quidway> system-view
[Quidway] sysname PE2
[PE2] vlan 10
[PE2-vlan10] quit
----End
Configuration Files
l CE1 configuration file
#
sysname CE1
#
vlan batch 6
#
interface GigabitEthernet1/0/1
port link-type access
port default vlan 6
#
interface GigabitEthernet1/0/2
port link-type access
port default vlan 6
#
interface GigabitEthernet1/0/3
port link-type trunk
port trunk allow-pass vlan 6
#
return
#
sysname PE2
#
vlan batch 10
#
interface GigabitEthernet1/0/1
port link-type trunk
port trunk allow-pass vlan 10
port vlan-mapping vlan 5 map-vlan 10
#
return
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.
In te rn e t
VLAN 10
S w itc h G E 1 /0 /1
VLAN 100~109
S w itc h A
…… …… ……
Configuration Roadmap
The configuration roadmap is as follows:
1. Create the original VLAN and the translated VLAN on the Switch and add GE1/0/1 to
the VLANs in tagged mode.
2. Configure VLAN mapping on GE1/0/1 on the Switch.
Procedure
Step 1 Configure the Switch.
# Create a VLAN.
<Quidway> system-view
[Quidway] sysname Switch
[Switch] vlan batch 10 100 to 109
----End
Configuration Files
l Switch configuration file
#
sysname Switch
#
vlan batch 10 100 to 109
#
interface gigabitethernet1/0/1
port hybrid tagged vlan 10 100 to 109
port vlan-mapping vlan 100 to 109 map-vlan 10
#
return
Internet
Community GE1/0/3
Switch IP 2 ~3 501
S5
GE1/0/2 GE1/0/1 IP 4 501
S1 GE1/0/4 GE1/0/4 S2
Residential /1
GE
Gateway
/1
GE
GE1/0/2
GE1/0/2
1/0
1/0
1/0
1/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.
<Quidway> system-view
[Quidway] sysname S1
[S1] vlan batch 2 to 4
[S1] interface gigabitethernet 1/0/1
[S1-GigabitEthernet1/0/1] port link-type access
[S1-GigabitEthernet1/0/1] port default vlan 2
[S1-GigabitEthernet1/0/1] quit
# Configure S2.
<Quidway> system-view
[Quidway] sysname S2
[S2] vlan batch 2 to 4
[S2] interface gigabitethernet 1/0/1
[S2-GigabitEthernet1/0/1] port link-type access
[S2-GigabitEthernet1/0/1] port default vlan 2
[S2-GigabitEthernet1/0/1] quit
[S2] interface gigabitethernet 1/0/2
[S2-GigabitEthernet1/0/2] port link-type access
[S2-GigabitEthernet1/0/2] port default vlan 3
[S2-GigabitEthernet1/0/2] quit
[S2] interface gigabitethernet 1/0/3
[S2-GigabitEthernet1/0/3] port link-type access
[S2-GigabitEthernet1/0/3] port default vlan 4
[S2-GigabitEthernet1/0/3] quit
[S2] interface gigabitethernet 1/0/4
[S2-GigabitEthernet1/0/4] port link-type trunk
[S2-GigabitEthernet1/0/4] port trunk allow-pass vlan 2 to 4
[S2-GigabitEthernet1/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.
<Quidway> system-view
[Quidway] sysname S3
[S3] vlan batch 201 401
[S3] interface gigabitethernet 1/0/1
[S3-GigabitEthernet1/0/1] port link-type trunk
[S3-GigabitEthernet1/0/1] port trunk allow-pass vlan 201 401
[S3-GigabitEthernet1/0/1] port vlan-stacking vlan 2 to 3 stack-vlan 201
[S3-GigabitEthernet1/0/1] port vlan-stacking vlan 4 stack-vlan 401
[S3-GigabitEthernet1/0/1] quit
[S3] interface gigabitethernet 1/0/2
[S3-GigabitEthernet1/0/2] port link-type trunk
[S3-GigabitEthernet1/0/2] port trunk allow-pass vlan 201 401
[S3-GigabitEthernet1/0/2] quit
# Configure S4.
<Quidway> system-view
[Quidway] sysname S4
[S4] vlan batch 201 401
[S4] interface gigabitethernet 1/0/1
[S4-GigabitEthernet1/0/1] port link-type trunk
[S4-GigabitEthernet1/0/1] port trunk allow-pass vlan 201 401
[S4-GigabitEthernet1/0/1] port vlan-stacking vlan 2 to 3 stack-vlan 201
[S4-GigabitEthernet1/0/1] port vlan-stacking vlan 4 stack-vlan 401
[S4-GigabitEthernet1/0/1] quit
[S4] interface gigabitethernet 1/0/2
[S4-GigabitEthernet1/0/2] port link-type trunk
[S4-GigabitEthernet1/0/2] port trunk allow-pass vlan 201 401
[S4-GigabitEthernet1/0/2] quit
----End
Configuration Files
l Configuration file of S1
#
sysname S1
#
vlan batch 2 to 4
#
interace GigabitEthernet1/0/1
port link-type access
port default vlan 2
#
interface GigabitEthernet1/0/2
port link-type access
port default vlan 3
#
interface GigabitEthernet1/0/3
port link-type access
port default vlan 4
#
interface GigabitEthernet1/0/4
port link-type trunk
port trunk allow-pass vlan 2 to 4
#
return
l Configuration file of S2
#
sysname S2
#
vlan batch 2 to 4
#
interface GigabitEthernet1/0/1
port link-type access
port default vlan 2
#
interface GigabitEthernet1/0/2
Switch2 Switch3
ISP
outside tag:50
inner tag:60
GE1/0/1 GE1/0/1
GE1/0/2 GE1/0/2
Switch1 Switch4
GE1/0/1 GE1/0/1
GE1/0/2
GE1/0/2
Switch5 Switch6
GE1/0/1 GE1/0/1
VLAN 10 VLAN 30
VLAN Mapping
Configuration Roadmap
The configuration roadmap is as follows:
1. Add switch ports connecting to users to VLAN 10 and VLAN 30.
2. Configure the QinQ function on Switch1 and Switch4 so that packets sent to the ISP
network are double-tagged.
3. Configure 2:2 VLAN mapping on switches connected to the ISP network.
Procedure
Step 1 Add downlink interfaces on switches to specified VLANs.
# Configure Switch5.
<Quidway> system-view
[Quidway] sysname Switch5
[Switch5] vlan 10
[Switch5-vlan10] quit
[Switch5] interface gigabitethernet 1/0/1
[Switch5-GigabitEthernet1/0/1] port link-type access
[Switch5-GigabitEthernet1/0/1] port default vlan 10
[Switch5-GigabitEthernet1/0/1] quit
[Switch5] interface gigabitethernet 1/0/2
[Switch5-GigabitEthernet1/0/2] port link-type trunk
[Switch5-GigabitEthernet1/0/2] port trunk allow-pass vlan 10
# Configure Switch6.
<Quidway> system-view
[Quidway] sysname Switch6
[Switch6] vlan 30
[Switch6-vlan30] quit
[Switch6] interface gigabitethernet 1/0/1
[Switch6-GigabitEthernet1/0/1] port link-type access
[Switch6-GigabitEthernet1/0/1] port default vlan 30
[Switch6-GigabitEthernet1/0/1] quit
[Switch6] interface gigabitethernet 1/0/2
[Switch6-GigabitEthernet1/0/2] port link-type trunk
[Switch6-GigabitEthernet1/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.
<Quidway> system-view
[Quidway] sysname Switch1
[Switch1] vlan 20
[Switch1-vlan20] quit
[Switch1] interface gigabitethernet 1/0/1
[Switch1-GigabitEthernet1/0/1] port hybrid untagged vlan 20
[Switch1-GigabitEthernet1/0/1] port vlan-stacking vlan 10 stack-vlan 20
[Switch1-GigabitEthernet1/0/1] quit
[Switch1] interface gigabitethernet 1/0/2
[Switch1-GigabitEthernet1/0/2] port link-type trunk
[Switch1-GigabitEthernet1/0/2] port trunk allow-pass vlan 20
[Switch1-GigabitEthernet1/0/2] quit
# Configure Switch 4.
<Quidway> system-view
[Quidway] sysname Switch4
[Switch4] vlan 40
[Switch4-vlan40] quit
[Switch4] interface gigabitethernet 1/0/1
[Switch4-GigabitEthernet1/0/1] port hybrid untagged vlan 40
[Switch4-GigabitEthernet1/0/1] port vlan-stacking vlan 30 stack-vlan 40
[Switch4-GigabitEthernet1/0/1] quit
[Switch4] interface gigabitethernet 1/0/2
[Switch4-GigabitEthernet1/0/2] port link-type trunk
Step 3 Configure 2:2 VLAN mapping on the switch connecting to the ISP network.
# Configure Switch2.
<Quidway> system-view
[Quidway] sysname Switch2
[Switch2] interface gigabitethernet 1/0/1
[Switch2-GigabitEthernet1/0/1] port hybrid tagged vlan 50
[Switch2-GigabitEthernet1/0/1] port vlan-mapping vlan 20 inner-vlan 10 map-vlan
50 map-inner-vlan 60
# Configure Switch3.
<Quidway> system-view
[Quidway] sysname Switch3
[Switch3] interface gigabitethernet 1/0/1
[Switch3-GigabitEthernet1/0/1] port hybrid tagged vlan 50
[Switch3-GigabitEthernet1/0/1] port vlan-mapping vlan 40 inner-vlan 30 map-vlan
50 map-inner-vlan 60
----End
Configuration Files
l Switch1 configuration file
#
sysname Switch1
#
vlan batch 20
#
interface GigabitEthernet1/0/1
port hybrid untagged vlan 20
port vlan-stacking vlan 10 stack-vlan 20
#
interface GigabitEthernet1/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
return
ISP Network
Outer VLAN 300
Inner VLAN 30
SwitchC SwitchD
GE1/0/1 GE1/0/2
Enterprises A Enterprises B
Outer VLAN 100 Outer VLAN 200
Inner VLAN 10 Inner VLAN 20
Configuration Roadmap
The configuration roadmap is as follows:
1. Create outer VLANs on SwitchA, SwitchB, SwitchC, and SwitchD.
2. Create classes, traffic behaviors, and traffic policies on SwitchA and SwitchB.
3. Add interfaces on SwitchA, SwitchB, SwitchC, and SwitchD to their own VLANs.
4. Configure traffic policy-based VLAN mapping of double tags on GE1/0/1 of SwitchA.
5. Configure traffic policy-based VLAN mapping of double tags on GE1/0/2 of SwitchB.
Procedure
Step 1 Configure VLANs.
# Create VLAN 100 and VLAN 300 on SwitchA.
<Quidway> system-view
[Quidway] sysname SwitchA
[SwitchA] vlan batch 100 300
# Configure the traffic classifier, traffic behavior, and traffic policy in the outbound direction
of SwitchA.
[SwitchA] traffic classifier name2 operator and
[SwitchA-classifier-name2] if-match vlan-id 100
[SwitchA-classifier-name2] if-match cvlan-id 10
[SwitchA-classifier-name2] quit
[SwitchA] traffic behavior name2
[SwitchA-behavior-name2] remark vlan-id 300
[SwitchA-behavior-name2] remark cvlan-id 30
[SwitchA-behavior-name2] quit
[SwitchA] traffic policy name2
[SwitchA-trafficpolicy-name2] classifier name2 behavior name2
[SwitchA-trafficpolicy-name2] quit
# Configure the traffic classifier, traffic behavior, and traffic policy in the inbound direction of
SwitchB.
[SwitchB] traffic classifier name1 operator and
[SwitchB-classifier-name1] if-match vlan-id 300
[SwitchB-classifier-name1] if-match cvlan-id 30
[SwitchB-classifier-name1] quit
# Configure the traffic classifier, traffic behavior, and traffic policy in the outbound direction
of SwitchB.
[SwitchB] traffic classifier name2 operator and
[SwitchB-classifier-name2] if-match vlan-id 200
[SwitchB-classifier-name2] if-match cvlan-id 20
[SwitchB-classifier-name2] quit
[SwitchB] traffic behavior name2
[SwitchB-behavior-name2] remark vlan-id 300
[SwitchB-behavior-name2] remark cvlan-id 30
[SwitchB-behavior-name2] quit
[SwitchB] traffic policy name2
[SwitchB-trafficpolicy-name2] classifier name2 behavior name2
[SwitchB-trafficpolicy-name2] quit
----End
Configuration Files
l SwitchA configuration file
#
sysname SwitchA
#
vlan batch 100 300
#
traffic classifier name1 operator and precedence 5
if-match vlan-id 300
if-match cvlan-id 30
traffic classifier name2 operator and precedence 10
if-match vlan-id 100
if-match cvlan-id 10
#
traffic behavior name1
permit
remark vlan-id 100
remark cvlan-id 10
traffic behavior name2
permit
remark vlan-id 300
remark cvlan-id 30
#
traffic policy name1 match-order config
Symptom
In Figure 11-10, users in VLAN 6 need to communicate with users in VLAN 5 over an ISP
network. The carrier assigns VLAN 10 as the S-VLAN. Single-tag VLAN mapping is
configured on GE 1/0/1 of SwitchC and SwitchD to map C-VLANs 5 and 6 to S-VLAN 10.
IS P n e tw o rk
VLAN 10
S w itc h C S w itc h D
G E 1 /0 /1 G E 1 /0 /1
S w itc h A S w itc h B
VLAN 6 G E 1 /0 /1 G E 1 /0 /1 VLAN 5
G E 1 /0 /2 G E 1 /0 /3 G E 1 /0 /3
G E 1 /0 /2
1 7 2 .1 6 .0 .1 /1 6 1 7 2 .1 6 .0 .2 /1 6 1 7 2 .1 6 .0 .3 /1 6 1 7 2 .1 6 .0 .5 /1 6 1 7 2 .1 6 .0 .6 /1 6 1 7 2 .1 6 .0 .7 /1 6
After VLAN mapping is configured on the interfaces, users in different VLANs cannot
communicate with each other. This fault is commonly caused by one of the following:
l The translated VLAN (map-vlan) has not been created.
l The interfaces configured with VLAN mapping are not added to the translated VLAN.
l The translated VLAN ID configured on SwitchC and SwitchD is different from the S-
VLAN ID assigned by the carrier.
l The interfaces configured with VLAN mapping are faulty.
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
l 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.
l 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.
l 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.