在一般的三层交换机中,通常采用一个vlan对应一个vlanif接口的方式实现广播域之间的通信,但是这也导致了ip地址的浪费。
这就使得vlan聚合的产生,vlan聚合是在三层交换机上设置一个大vlan,我们称其为supervlan,将接入层的所有vlan全部划到这个大vlan里面,然后只给这个大vlan一个vlanif接口地址,相当于全部的vlan使用一个vlanif接口。
如图,我们三层交换机有一个大vlan100,下面接入层交换机设置了3个vlan:10 20 30.
三层核心sw1配置:
[SW1] vlan batch 10 20 30 100
[SW1] interface GigabitEthernet0/0/1
[SW1-GigabitEthernet0/0/1] port link-type trunk
[SW1-GigabitEthernet0/0/1] port trunk allow-pass vlan 10
[SW1] interface GigabitEthernet0/0/2
[SW1-GigabitEthernet0/0/1] port link-type trunk
[SW1-GigabitEthernet0/0/1] port trunk allow-pass vlan 20
[SW1] interface GigabitEthernet0/0/3
[SW1-GigabitEthernet0/0/1] port link-type trunk
[SW1-GigabitEthernet0/0/1] port trunk allow-pass vlan 30
[SW1] vlan 100 #创建Super-VLAN
[SW1-vlan100] aggregate-vlan
[SW1-vlan100] access-vlan 10 20 30 #将VLAN10,20,30作为VLAN100的Sub-VLAN
[SW1] interface vlanif 100
[SW1-vlanif100] ip address 192.168.1.254 24
[SW1-vlanif100] arp-proxy inter-sub-vlan-proxy enable #使能Sub-VLAN间的Proxy ARP功能
接入层sw2、sw3、sw4配置:
[SW2] vlan 10
[SW2] interface GigabitEthernet0/0/1
[SW2-GigabitEthernet0/0/1] port link-type trunk
[SW2-GigabitEthernet0/0/1] port trunk allow-pass vlan 10
[SW2] interface GigabitEthernet0/0/2
[SW2-GigabitEthernet0/0/2] port link-type access
[SW2-GigabitEthernet0/0/2] port default vlan 10
[SW2]interface Eth0/0/1
[SW2-Ethernet0/0/1] port link-type access
[SW2-Ethernet0/0/1] port default vlan 10
[SW3] vlan 20
[SW3] interface GigabitEthernet0/0/1
[SW3-GigabitEthernet0/0/1] port link-type trunk
[SW3-GigabitEthernet0/0/1] port trunk allow-pass vlan20
[SW3] interface GigabitEthernet0/0/2
[SW3-GigabitEthernet0/0/2] port link-type access
[SW3-GigabitEthernet0/0/2] port default vlan20
[SW4] vlan30
[SW4] interface GigabitEthernet0/0/1
[SW4-GigabitEthernet0/0/1] port link-type trunk
[SW4-GigabitEthernet0/0/1] port trunk allow-pass vlan30
[SW4] interface GigabitEthernet0/0/2
[SW4-GigabitEthernet0/0/2] port link-type access
[SW4-GigabitEthernet0/0/2] port default vlan30
然后给核心三层交换机配个DHCP:
[sw1]dhcp enable
[sw1]ip pool 1
[sw1-ip-pool-HW-1]network 192.168.1.0 mask 24
[sw1-ip-pool-HW-1]gateway-list 192.168.1.254
[sw1-ip-pool-HW-1]quit
[sw1]interface vlanif 100
[sw1-Vlanif100]dhcp select global
[sw1-Vlanif100]quit
测试:
PC3:
PC4:
PC3 PING PC4:
不同vlan之间可以通信。