第一步:配置R2、pc4和pc5 R4上的配置: interface FastEthernet0 ip address 192.168.1.4 255.255.255.0 ip default-gateway 192.168.1.254

R5上的配置 interface FastEthernet0 ip address 192.168.1.5 255.255.255.0 ip default-gateway 192.168.1.253

R2上的配置 interface Loopback0 ip address 2.2.2.2 255.255.255.0 ! interface FastEthernet0/0 ip address 12.0.0.2 255.255.255.0 ! interface FastEthernet1/0 ip address 23.0.0.2 255.255.255.0 ! router rip version 2 network 2.0.0.0 network 12.0.0.0 network 23.0.0.0 no auto-summary

第二步:配置sw1和sw3 SW1上的配置:

interface FastEthernet0/0 no switchport ip address 12.0.0.1 255.255.255.0 ! interface Vlan1 ip address 192.168.1.1 255.255.255.0 no ip redirects no ip proxy-arp standby 1 ip 192.168.1.254 standby 1 priority 105 standby 1 preempt standby 1 track FastEthernet0/0 standby 2 ip 192.168.1.253 standby 2 preempt //以上命令说明了配置standby多组的命令 router rip version 2 network 12.0.0.0 network 192.168.1.0 no auto-summary

SW3上的配置: interface FastEthernet0/0 no switchport ip address 23.0.0.3 255.255.255.0 ! interface Vlan1 ip address 192.168.1.3 255.255.255.0 no ip redirects no ip proxy-arp standby 1 ip 192.168.1.254 standby 1 preempt standby 2 ip 192.168.1.253 standby 2 priority 105 standby 2 preempt standby 2 track FastEthernet0/0 ! router rip version 2 network 23.0.0.0 network 192.168.1.0 no auto-summary

第三步:测试

  1. 我们先直接对SW1的外网进行测试 SW1上的情况: sw1(config)#int f0/0 sw1(config-if)#sh *Mar 1 02:08:19.511: %TRACKING-5-STATE: 1 interface Fa0/0 line-protocol Up->Down *Mar 1 02:08:22.391: %HSRP-5-STATECHANGE: Vlan1 Grp 1 state Active -> Speak sw1(config-if)#no sh *Mar 1 02:08:27.311: %TRACKING-5-STATE: 1 interface Fa0/0 line-protocol Down->Up *Mar 1 02:08:28.423: %HSRP-5-STATECHANGE: Vlan1 Grp 1 state Speak -> Active //上面几步,我们对外网接口down和up后,分别出现了speak和active,表明它原抢了回来

SW2上的情况: *Mar 1 02:08:22.351: %HSRP-5-STATECHANGE: Vlan1 Grp 1 state Standby -> Active

*Mar 1 02:08:28.575: %HSRP-5-STATECHANGE: Vlan1 Grp 1 state Active -> Speak *Mar 1 02:08:38.575: %HSRP-5-STATECHANGE: Vlan1 Grp 1 state Speak -> Standby

//从上面我们看到了这样的情况,当SW1的接口down后,它成为了active,当SW1的外网接口好了时,它以变为standby

//下面为pc4的通信情况: pc4#ping 2.2.2.2 re 3333333

Type escape sequence to abort. Sending 3333333, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!U.U.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!. Success rate is 98 percent (441/447), round-trip min/avg/max = 20/42/1148 ms

  1. 我们再对SW3的进行测试 //下面的解释我就不说了,和上面是一样的 sw3(config)#int f0/0 sw3(config-if)#sh *Mar 1 02:20:28.367: %TRACKING-5-STATE: 1 interface Fa0/0 line-protocol Up->Down *Mar 1 02:20:29.159: %HSRP-5-STATECHANGE: Vlan1 Grp 2 state Active -> Speak sw3(config-if)#no sh *Mar 1 02:20:39.159: %HSRP-5-STATECHANGE: Vlan1 Grp 2 state Speak -> Standby *Mar 1 02:20:40.243: %TRACKING-5-STATE: 1 interface Fa0/0 line-protocol Down->Up *Mar 1 02:20:41.239: %HSRP-5-STATECHANGE: Vlan1 Grp 2 state Standby -> Active

*Mar 1 02:20:29.079: %HSRP-5-STATECHANGE: Vlan1 Grp 2 state Standby -> Active *Mar 1 02:20:41.279: %HSRP-5-STATECHANGE: Vlan1 Grp 2 state Active -> Speak *Mar 1 02:20:51.279: %HSRP-5-STATECHANGE: Vlan1 Grp 2 state Speak -> Standby

pc5# pc5#ping 2.2.2.2 re 222222

Type escape sequence to abort. Sending 222222, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!U. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Success rate is 99 percent (837/840), round-trip min/avg/max = 4/38/120 ms