One-to-two and two-to-two VLAN mapping configuration example
Network requirements
As shown in Figure 80:
Two VPN A branches, Site 1 and Site 2, are in VLAN 5 and VLAN 6, respectively.
The two sites use different VPN access services from different service providers, SP 1 and SP 2.
SP 1 assigns VLAN 100 to Site 1 and Site 2. SP 2 assigns VLAN 200 to Site 1 and Site 2.
Configure one-to-two VLAN mappings and two-to-two VLAN mappings to enable the two branches to communicate across networks SP 1 and SP 2.
Figure 80: Network diagram
Configuration procedure
Configure PE 1:
# Create VLANs 5 and 100.
<PE1> system-view [PE1] vlan 5 [PE1-vlan5] quit [PE1] vlan 100 [PE1-vlan100] quit
# Configure a one-to-two VLAN mapping on the customer-side port (HundredGigE 1/0/1) to add SVLAN tag 100 to packets from VLAN 5.
[PE1] interface hundredgige 1/0/1 [PE1-HundredGigE1/0/1] vlan mapping nest single 5 nested-vlan 100
# Configure HundredGigE 1/0/1 as a hybrid port.
[PE1-HundredGigE1/0/1] port link-type hybrid
# Assign HundredGigE 1/0/1 to VLAN 5 as a tagged member.
[PE1-HundredGigE1/0/1] port hybrid vlan 5 tagged
# Assign HundredGigE 1/0/1 to VLAN 100 as an untagged member.
[PE1-HundredGigE1/0/1] port hybrid vlan 100 untagged [PE1-HundredGigE1/0/1] quit
# Configure the network-side port (HundredGigE 1/0/2) as a trunk port.
[PE1] interface hundredgige 1/0/2 [PE1-HundredGigE1/0/2] port link-type trunk
# Assign HundredGigE 1/0/2 to VLAN 100.
[PE1-HundredGigE1/0/2] port trunk permit vlan 100 [PE1-HundredGigE1/0/2] quit
Configure PE 2:
# Create VLAN 100.
<PE2> system-view [PE2] vlan 100 [PE2-vlan100] quit
# Configure HundredGigE 1/0/1 as a trunk port.
[PE2] interface hundredgige 1/0/1 [PE2-HundredGigE1/0/1] port link-type trunk
# Assign HundredGigE 1/0/1 to VLAN 100.
[PE2-HundredGigE1/0/1] port trunk permit vlan 100 [PE2-HundredGigE1/0/1] quit
# Configure HundredGigE 1/0/2 as a trunk port.
[PE2] interface hundredgige 1/0/2 [PE2-HundredGigE1/0/2] port link-type trunk
# Assign HundredGigE 1/0/2 to VLAN 100.
[PE2-HundredGigE1/0/2] port trunk permit vlan 100 [PE2-HundredGigE1/0/2] quit
Configure PE 3:
# Create VLANs 5, 6, 100, and 200.
<PE3> system-view [PE3] vlan 5 to 6 [PE3] vlan 100 [PE3-vlan100] quit [PE3] vlan 200 [PE3-vlan200] quit
# Configure HundredGigE 1/0/1 as a trunk port.
[PE3] interface hundredgige 1/0/1 [PE3-HundredGigE1/0/1] port link-type trunk
# Assign HundredGigE 1/0/1 to VLANs 100 and 200.
[PE3-HundredGigE1/0/1] port trunk permit vlan 100 200
# Configure a two-to-two VLAN mapping on HundredGigE 1/0/1 to map SVLAN 100 and CVLAN 5 to SVLAN 200 and CVLAN 6.
[PE3-HundredGigE1/0/1] vlan mapping tunnel 100 5 translated-vlan 200 6 [PE3-HundredGigE1/0/1] quit
# Configure HundredGigE 1/0/2 as a trunk port.
[PE3] interface hundredgige 1/0/2 [PE3-HundredGigE1/0/2] port link-type trunk
# Assign HundredGigE 1/0/2 to VLAN 200.
[PE3-HundredGigE1/0/2] port trunk permit vlan 200 [PE3-HundredGigE1/0/2] quit
Configure PE 4:
# Create VLANs 6 and 200.
<PE4> system-view [PE4] vlan 6 [PE4-vlan6] quit [PE4] vlan 200 [PE4-vlan200] quit
# Configure the network-side port (HundredGigE 1/0/1) as a trunk port.
[PE4] interface hundredgige 1/0/1 [PE4-HundredGigE1/0/1] port link-type trunk
# Assign HundredGigE 1/0/1 to VLAN 200.
[PE4-HundredGigE1/0/1] port trunk permit vlan 200 [PE4-HundredGigE1/0/1] quit
# Configure the customer-side port (HundredGigE 1/0/2) as a hybrid port.
[PE4] interface hundredgige 1/0/2 [PE4-HundredGigE1/0/2] port link-type hybrid
# Assign HundredGigE 1/0/2 to VLAN 6 as a tagged member.
[PE4-HundredGigE1/0/2] port hybrid vlan 6 tagged
# Assign HundredGigE 1/0/2 to VLAN 200 as an untagged member.
[PE4-HundredGigE1/0/2] port hybrid vlan 200 untagged
# Configure a one-to-two VLAN mapping on HundredGigE 1/0/2 to add SVLAN tag 200 to packets from VLAN 6.
[PE4-HundredGigE1/0/2] vlan mapping nest single 6 nested-vlan 200 [PE4-HundredGigE1/0/2] quit
Verifying the configuration
# Verify VLAN mapping information on PE 1.
[PE1] display vlan mapping Interface HundredGigE1/0/1: Outer VLAN Inner VLAN Translated Outer VLAN Translated Inner VLAN 5 N/A 100 5
# Verify VLAN mapping information on PE 3.
[PE3] display vlan mapping Interface HundredGigE1/0/1: Outer VLAN Inner VLAN Translated Outer VLAN Translated Inner VLAN 100 5 200 6
# Verify VLAN mapping information on PE 4.
[PE4] display vlan mapping Interface HundredGigE1/0/2: Outer VLAN Inner VLAN Translated Outer VLAN Translated Inner VLAN 6 N/A 200 6