配置VLAN聚合示例
组网需求
某公司拥有多个部门且位于同一网段,为了提升业务安全性,将不同部门的用户划分到不同VLAN中,如图4-7所示,VLAN2和VLAN3属于不同部门。各部门均有访问Internet需求,同时由于业务需要,不同部门间的用户需要互通。
配置思路
可以在RouterB上部署VLAN聚合,将不同部门的VLAN聚合到Super VLAN中,这样,不同部门的用户可通过Super VLAN访问Internet。同时,为使部门间用户互通,在Super VLAN上部署Proxy ARP功能。采用如下思路配置VLAN聚合:
- 在RouterA和RouterB上配置VLAN和接口,将不同部门用户划分到不同VLAN中,并透传各VLAN到RouterB。
- 在RouterB上配置Super-VLAN及其对应的VLANIF接口、上行路由,使不同部门的用户能够访问Internet。
- 在RouterB上启用Super-VLAN的Proxy ARP功能,使不同部门的用户间三层互通。
操作步骤
- 配置VLAN和接口,将不同部门用户划分到不同VLAN中,并透传各VLAN到RouterB
配置RouterA
# 配置接口Eth2/0/1为Access类型。接口Eth2/0/2、Eth2/0/3、Eth2/0/4的配置与Eth2/0/1类似,不再赘述。
<Huawei> system-view [Huawei] sysname RouterA [RouterA] interface ethernet 2/0/1 [RouterA-Ethernet2/0/1] port link-type access [RouterA-Ethernet2/0/1] quit
# 创建VLAN2并向VLAN2中加入Eth2/0/1和Eth2/0/2。
[RouterA] vlan 2 [RouterA-vlan2] port ethernet 2/0/1 2/0/2 [RouterA-vlan2] quit
# 创建VLAN3并向VLAN3中加入Eth2/0/3和Eth2/0/4。
[RouterA] vlan 3 [RouterA-vlan3] port ethernet 2/0/3 2/0/4 [RouterA-vlan3] quit
# 配置RouterA连接RouterB的接口,透传VLAN2和VLAN3到RouterB。
[RouterA] interface ethernet 2/0/5 [RouterA-Ethernet2/0/5] port link-type trunk [RouterA-Ethernet2/0/5] port trunk allow-pass vlan 2 3 [RouterA-Ethernet2/0/5] quit
配置RouterB
# 创建VLAN2、VLAN3、VLAN4、VLAN10,并配置RouterB连接RouterA的接口,使VLAN2和VLAN3透传到RouterB。
<Huawei> system-view [Huawei] sysname RouterB [RouterB] vlan batch 2 3 4 10 [RouterB] interface ethernet 2/0/5 [RouterB-Ethernet2/0/5] port link-type trunk [RouterB-Ethernet2/0/5] port trunk allow-pass vlan 2 3 [RouterB-Ethernet2/0/5] quit
- 配置Super-VLAN及其对应的VLANIF接口
# 在RouterB上配置Super-VLAN 4,并将VLAN2、VLAN3加入到Super-VLAN 4,作为其Sub-VLAN。
[RouterB] vlan 4 [RouterB-vlan4] aggregate-vlan [RouterB-vlan4] access-vlan 2 to 3 [RouterB-vlan4] quit
# 创建并配置VLANIF4,使不同部门的用户可通过Super-VLAN 4访问Internet。
[RouterB] interface vlanif 4 [RouterB-Vlanif4] ip address 10.1.1.1 255.255.255.0 [RouterB-Vlanif4] quit
- 配置上行路由
# 在RouterB上配置上行接口Eth2/0/1,透传RouterB与出口网关Router的互联VLAN。
[RouterB] interface ethernet 2/0/1 [RouterB-Ethernet2/0/1] port link-type trunk [RouterB-Ethernet2/0/1] port trunk allow-pass vlan 10 [RouterB-Ethernet2/0/1] quit
# 创建并配置VLANIF10,指定其IP地址为RouterB与出口网关Router对接的IP地址。
[RouterB] interface vlanif 10 [RouterB-Vlanif10] ip address 10.10.1.1 255.255.255.0 [RouterB-Vlanif10] quit
# 在RouterB上配置一条到出口网关Router的缺省静态路由,使用户能够访问Internet。
[RouterB] ip route-static 0.0.0.0 0.0.0.0 10.10.1.2
- 配置用户IP地址
分别为各用户配置IP地址,并使它们和VLAN4处于同一网段。
配置成功后,各部门用户可以访问Internet,但VLAN2的用户与VLAN3的用户间不可以相互Ping通。
- 配置Proxy ARP
# 在RouterB的Super-VLAN 4下配置Proxy ARP,使不同部门的用户间三层互通。
[RouterB] interface vlanif 4 [RouterB-Vlanif4] arp-proxy inter-sub-vlan-proxy enable [RouterB-Vlanif4] quit
- 验证配置结果
# 配置完成后,VLAN2的用户与VLAN3的用户可以相互Ping通,且都可以访问Internet。
配置文件
RouterA的配置文件
# sysname RouterA # vlan batch 2 to 3 # interface Ethernet2/0/1 port link-type access port default vlan 2 # interface Ethernet2/0/2 port link-type access port default vlan 2 # interface Ethernet2/0/3 port link-type access port default vlan 3 # interface Ethernet2/0/4 port link-type access port default vlan 3 # interface Ethernet2/0/5 port link-type trunk port trunk allow-pass vlan 2 to 3 # return
RouterB的配置文件
# sysname RouterB # 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-sub-vlan-proxy enable # interface Vlanif10 ip address 10.10.1.1 255.255.255.0 # interface Ethernet2/0/1 port link-type trunk port trunk allow-pass vlan 10 # interface Ethernet2/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