预配置 R1(config)#int f0/0 R1(config-if)#no sh R1(config-if)#ip add 192.168.0.1 255.255.255.0

R2(config)#int f0/0 R2(config-if)#no sh R2(config-if)#ip add 192.168.0.2 255.255.255.0

R3(config)#int f0/0 R3(config-if)#ip add 192.168.0.3 255.255.255.0 R3(config-if)#no sh R3(config)#no ip routing R3(config)#ip default-gateway 192.168.0.100 实验过程

R1#conf t Enter configuration commands, one per line. End with CNTL/Z. R1(config)#int f0/0 R1(config-if)#standby ip 192.168.0.100 //这里没有输入组号,为组0 R1(config-if)# *Dec 13 20:17:12.915: HSRP: Fa0/0 Grp 0 Disabled -> Init *Dec 13 20:17:12.915: HSRP: Fa0/0 Grp 0 Redundancy "hsrp-Fa0/0-0" state Disabled -> Init //进入到了init状态 *Dec 13 20:17:22.923: HSRP: Fa0/0 Interface up *Dec 13 20:17:22.923: HSRP: Fa0/0 Starting minimum interface delay (1 secs) *Dec 13 20:17:23.923: HSRP: Fa0/0 Interface min delay expired *Dec 13 20:17:23.923: HSRP: Fa0/0 Grp 0 Init: a/HSRP enabled *Dec 13 20:17:23.927: HSRP: Fa0/0 Grp 0 Init -> Listen //这时路由器到了监听状态 *Dec 13 20:17:23.927: HSRP: Fa0/0 Grp 0 Redundancy "hsrp-Fa0/0-0" state Init -> Backup *Dec 13 20:17:23.927: HSRP: Fa0/0 Redirect adv out, Passive, active 0 passive 1 R1(config-if)# *Dec 13 20:17:33.923: HSRP: Fa0/0 Grp 0 Listen: c/Active timer expired (unknown) *Dec 13 20:17:33.923: HSRP: Fa0/0 Grp 0 Listen -> Speak //发言状态 *Dec 13 20:17:33.927: HSRP: Fa0/0 Grp 0 Redundancy "hsrp-Fa0/0-0" state Backup -> Speak *Dec 13 20:17:33.927: HSRP: Fa0/0 Grp 0 Hello out 192.168.0.1 Speak pri 100 vIP 192.168.0.100 R1(config-if)# *Dec 13 20:17:36.931: HSRP: Fa0/0 Grp 0 Hello out 192.168.0.1 Speak pri 100 vIP 192.168.0.100 R1(config-if)# *Dec 13 20:17:39.935: HSRP: Fa0/0 Grp 0 Hello out 192.168.0.1 Speak pri 100 vIP 192.168.0.100 R1(config-if)# *Dec 13 20:17:42.939: HSRP: Fa0/0 Grp 0 Hello out 192.168.0.1 Speak pri 100 vIP 192.168.0.100 *Dec 13 20:17:43.923: HSRP: Fa0/0 Grp 0 Speak: d/Standby timer expired (unknown) *Dec 13 20:17:43.923: HSRP: Fa0/0 Grp 0 Standby router is local *Dec 13 20:17:43.927: HSRP: Fa0/0 Grp 0 Speak -> Standby *Dec 13 20:17:43.927: HSRP: Fa0/0 Grp 0 Redundancy "hsrp-Fa0/0-0" state Speak -> Standby *Dec 13 20:17:43.927: HSRP: Fa0/0 Grp 0 Hello out 192.168.0.1 Standby pri 100 vIP 192.168.0.100 *Dec 13 20:17:43.931: HSRP: Fa0/0 Grp 0 Standby: c/Active timer expired (unknown) *Dec 13 20:17:43.935: HSRP: Fa0/0 Grp 0 Active router is local *Dec 13 20:17:43.935: HSRP: Fa0/0 Grp 0 Standby router is unknown, was local *Dec 13 20:17:43.939: HSRP: Fa0/0 Grp 0 Standby -> Active *Dec 13 20:17:43.939: %HSRP-5-STATECHANGE: FastEthernet0/0 Grp 0 state Standby -> Active 第二步:查看R1的hsrp运行状态 R1#sh stan R1#sh standby FastEthernet0/0 - Group 0 State is Active //当前f0/0是激活的 2 state changes, last state change 00:05:17 Virtual IP address is 192.168.0.100 //虚拟ip地址为:192.168.0.100 Active virtual MAC address is 0000.0c07.ac00 Local virtual MAC address is 0000.0c07.ac00 (default) //mac地址 Hello time 3 sec, hold time 10 sec Next hello sent in 0.288 secs Preemption disabled //这里没有配置抢占功能 Active router is local Standby router is unknown Priority 100 (default 100) IP redundancy name is "hsrp-Fa0/0-0" (default)

R1#sh standby brief P indicates configured to preempt. | Interface Grp Prio P State Active Standby Virtual IP
Fa0/0 0 100 Active local unknown 192.168.0.100
第三步:在R2上配置R2的f0/0接口的hsrp R2(config-if)#standby ip 192.168.0.100 //这里还为组0 第四步:查看R2的hsrp协议状态 R2#sh standby FastEthernet0/0 - Group 0 State is Standby 1 state change, last state change 00:01:41 Virtual IP address is 192.168.0.100 Active virtual MAC address is 0000.0c07.ac00 Local virtual MAC address is 0000.0c07.ac00 (default) Hello time 3 sec, hold time 10 sec Next hello sent in 0.556 secs Preemption disabled Active router is 192.168.0.1, priority 100 (expires in 8.620 sec) Standby router is local Priority 100 (default 100) IP redundancy name is "hsrp-Fa0/0-0" (default)

R2#sh standby brief P indicates configured to preempt. | Interface Grp Prio P State Active Standby Virtual IP
Fa0/0 0 100 Standby 192.168.0.1 local 192.168.0.100
R2# 第五步:配置R2上的抢占功能 R2(config-if)#standby preempt //在下来的步骤中没有抢占成功,我们在后面的实验中介绍 Down到R1的接口在查看show standby R2#sh stan R2#sh standby FastEthernet0/0 - Group 0 State is Active 2 state changes, last state change 00:00:37 Virtual IP address is 192.168.0.100 Active virtual MAC address is 0000.0c07.ac00 Local virtual MAC address is 0000.0c07.ac00 (default) Hello time 3 sec, hold time 10 sec Next hello sent in 1.716 secs Preemption enabled Active router is local Standby router is unknown Priority 100 (default 100) IP redundancy name is "hsrp-Fa0/0-0" (default) 第六步:模拟R1和R2上的热切换,先在R3上ping R3#ping Protocol [ip]: Target IP address: 192.168.0.100 Repeat count [5]: 100000 Datagram size [100]: Timeout in seconds [2]: Extended commands [n]: Sweep range of sizes [n]: 第七步:down到R2上的接口 R2(config)#int f0/0 R2(config-if)#sh 第八步:在R3上看现象 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.....!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //出现了中断 但是在将R2上打开接口后,并没有切换到R2路上,这个问题在后面实验中解决