sw1: 配置vlan: [sw1]vlan batch 10 20 [sw1]int e0/0/1 [sw1-Ethernet0/0/1]port link-type access [sw1-Ethernet0/0/1]port default vlan 10 [sw1-Ethernet0/0/1]int e0/0/2 [sw1-Ethernet0/0/2]port link-type access [sw1-Ethernet0/0/2]port default vlan 20 [sw1]port-group 1 [sw1-port-group-1]group-member e0/0/3 e0/0/4 [sw1-port-group-1]port link-type trunk [sw1-port-group-1]port trunk allow-pass vlan all

<sw1>save

sw2: 配置vlan: [sw2]vlan batch 10 30 [sw2]int e0/0/1 [sw2-Ethernet0/0/1]port link-type access [sw2-Ethernet0/0/1]port default vlan 10 [sw2-Ethernet0/0/1]int e0/0/2 [sw2-Ethernet0/0/2]port link-type access [sw2-Ethernet0/0/2]port default vlan 30 [sw2]port-group 1 [sw2-port-group-1]group-member e0/0/3 e0/0/4 [sw2-port-group-1]port link-type trunk [sw2-Ethernet0/0/1]port trunk allow-pass vlan all

<sw2>save

sw3: 配置vlan: [sw3]vlan batch 20 30 [sw3]int e 0/0/1 [sw3-Ethernet0/0/1]port link-type access [sw3-Ethernet0/0/1]port default vlan 20 [sw3-Ethernet0/0/1]int e0/0/2 [sw3-Ethernet0/0/2]port link-type access [sw3-Ethernet0/0/2]port default vlan 30 [sw3-port-group-1]group-member e0/0/3 e0/0/4 [sw3-port-group-1]port link-type trunk [sw3-port-group-1]port trunk allow-pass vlan all

<sw3>save

lsw4: 配置vlan: [lsw4]vlan batch 10 20 30 [lsw4]port-group 1 [lsw4-port-group-1]group-member g0/0/1 to g0/0/4 [lsw4-port-group-1]port link-type trunk [lsw4-port-group-1]port trunk allow-pass vlan all 配置vrrp: [lsw4]int Vlanif 10 [lsw4-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254 [lsw4-Vlanif10]vrrp vrid 10 priority 200 [lsw4-Vlanif10]int vlanif 20 [lsw4-Vlanif20]vrrp vrid 20 virtual-ip 192.168.20.254 [lsw4-Vlanif20]vrrp vrid 20 priority 200 [lsw4-Vlanif20]int vlanif 30 [lsw4-Vlanif30]vrrp vrid 30 virtual-ip 192.168.30.254

[lsw4]int vlanif 10 [lsw4-Vlanif10]ip add 192.168.10.253 24 [lsw4-Vlanif10]int vlanif 20 [lsw4-Vlanif20]ip add 192.168.20.253 24 [lsw4-Vlanif20]int vlanif 30 [lsw4-Vlanif30]ip add 192.168.30.253 24

[lsw4]dis vrrp bri

浮动路由: [lsw4]vlan 2 [lsw4]int vlanif 2 [lsw4-Vlanif2]ip add 192.168.1.1 24

[lsw4]int g0/0/5 [lsw4-GigabitEthernet0/0/5]port link-type access [lsw4-GigabitEthernet0/0/5]port default vlan 2

[lsw4]int vlanif 10 [lsw4-Vlanif10]vrrp vrid 10 track interface g0/0/5 reduced 110 [lsw4-Vlanif10]int vlanif 20 [lsw4-Vlanif20]vrrp vrid 20 track interface g0/0/6 reduced 110

[lsw4]ip route-static 0.0.0.0 0.0.0.0 192.168.1.2

DHCP配置: [lsw4]dhcp enable [lsw4]ip pool v10 [lsw4-ip-pool-v10]network 192.168.10.0 mask 24 [lsw4-ip-pool-v10]gateway-list 192.168.10.254 [lsw4]int vlanif 10 [lsw4-Vlanif10]dhcp select global

[lsw4]display ip interface brief

lsw5: 配置vlan: [lsw5]vlan batch 10 20 30 [lsw5]port-group 1 [lsw5-port-group-1]group-member g0/0/1 to g0/0/4 [lsw5-port-group-1]port link-type trunk [lsw5-port-group-1]port trunk allow-pass vlan all 配置vrrp: [lsw5]int vlanif 10 [lsw5-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254 [lsw5-Vlanif10]int vlanif 20 [lsw5-Vlanif20]vrrp vrid 20 virtual-ip 192.168.20.254 [lsw5-Vlanif20]int vlanif 30 [lsw5-Vlanif30]vrrp vrid 30 virtual-ip 192.168.30.254 [lsw5-Vlanif30]vrrp vrid 30 priority 200

[lsw5]int vlanif 10 [lsw5-Vlanif10]ip add 192.168.10.252 24 [lsw5-Vlanif10]int vlanif 20 [lsw5-Vlanif20]ip add 192.168.20.252 24 [lsw5-Vlanif20]int vlanif 30 [lsw5-Vlanif30]ip add 192.168.30.252 24

[lsw5]dis vrrp bri

浮动路由: [lsw5]vlan batch 2 3 [lsw5]int vlanif 2 [lsw5-Vlanif2]ip add 192.168.2.1 24 [lsw5-Vlanif2]int vlanif 3 [lsw5-Vlanif3]ip add 192.168.3.254 24

[lsw4]int g0/0/5 [lsw4-GigabitEthernet0/0/5]port link-type access [lsw4-GigabitEthernet0/0/5]port default vlan 3

[lsw4]int g0/0/6 [lsw4-GigabitEthernet0/0/6]port link-type access [lsw4-GigabitEthernet0/0/6]port default vlan 2

[lsw5]int vlanif 30 [lsw5-Vlanif30]vrrp vrid 30 track interface g0/0/6 reduced 110

[lsw5]ip route-static 0.0.0.0 0.0.0.0 192.168.2.2

DHCP配置: [lsw5]dhcp enable [lsw5]ip pool v20 [lsw5-ip-pool-v20]network 192.168.20.0 mask 24 [lsw5-ip-pool-v20]gateway-list 192.168.20.254 [lsw5]int vlanif 20 [lsw5-Vlanif20]dhcp select global

[lsw5]ip pool v30 [lsw5-ip-pool-v30]network 192.168.30.0 mask 24 [lsw5-ip-pool-v30]gateway-list 192.168.20.254 [lsw5]int vlanif 30 [lsw5-Vlanif20]dhcp select global

r1: 浮动路由: [r1]int g0/0/1 [r1-GigabitEthernet0/0/1]ip add 192.168.1.2 24 [r1-GigabitEthernet0/0/1]int g0/0/2 [r1-GigabitEthernet0/0/2]ip add 192.168.2.2 24 [r1-GigabitEthernet0/0/2]int g0/0/0 [r1-GigabitEthernet0/0/0]ip add 192.168.100.1 24

[r1]ip route-static 192.168.10.0 24 192.168.1.1 [r1]ip route-static 192.168.10.0 24 192.168.2.1 preference 70 [r1]ip route-static 192.168.20.0 24 192.168.1.1 [r1]ip route-static 192.168.20.0 24 192.168.2.1 preference 70 [r1]ip route-static 192.168.30.0 24 192.168.2.1 [r1]ip route-static 192.168.30.0 24 192.168.1.1 preference 70