# VLAN聚合 ![image-20240822175016583](https://picgo-noriu.oss-cn-beijing.aliyuncs.com/Images/image-20240822175016583.png) ### 一、配置PC的IP、子网掩码、网关 ### 二、配置二层交换机 - **SW2** ``` u t m sys [Huawei]sys SW2 [SW2]vlan batch 10 20 30 [SW2]port-group 1 [SW2-port-group-1]group-member g0/0/2 g0/0/3 [SW2-port-group-1]port link-type access [SW2-port-group-1]port default vlan 10 [SW2-port-group-1]quit [SW2]int g0/0/1 [SW2-GigabitEthernet0/0/1]port link-type trunk [SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan all [SW2-GigabitEthernet0/0/1]return save ``` - **SW3** ``` u t m sys [Huawei]sys SW3 [SW3]vlan batch 10 20 30 [SW3]port-group 1 [SW3-port-group-1]group-member g0/0/2 g0/0/3 [SW3-port-group-1]port link-type access [SW3-port-group-1]port default vlan 20 [SW3-port-group-1]quit [SW3]int g0/0/1 [SW3-GigabitEthernet0/0/1]port link-type trunk [SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan all [SW3-GigabitEthernet0/0/1]return save ``` - **SW4** ``` u t m sys [Huawei]sys SW4 [SW4]vlan batch 10 20 30 [SW4]port-group 1 [SW4-port-group-1]group-member g0/0/2 g0/0/3 [SW4-port-group-1]port link-type access [SW4-port-group-1]port default vlan 30 [SW4-port-group-1]quit [SW4]int g0/0/1 [SW4-GigabitEthernet0/0/1]port link-type trunk [SW4-GigabitEthernet0/0/1]port trunk allow-pass vlan all [SW4-GigabitEthernet0/0/1]return save ``` ### 三、配置三层交换机 - **SW1** ``` u t m sys [Huawei]sys SW1 [SW1]vlan batch 10 20 30 100 [SW1]vlan 100 [SW1-vlan100]aggregate-vlan [SW1-vlan100]access-vlan 10 20 30 [SW1-vlan100]quit [SW1]int vlanif 100 [SW1-Vlanif100]ip a 192.168.100.254 24 [SW1-Vlanif100]arp-proxy inter-sub-vlan-proxy enable [SW1-Vlanif100]quit [SW1]port-group group-member g0/0/1 to g0/0/3 [SW1-port-group]port link-type trunk [SW1-port-group]port trunk allow-pass vlan 10 20 30 [SW1-port-group]return save ``` ### 四、测试 - PING ``` PC6>ping 192.168.100.1 Ping 192.168.100.1: 32 data bytes, Press Ctrl_C to break From 192.168.100.6: Destination host unreachable From 192.168.100.1: bytes=32 seq=1 ttl=127 time=78 ms From 192.168.100.1: bytes=32 seq=2 ttl=127 time=78 ms From 192.168.100.1: bytes=32 seq=3 ttl=127 time=94 ms From 192.168.100.1: bytes=32 seq=4 ttl=127 time=78 ms From 192.168.100.1: bytes=32 seq=5 ttl=127 time=78 ms --- 192.168.100.1 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 78/81/94 ms ```