二层交换机的配置 en conf t vlan 10 vlan 20 exit int f0/1 sw mode acc sw acc vlan 10 exit int f0/2 sw mode acc sw acc vlan 20 exit int range f0/9-10 sw mode trunk exit 外部路由器 en conf t int g0/0 ip add 10.10.10.2 255.255.255.0 no shutdown exit int g0/1 ip add 20.20.20.2 255.255.255.0 no shutdown exit int g0/2 ip add 176.16.10.254 255.255.255.0 no shutdown exit ip route 0.0.0.0 0.0.0.0 g0/0 ip route 0.0.0.0 0.0.0.0 g0/1 三层交换机0的配置 en conf t ip routing vlan 10 vlan 20 exit int f0/9 sw mode trunk exit int f0/24 switchport trunk encapsulation dot1q sw mode trunk exit int vlan 10 ip add 192.168.10.254 255.255.255.0 no shutdown exit int vlan 20 ip add 192.168.20.254 255.255.255.0 no shutdown exit int f0/23 no switchport ip add 10.10.10.1 255.255.255.0 no shutdown exit spanning-tree vlan 10 priority 4096 int vlan 10 standby 10 ip 192.168.10.250 standby 10 priority 150 standby 10 preempt standby 10 track f0/23 exit int vlan 20 standby 20 ip 192.168.20.250 standby 20 priority 120 standby 20 preempt exit ip route 176.16.10.0 255.255.255.0 f0/23 三层交换机1的配置 en conf t ip routing vlan 10 vlan 20 exit int f0/10 sw mode trunk exit int f0/24 switchport trunk encapsulation dot1q sw mode trunk exit int vlan 10 ip add 192.168.10.253 255.255.255.0 no shutdown exit int vlan 20 ip add 192.168.20.253 255.255.255.0 no shutdown exit ip default-gateway 20.20.20.2 ip routing int f0/23 no switchport ip add 20.20.20.1 255.255.255.0 no shutdown exit spanning-tree vlan 20 priority 4096 int vlan 20 standby 20 ip 192.168.20.250 standby 20 priority 150 standby 20 preempt standby 20 track f0/23 exit int vlan 10 standby 10 ip 192.168.10.250 standby 10 priority 120 standby 10 preempt exit ip route 176.16.10.0 255.255.255.0 f0/23