此举例是2 to 1 VLAN Mapping中的N:1场景,因为外层和内层VLAN Tag不同的业务报文,外层映射到了同一个VLAN。
如图10-7所示,用户通过家庭网关、楼道交换机和小区交换机接入汇聚层网络,为了节省运营商网络VLAN资源,及实现不同用户相同业务在传输过程中相互隔离,可以在楼道交换机上部署QinQ功能,在小区交换机上部署VLAN Mapping功能。
配置思路
采用如下的思路配置2:1 VLAN Mapping:
-
将连接用户的交换机接口分别划分到指定VLAN中,以区分不同的业务。
-
在楼道交换机上部署QinQ功能,以区分用户、业务。
-
在小区交换机上部署VLAN Mapping功能,节约VLAN资源。
操作步骤
- 将S1和S2的下行口划分到指定的VLAN中
# 配置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
# 配置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
- 部署QinQ功能,使楼道交换机上送到小区交换机的报文带有双层VLAN Tag
# 配置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
# 配置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 [S4-GigabitEthernet0/0/1] qinq vlan-translation enable [S4-GigabitEthernet0/0/1] port vlan-stacking vlan 2 to 3 stack-vlan 201 [S4-GigabitEthernet0/0/1] port vlan-stacking vlan 4 stack-vlan 401 [S4-GigabitEthernet0/0/1] quit [S4] interface gigabitethernet 0/0/2 [S4-GigabitEthernet0/0/2] port link-type trunk [S4-GigabitEthernet0/0/2] port trunk allow-pass vlan 201 401 [S4-GigabitEthernet0/0/2] quit
- 在S5上部署VLAN Mapping功能
<HUAWEI> system-view [HUAWEI] sysname S5 [S5] vlan batch 501 [S5] interface gigabitethernet 0/0/1 [S5-GigabitEthernet0/0/1] port link-type trunk [S5-GigabitEthernet0/0/1] port trunk allow-pass vlan 501 [S5-GigabitEthernet0/0/1] qinq vlan-translation enable [S5-GigabitEthernet0/0/1] port vlan-mapping vlan 201 inner-vlan 2 to 3 map-vlan 501 [S5-GigabitEthernet0/0/1] port vlan-mapping vlan 401 inner-vlan 4 map-vlan 501 [S5-GigabitEthernet0/0/1] quit [S5] interface gigabitethernet 0/0/2 [S5-GigabitEthernet0/0/2] port link-type trunk [S5-GigabitEthernet0/0/2] port trunk allow-pass vlan 501 [S5-GigabitEthernet0/0/2] qinq vlan-translation enable [S5-GigabitEthernet0/0/2] port vlan-mapping vlan 201 inner-vlan 2 to 3 map-vlan 501 [S5-GigabitEthernet0/0/2] port vlan-mapping vlan 401 inner-vlan 4 map-vlan 501 [S5-GigabitEthernet0/0/2] quit [S5] interface gigabitethernet 0/0/3 [S5-GigabitEthernet0/0/3] port link-type trunk [S5-GigabitEthernet0/0/3] port trunk allow-pass vlan 501 [S5-GigabitEthernet0/0/3] quit
- 验证配置结果
上述配置完成后,不同家庭用户可以正常访问网络,相同业务共用一个VLAN传输。
配置文件
-
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
-
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
-
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
-
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
-
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