01 Switch简介
本文引用地址:Switch功能包括:
添加外层 Tag功能,即VLAN Switch stack-vlan功能。
在不同接口之间转换外层VLAN Tag,即VLAN Switch switch-vlan功能。
1.1 VLAN Switch stack-vlan
VLAN Switch stack-vlan功能与VLAN Stacking功能类似,也是一种针对用户不同VLAN封装外层VLAN Tag的二层技术。与VLAN Stacking功能的差异如表 1 所示。
表 1 VLAN Switch功能与VLAN Stacking功能差异表
1.2 VLAN Switch switch-vlan
VLAN Switch switch-vlan功能与VLAN Mapping功能类似,可以实现不同VLAN间的。与VLAN Mapping功能的差异如表 2 所示。

表 2 VLAN Switch功能与VLAN Mapping功能差异表
02VLAN Switch应用场景
如图 1 所示,PC1和PC2分别为VLAN 2和VLAN 3内的用户,要求PC1、PC2间互通。

图 1 通过VLAN Switch实现VLAN间组网图
可在设备SwitchA上配置VLAN Switch的switch-vlan功能实现此场景下VLAN间的互通。配置后,用户报文按配置的指定路径转发,可以将port2上收到的VLAN2的报文转换为VLAN 3,并指定从port3发出;而port3上收到的VLAN 3的报文将转换为VLAN 2,并指定从port2发出。这样VLAN 2和VLAN 3就实现了互相。
如果SwitchA为三层交换机,也可通过VLANIF实现VLAN间的互通;但如果SwitchA为二层交换机,则只能通过VLAN Switch的switch-vlan功能实现VLAN间的互通。
03VLAN间通过VLAN Switch通信
3.1 组网需求
如图 2 所示,Switch的接口GE1/0/1、GE1/0/2分别与SwitchA、SwitchB上行口相连,SwitchA、SwitchB的下行接口分别加入VLAN10、VLAN20。要求VLAN10内的PC与VLAN20内的PC能够互相访问。

图 2 配置VLAN间通过VLAN Switch通信组网图
3.2 配置思路
采用如下的思路配置不同VLAN通过Switch互相通信:
配置SwitchA、SwitchB的相关接口加入VLAN。
配置Switch的VLAN Switch功能
VLAN10、VLAN20不能是Switch已经创建的全局VLAN,且接口GE1/0/1不能加入VLAN10,GE1/0/2不能加入VLAN20,否则无法配置VLAN Switch。
3.3 操作步骤
【1】在SwitchA上创建VLAN10,配置SwitchA的接口GE1/0/1以tagged方式加入VLAN10,GE1/0/2和GE1/0/3以Access方式加入VLAN10。SwitchB的配置与SwitchA类似,不再赘述。
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan 10[SwitchA-vlan10] quit [SwitchA] interface gigabitethernet 1/0/1[SwitchA-GigabitEthernet1/0/1] port link-type hybrid [SwitchA-GigabitEthernet1/0/1] port hybrid tagged vlan 10[SwitchA-GigabitEthernet1/0/1] quit [SwitchA] interface gigabitethernet 1/0/2[SwitchA-GigabitEthernet1/0/2] port link-type access [SwitchA-GigabitEthernet1/0/2] port default vlan 10[SwitchA-GigabitEthernet1/0/2] quit [SwitchA] interface gigabitethernet 1/0/3[SwitchA-GigabitEthernet1/0/3] port link-type access [SwitchA-GigabitEthernet1/0/3] port default vlan 10[SwitchA-GigabitEthernet1/0/3] quit
【2】配置Switch
# 配置Switch的VLAN Switch功能
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] interface gigabitethernet 1/0/1[Switch-GigabitEthernet1/0/1] port link-type hybrid [Switch-GigabitEthernet1/0/1] quit [Switch] interface gigabitethernet 1/0/2[Switch-GigabitEthernet1/0/2] port link-type hybrid [Switch-GigabitEthernet1/0/2] quit [Switch] vlan-switch name1 interface gigabitethernet 1/0/1 vlan 10 interface gigabitethernet 1/0/2 switch-vlan 20
【3】检查配置结果
配置完成后,VLAN10内的PC与VLAN20的PC能够相互访问。
3.4 配置文件
SwitchA的配置文件。
#sysname SwitchA#vlan batch 10#interface GigabitEthernet1/0/1 port link-type hybrid port hybrid tagged vlan 10#interface GigabitEthernet1/0/2 port link-type access port default vlan 10#interface GigabitEthernet1/0/3 port link-type access port default vlan 10#return
SwitchB的配置文件。
#sysname SwitchB#vlan batch 20#interface GigabitEthernet1/0/1 port link-type hybrid port hybrid tagged vlan 20#interface GigabitEthernet1/0/2 port link-type access port default vlan 20#interface GigabitEthernet1/0/3 port link-type access port default vlan 20#return
Switch的配置文件。
#sysname Switch#vlan-switch name1 interface GigabitEthernet1/0/1 vlan 10 interface GigabitEthernet1/0/2 switch-vlan 20#interface GigabitEthernet1/0/1 port link-type hybrid#interface GigabitEthernet1/0/2 port link-type hybrid#return
相关文章









