配置1 to 1的VLAN Mapping示例
组网需求
如图7-5所示,某数据中心网络中,随着业务的不断增加,网络管理者规划了新的分支,新分支所属的VLAN为VLAN5,而总部所属的VLAN为VLAN6,并且新分支和总部位于相同的网段,现需要实现新分支和总部的互通。
配置思路
采用如下的思路配置1 to 1 VLAN Mapping:
- 将连接新分支的Switch1的下行接口划分到VLAN5。
- 在Switch2上配置1 to 1的VLAN Mapping功能,实现新分支和总部互通。
操作步骤
- 将Switch1的下行口划分到VLAN5,上行口允许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
- 在Switch2上配置VLAN Mapping
<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
- 配置Switch3的二层转发功能
<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
- 验证配置结果
将新分支Server和总部Server配置在同一个网段,比如配置新分支Server的IP地址为172.16.0.1/16,配置总部Server的IP地址为172.16.0.7/16,新分支可以和总部互通。以新分支Server1 ping总部Server3的显示为例。
<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
配置文件
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
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
Switch3的配置文件
# sysname Switch3 # vlan batch 6 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 6 # return