配置VLAN聚合示例
组网需求
某公司拥有多个部门且位于同一网段,为了提升业务安全性,将不同部门的用户划分到不同VLAN中。现由于业务需要,不同部门间的用户需要互通。
如图5-27所示,VLAN2和VLAN3为不同部门,现需要实现不同VLAN间的用户可以互相访问。
配置思路
可以在SwitchB上部署VLAN聚合,将不同部门的VLAN聚合到Super VLAN中,这样,不同部门的用户可通过Super VLAN访问Internet。同时,为使部门间用户互通,在Super VLAN上部署Proxy ARP功能。采用如下思路配置VLAN聚合:
在SwitchA和SwitchB上配置VLAN和接口,将不同部门用户划分到不同VLAN中,并透传各VLAN到SwitchB。
在SwitchB上配置Super-VLAN及其对应的VLANIF接口、上行路由,使不同部门的用户能够访问Internet。
在SwitchB上启用Super-VLAN的Proxy ARP功能,使不同部门的用户间三层互通。
操作步骤
- 配置VLAN和接口,将不同部门用户划分到不同VLAN中,并透传各VLAN到SwitchB
- 配置Super-VLAN及其对应的VLANIF接口
# 在SwitchB上配置Super-VLAN 4,并将VLAN 2和VLAN 3加入到Super-VLAN 4,作为其Sub-VLAN。
[~SwitchB] vlan 4 [~SwitchB-vlan4] aggregate-vlan [*SwitchB-vlan4] access-vlan 2 to 3 [*SwitchB-vlan4] quit [*SwitchB] commit
# 创建并配置VLANIF4,使不同部门的用户可通过Super-VLAN 4访问Internet。
[~SwitchB] interface vlanif 4 [*SwitchB-Vlanif4] ip address 10.1.1.1 24 [*SwitchB-Vlanif4] quit [*SwitchB] commit
- 配置上行路由
# 在SwitchB上配置上行接口10GE1/0/1,透传SwitchB与出口网关Router的互联VLAN。
[~SwitchB] interface 10ge 1/0/1 [~SwitchB-10GE1/0/1] port link-type trunk [*SwitchB-10GE1/0/1] port trunk allow-pass vlan 10 [*SwitchB-10GE1/0/1] quit [*SwitchB] commit
# 创建并配置VLANIF 10,指定其IP地址为SwitchB与出口网关Router对接的IP地址。
[~SwitchB] interface vlanif 10 [*SwitchB-Vlanif10] ip address 10.10.1.1 24 [*SwitchB-Vlanif10] quit [*SwitchB] commit
# 在SwitchB上配置一条到出口网关Router的缺省静态路径,使用户能够访问Internet。
[~SwitchB] ip route-static 0.0.0.0 0.0.0.0 10.10.1.2 [*SwitchB] commit
还需要在出口网关Router上配置其与SwitchB对接的接口,指定其IP地址为10.10.1.2,具体配置请参见Router的配置手册。
- 配置用户IP地址
分别为各用户配置IP地址,并使它们和VLAN 4处于同一网段。
配置成功后,各部门用户可以访问Internet,但VLAN 2的用户与VLAN 3的用户间不可以相互ping通。还需要在SwitchB上配置Proxy ARP。
- 配置Proxy ARP
# 在SwitchB的Super-VLAN 4下配置Proxy ARP,使不同部门的用户间三层互通。
[~SwitchB] interface vlanif 4 [~SwitchB-Vlanif4] arp proxy inter-vlan enable [*SwitchB-Vlanif4] quit [*SwitchB] commit
- 检查配置结果
配置完成后,VLAN 2的用户与VLAN 3的用户可以相互ping通,且都可以访问Internet。
配置文件
- SwitchA的配置文件
# sysname SwitchA # vlan batch 2 to 3 # interface 10GE1/0/1 port default vlan 2 # interface 10GE1/0/2 port default vlan 2 # interface 10GE1/0/3 port default vlan 3 # interface 10GE1/0/4 port default vlan 3 # interface 10GE1/0/5 port link-type trunk port trunk allow-pass vlan 2 to 3 # return
SwitchB的配置文件
# sysname SwitchB # vlan batch 2 to 4 10 # vlan 4 aggregate-vlan access-vlan 2 to 3 # interface Vlanif4 ip address 10.1.1.1 255.255.255.0 arp proxy inter-vlan enable # interface Vlanif10 ip address 10.10.1.1 255.255.255.0 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 10 # interface 10GE1/0/5 port link-type trunk port trunk allow-pass vlan 2 to 3 # ip route-static 0.0.0.0 0.0.0.0 10.10.1.2 # return