Example for Configuring 1 to 1 VLAN Mapping
Networking Requirements
As shown in Figure 7-5, on a data center network, as services increase, the network administrator plans a new branch that belongs to VLAN 5. The headquarters belongs to VLAN 6, and the headquarters and branch belong to the same network segment. The new branch needs to communicate with the headquarters.
Configuration Roadmap
The configuration roadmap is as follows:
- Add the downlink interface on Switch1 connected to the new branch to VLAN 5.
- Configure 1 to 1 VLAN mapping on Switch2 to implement communication between the new branch and headquarters.
Procedure
- Add the downlink interface on Switch1 to VLAN 5 and configure
the uplink interfaces to allow the VLAN5.
<HUAWEI> system-view [~HUAWEI] sysname Switch1 [*HUAWEI] commit [~Switch1] vlan 5 [*Switch1-vlan5] quit [*Switch1] interface 10ge 1/0/1 [*Switch1-10GE1/0/1] port default vlan 5 [*Switch1-10GE1/0/1] quit [*Switch1] interface 10ge 1/0/2 [*Switch1-10GE1/0/2] port default vlan 5 [*Switch1-10GE1/0/2] quit [*Switch1] interface 10ge 1/0/3 [*Switch1-10GE1/0/3] port link-type trunk [*Switch1-10GE1/0/3] port trunk allow-pass vlan 5 [*Switch1-10GE1/0/3] quit [*Switch1] commit
- Configure VLAN mapping on Switch2.
<HUAWEI> system-view [~HUAWEI] sysname Switch2 [*HUAWEI] commit [~Switch2] vlan 6 [*Switch2-vlan6] quit [*Switch2] interface 10ge 1/0/1 [*Switch2-10GE1/0/1] port link-type trunk [*Switch2-10GE1/0/1] port trunk allow-pass vlan 6 [*Switch2-10GE1/0/1] port vlan-mapping vlan 5 map-vlan 6 [*Switch2-10GE1/0/1] quit [*Switch2] interface 10ge 1/0/2 [*Switch2-10GE1/0/2] port link-type trunk [*Switch2-10GE1/0/2] port trunk allow-pass vlan 6 [*Switch2-10GE1/0/2] quit [*Switch2] commit
- Configure Layer 2 forwarding on Swicth3.
<HUAWEI> system-view [~HUAWEI] sysname Switch3 [*HUAWEI] commit [~Switch3] vlan 6 [*Switch3-vlan6] quit [*Switch3] interface 10ge 1/0/1 [*Switch3-10GE1/0/1] port link-type trunk [*Switch3-10GE1/0/1] port trunk allow-pass vlan 6 [*Switch3-10GE1/0/1] quit [*Switch3] commit
- Verify the configuration.
Configure servers in the new branch and headquarters on the same network segment. For example, configure IP addresses 172.16.0.1/16 and 172.16.0.7/16 for servers in the new branch and headquarters respectively so that the new branch can communication with the headquarters. This example pings Server3 in the headquarters from Server1 in the new branch.
<Server1> ping 172.16.0.7 Pinging 172.16.0.7 with 32 bytes of data: Reply from 172.16.0.7: bytes=32 time<1ms TTL=128 Reply from 172.16.0.7: bytes=32 time<1ms TTL=128 Reply from 172.16.0.7: bytes=32 time<1ms TTL=128 Reply from 172.16.0.7: bytes=32 time<1ms TTL=128 Ping statistics for 172.16.0.7: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms
Configuration Files
Configuration file of Switch1
# sysname Switch1 # vlan batch 5 # interface 10GE1/0/1 port default vlan 5 # interface 10GE1/0/2 port default vlan 5 # interface 10GE1/0/3 port link-type trunk port trunk allow-pass vlan 5 # return
Configuration file of Switch2
# sysname Switch2 # vlan batch 6 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 6 port vlan-mapping vlan 5 map-vlan 6 # interface 10GE1/0/2 port link-type trunk port trunk allow-pass vlan 6 # return
Configuration file of Switch3
# sysname Switch3 # vlan batch 6 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 6 # return