版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。 http://gearfox.blog.51cto.com/719180/169553
|
R1配置
在R1上开启HSRP
r1(config)#int f0/0
r1(config-if)#ip add 192.168.0.1 255.255.255.0 r1(config-if)#no sh r1(config-if)#^Z
r1#config t
r1(config)#int f0/0 r1(config-if)#standby 1 ip 192.168.0.10 r1(config-if)#^Z r1#debug standby HSRP debugging is on
r1#
*Mar 16 17:15:50.147: HSRP: Fa0/0 Grp 1 Listen: c/Active timer expired (unknown) *Mar 16 17:15:50.147: HSRP: Fa0/0 Grp 1 Listen -> Speak *Mar 16 17:15:50.151: HSRP: Fa0/0 Grp 1 Redundancy “hsrp-Fa0/0-1″ state Backup -> Speak *Mar 16 17:15:50.151: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Speak pri 100 vIP 192.168.0.10 *Mar 16 17:15:53.155: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Speak pri 100 vIP 192.168.0.10 *Mar 16 17:15:56.155: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Speak pri 100 vIP 192.168.0.10 *Mar 16 17:15:59.155: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Speak pri 100 vIP 192.168.0.10 *Mar 16 17:16:00.147: HSRP: Fa0/0 Grp 1 Speak: d/Standby timer expired (unknown) *Mar 16 17:16:00.147: HSRP: Fa0/0 Grp 1 Standby router is local *Mar 16 17:16:00.151: HSRP: Fa0/0 Grp 1 Speak -> Standby *Mar 16 17:16:00.151: HSRP: Fa0/0 Grp 1 Redundancy “hsrp-Fa0/0-1″ state Speak -> Standby *Mar 16 17:16:00.151: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Standby pri 100 vIP 192.168.0.10 *Mar 16 17:16:00.155: HSRP: Fa0/0 Grp 1 Standby: c/Active timer expired (unknown) *Mar 16 17:16:00.159: HSRP: Fa0/0 Grp 1 Active router is local *Mar 16 17:16:00.159: HSRP: Fa0/0 Grp 1 Standby router is unknown, was local *Mar 16 17:16:00.163: HSRP: Fa0/0 Grp 1 Standby -> Active *Mar 16 17:16:00.163: %HSRP-5-STATECHANGE: FastEthernet0/0 Grp 1 state Standby -> Active *Mar 16 17:16:00.163: HSRP: Fa0/0 Grp 1 Redundancy “hsrp-Fa0/0-1″ state Standby -> Active *Mar 16 17:16:00.167: HSRP: Fa0/0 Redirect adv out, Active, active 1 passive 0 *Mar 16 17:16:00.167: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Active pri 100 vIP 192.168.0.10 3秒发送一次hello信息 *Mar 16 17:16:03.171: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Active pri 100 vIP 192.168.0.10 *Mar 16 17:16:03.175: HSRP: Fa0/0 Grp 1 Redundancy group hsrp-Fa0/0-1 state Active -> Active *Mar 16 17:16:06.171: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Active pri 100 vIP 192.168.0.10 *Mar 16 17:16:06.175: HSRP: Fa0/0 Grp 1 Redundancy group hsrp-Fa0/0-1 state Active -> Active *Mar 16 17:16:09.171: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Active pri 100 vIP 192.168.0.10 *Mar 16 17:16:12.171: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Active pri 100 vIP 192.168.0.10 *Mar 16 17:16:15.171: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Active pri 100 vIP 192.168.0.10 *Mar 16 17:16:18.171: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Active pri 100 vIP 192.168.0.10 *Mar 16 17:16:21.171: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Active pri 100 vIP 192.168.0.10 *Mar 16 17:16:24.171: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Active pri 100 vIP 192.168.0.10 *Mar 16 17:16:27.171: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Active pri 100 vIP 192.168.0.10 *Mar 16 17:16:30.171: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Active pri 100 vIP 192.168.0.10 *Mar 16 17:16:33.171: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Active pri 100 vIP 192.168.0.10 *Mar 16 17:16:36.171: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Active pri 100 vIP 192.168.0.10 *Mar 16 17:16:39.171: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Active pri 100 vIP 192.168.0.10 *Mar 16 17:16:42.171: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Active pri 100 vIP 192.168.0.10 *Mar 16 17:16:45.171: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Active pri 100 vIP 192.168.0.10 r1#u all All possible debugging has been turned off r1# *Mar 16 17:16:48.171: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.1 Active pri 100 vIP 192.168.0.10 r1#sh standby FastEthernet0/0 �C Group 1 State is Active 活动状态 2 state changes, last state change 00:01:01 Virtual IP address is 192.168.0.10 虚拟ip为192.168.0.10 Active virtual MAC address is 0000.0c07.ac01 虚拟mac为0000.0c07.ac01 Local virtual MAC address is 0000.0c07.ac01 (default) Hello time 3 sec, hold time 10 sec Next hello sent in 1.864 secs Preemption disabled 没有设置为抢占 Active router is local Standby router is unknown Priority 100 (default 100) hsrp优先级为100 (默认) IP redundancy name is “hsrp-Fa0/0-1″ (default)
r1#sh standby brief
P indicates configured to preempt. | Interface Grp Prio P State Active Standby Virtual IP Fa0/0 1 100 Active local unknown 192.168.0.10
将R2配置HSRP
r2(config)#int f0/0
r2(config-if)#standby 1 ip 192.168.0.10 r2(config-if)#^Z r2#debug standby HSRP debugging is on
r2#
*Mar 16 17:21:55.119: HSRP: Fa0/0 Grp 1 Hello in 192.168.0.1 Active pri 100 vIP 192.168.0.10 *Mar 16 17:21:55.123: HSRP: Fa0/0 Grp 1 Active router is 192.168.0.1 *Mar 16 17:21:55.123: HSRP: Fa0/0 Grp 1 Hello in 192.168.0.1 Active pri 100 vIP 192.168.0.10 *Mar 16 17:21:55.127: HSRP: Fa0/0 Grp 1 Hello in 192.168.0.1 Active pri 100 vIP 192.168.0.10 *Mar 16 17:21:55.127: HSRP: Fa0/0 Interface up *Mar 16 17:21:55.127: HSRP: Fa0/0 Starting minimum interface delay (1 secs) *Mar 16 17:21:56.127: HSRP: Fa0/0 Interface min delay expired *Mar 16 17:21:56.127: HSRP: Fa0/0 Grp 1 Init: a/HSRP enabled
hsrp模式开启
*Mar 16 17:21:56.127: HSRP: Fa0/0 Grp 1 Init -> Listen *Mar 16 17:21:56.127: HSRP: Fa0/0 Grp 1 Redundancy “hsrp-Fa0/0-1″ state Init -> Backup 成为备份模式 *Mar 16 17:21:56.127: HSRP: Fa0/0 Redirect adv out, Passive, active 0 passive 1
r2#sh standby
FastEthernet0/0 �C Group 1 State is Standby 1 state change, last state change 00:06:51 Virtual IP address is 192.168.0.10 Active virtual MAC address is 0000.0c07.ac01 Local virtual MAC address is 0000.0c07.ac01 (default) Hello time 3 sec, hold time 10 sec Next hello sent in 2.144 secs Preemption disabled Active router is 192.168.0.1, priority 100 (expires in 7.396 sec) Standby router is local Priority 100 (default 100) IP redundancy name is “hsrp-Fa0/0-1″ (default)
在R1上关闭接口
r1#config t
r1(config)#int f0/0 r1(config-if)#sh
在R2上查看现象
r2#
*Mar 16 17:35:49.083: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.2 Standby pri 100 vIP 192.168.0.10 *Mar 16 17:35:51.439: HSRP: Fa0/0 Grp 1 Standby: c/Active timer expired (192.168.0.1) *Mar 16 17:35:51.439: HSRP: Fa0/0 Grp 1 Active router is local, was 192.168.0.1 *Mar 16 17:35:51.443: HSRP: Fa0/0 Grp 1 Standby router is unknown, was local *Mar 16 17:35:51.443: HSRP: Fa0/0 Grp 1 Standby -> Active *Mar 16 17:35:51.447: %HSRP-5-STATECHANGE: FastEthernet0/0 Grp 1 state Standby -> Active *Mar 16 17:35:51.447: HSRP: Fa0/0 Grp 1 Redundancy “hsrp-Fa0/0-1″ state Standby -> Active *Mar 16 17:35:51.451: HSRP: Fa0/0 Redirect adv out, Active, active 1 passive 1 *Mar 16 17:35:51.451: HSRP: Fa0/0 Grp 1 Hello out 192.168.0.2 Active pri 100 vIP 192.168.0.10sh standby FastEthernet0/0 �C Group 1 State is Active 成为了活动状态 4 state changes, last state change 00:00:02 Virtual IP address is 192.168.0.10 Active virtual MAC address is 0000.0c07.ac01 Local virtual MAC address is 0000.0c07.ac01 (default) Hello time 3 sec, hold time 10 sec Next hello sent in 0.968 secs Preemption enabled Active router is local Standby router is unknown Priority 100 (default 100) IP redundancy name is “hsrp-Fa0/0-1″ (default)
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-if)#^Z
r3(config)#no ip routing
r3(config)#ip default-gateway 192.168.0.10 r3(config)#^Z
r3#ping 192.168.0.10
Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.0.10, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 16/232/1052 ms
可以ping通虚拟地址
将R3模式为一台PC做试验
r3#sh arp
Protocol Address Age (min) Hardware Addr Type Interface Internet 192.168.0.10 0 0000.0c07.ac01 ARPA FastEthernet0/0 Internet 192.168.0.3 - ca93.6968.0000 ARPA FastEthernet0/0
r3#ping
Protocol [ip]: Target IP address: 192.168.0.10 Repeat count [5]: 10000 Datagram size [100]: Timeout in seconds [2]: Extended commands [n]: Sweep range of sizes [n]: Type escape sequence to abort. Sending 10000, 100-byte ICMP Echos to 192.168.0.10, timeout is 2 seconds: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|
|
|
|