实验报告<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

实验时间:

<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /> 2009-02-21

实验人:

蔡连军

实验名称:配置热备份路由协议( HSRP

实验任务和目标:

1.        HSRP 的基本配置,可以全网互通。

2.        配置 HSRP 的优先级。

3.        配置 HSRP 的占先权。

4.        配置 Hello 消息计时器。(注意:一般此项不做更改)

5.        配置 HSRP 的端口追踪。

实验环境描述:

北京星辰集团是一家知名软件开发公司,由于市场占有率及其公司规模的不断扩大,每天都有大量的客户需要访问服务器和公司员工需要获取更多的信息,使得公司的一台路由器时不时的出现问题,给公司的发展带来很多不变。星辰公司希望能让公司 24 小时保持 Internet 连接。

实验拓扑及网络规划:

<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />

根据公司需求,为公司设计如图所示的解决方案,用两台 Cisco 3640 路由器来连接 Internet, 使用 HSRP 协议

让不同 vlan 的主机或服务器通过不同的路由器连接外网,即实现了网关的备份又可以做到负载。

实验操作过程及配置说明,配置结果已包含在其中:

1. 在路由器上配置 HSRP ,并实现全网互通。

1.1 R1 e0/0 口和 R2 e0/0 口划分到 HSRP 1 中,配置 HSRP 1 组的虚拟路由器的 ip 192.168.1.100/24.

R1

r1(config)#int e0/0

r1(config-if)#ip add 192.168.1.1 255.255.255.0

r1(config-if)#no sh

r1(config-if)#

*Mar  1 00:02:35.631: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up

*Mar  1 00:02:36.631: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to

up

r1(config-if)#standby 1 ip 192.168.1.100                               R1 e0/0 口加入到组 HSRP 1         

*Mar  1 00:03:23.771: %HSRP-5-STATECHANGE: Ethernet0/0 Grp 1 state Speak -> Standby

*Mar  1 00:03:24.271: %HSRP-5-STATECHANGE: Ethernet0/0 Grp 1 state Standby -> Active

r1(config-if)#duplex full

r1(config-if)#no ip redirects                       关闭端口重定向,默认开启 HSRP 后已经关闭

r1(config-if)#

R2

r2(config)#int e0/0

r2(config-if)#ip add 192.168.1.2 255.255.255.0

r2(config-if)#no sh

*Mar  1 00:06:23.507: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up

*Mar  1 00:06:24.507: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to

up

r2(config-if)#standby 1 ip 192.168.1.100                      R2 e0/0 口加入到组 HSRP 1

*Mar  1 00:06:39.135: %CDP-4-DUPLEX_MISMATCH: duplex mismatch discovered on Ethernet0/0 (not full du

plex), with s1 FastEthernet0/1 (full duplex).

r2(config-if)#duplex full                                            将端口陪为全双工

*Mar  1 00:07:12.527: %HSRP-5-STATECHANGE: Ethernet0/0 Grp 1 state Speak -> Standby

r2(config-if)#no ip redirects                                               

r2(config-if)#end

*Mar  1 00:13:41.739: %SYS-5-CONFIG_I: Configured from console by console

r2#show standby

Ethernet0/0 - Group 1

  State is Standby

    1 state change, last state change 00:06:40

  Virtual IP address is 192.168.1.100           HSRP 1 虚拟路由器 IP

  Active virtual MAC address is 0000.0c07.ac01                        虚拟 MAC 地址,自动生成的

    Local virtual MAC address is 0000.0c07.ac01 (v1 default)

  Hello time 3 sec, hold time 10 sec               发送 hello 消息间隔时间为 3s, 保留时间为 10s

    Next hello sent in 1.084 secs        离下一次发送 hellp 的时间为 1.084s

  Preemption disabled                                           没有启用占先权

  Active router is 192.168.1.1, priority 100 (expires in 9.880 sec)  活动路由器 ip 192.168.1.1 ,其优先级为 100

  Standby router is local                                    本机为备份路由器

  Priority 100 (default 100)                HSRP 中路由器默认优先级为 100

  IP redundancy name is "hsrp-Et0/0-1" (default)

R1

r1(config-if)#int e0/1

r1(config-if)#ip add 192.168.2.1 255.255.255.0

r1(config-if)#no sh

*Mar  1 00:16:42.515: %LINK-3-UPDOWN: Interface Ethernet0/1, changed state to up

*Mar  1 00:16:43.515: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1, changed state to

up

r1(config-if)#standby 2 ip 192.168.2.200                          R1 e0/1 口加入到组 HSRP 2

r1(config-if)#

*Mar  1 00:17:18.543: %HSRP-5-STATECHANGE: Ethernet0/1 Grp 2 state Speak -> Standby

*Mar  1 00:17:19.043: %HSRP-5-STATECHANGE: Ethernet0/1 Grp 2 state Standby -> Active

r1(config-if)#no ip redirects

r1(config-if)#duplex full

r1(config-if)#

 

R2

r2(config)#int e0/1

r2(config-if)#ip add 192.168.2.2 255.255.255.0

r2(config-if)#no sh

*Mar  1 00:18:07.191: %LINK-3-UPDOWN: Interface Ethernet0/1, changed state to up

*Mar  1 00:18:08.191: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1, changed state to

up

r2(config-if)#standby 2 ip 192.168.2.200                      R2 e0/1 口加入到组 HSRP 2

r2(config-if)#no ip redirects

r2(config-if)#duplex full

r2(config-if)#^Z

r2#

*Mar  1 00:18:41.915: %HSRP-5-STATECHANGE: Ethernet0/1 Grp 2 state Speak -> Standby

*Mar  1 00:18:41.919: %SYS-5-CONFIG_I: Configured from console by console

r2#show standby

Ethernet0/0 - Group 1

  State is Standby

    1 state change, last state change 00:11:50

  Virtual IP address is 192.168.1.100

  Active virtual MAC address is 0000.0c07.ac01

    Local virtual MAC address is 0000.0c07.ac01 (v1 default)

  Hello time 3 sec, hold time 10 sec

    Next hello sent in 0.276 secs

  Preemption disabled

  Active router is 192.168.1.1, priority 100 (expires in 9.072 sec)

  Standby router is local

  Priority 100 (default 100)

  IP redundancy name is "hsrp-Et0/0-1" (default)

Ethernet0/1 - Group 2

  State is Standby

    1 state change, last state change 00:00:21

  Virtual IP address is 192.168.2.200                                    虚拟路由器 ip

  Active virtual MAC address is 0000.0c07.ac02                                虚拟路由器 MAC

    Local virtual MAC address is 0000.0c07.ac02 (v1 default)

  Hello time 3 sec, hold time 10 sec

    Next hello sent in 2.664 secs

  Preemption disabled

  Active router is 192.168.2.1, priority 100 (expires in 9.820 sec)                     活动路由器 ip 及其优先级

  Standby router is local                                        本地为备份路由器

  Priority 100 (default 100)

  IP redundancy name is "hsrp-Et0/1-2" (default)

 

1.2 配置 PC 机,测试全网互通:

VPCS 1 >ip 192.168.1.3 192.168.1.100 24              配置 PC1 IP 网关为组 1 虚拟路由器的 IP

PC1 : 192.168.1.3 255.255.255.0 gateway 192.168.1.100

VPCS 1 >2

VPCS 2 >ip 192.168.1.4 192.168.1.2 24                            配置 PC2 IP 网关为 R2 e0/0 口的 IP

PC2 : 192.168.1.4 255.255.255.0 gateway 192.168.1.2

VPCS 2 >3

VPCS 3 >ip 192.168.2.3 192.168.2.200 24                  配置 PC3 IP 网关为组 2 虚拟路由器的 IP

PC3 : 192.168.2.3 255.255.255.0 gateway 192.168.2.200

 

VPCS 3 >show ip

 

NAME   IP/CIDR              GATEWAY           LPORT   RPORT

PC1    192.168.1.3/24       192.168.1.100     10001   21002

PC2    192.168.1.4/24       192.168.1.2       10002   21003

PC3    192.168.2.3/24       192.168.2.200     10003   22002

 

VPCS 3 >ping 192.168.1.3

192.168.1.3 icmp_seq=1 timeout

192.168.1.3 icmp_seq=2 time=125.000 ms

192.168.1.3 icmp_seq=3 time=62.000 ms

192.168.1.3 icmp_seq=4 time=47.000 ms

192.168.1.3 icmp_seq=5 time=47.000 ms

 

VPCS 3 >ping 192.168.1.4

192.168.1.4 icmp_seq=1 timeout

192.168.1.4 icmp_seq=2 time=93.000 ms

192.168.1.4 icmp_seq=3 time=63.000 ms

192.168.1.4 icmp_seq=4 time=125.000 ms

192.168.1.4 icmp_seq=5 time=109.000 ms

 

2. 配置 HSRP 的优先级:

R1

r1(config)#int e0/0

r1(config-if)#standby 1 priority 110                    HSRP1 组中,将活动路由器的优先级改为 110

r1(config-if)#int e0/1

r1(config-if)#standby 2 priority 110                    HSRP2 组中,将活动路由器的优先级改为 110

 

r1(config-if)#^Z

r1#

*Mar  1 00:27:39.027: %SYS-5-CONFIG_I: Configured from console by console

r1#show standby bri

                     P indicates configured to preempt.

                     |

Interface   Grp Prio P State    Active          Standby         Virtual IP

Et0/0       1   110    Active   local           192.168.1.2     192.168.1.100

Et0/1       2   110    Active   local           192.168.2.2     192.168.2.200

 

R2

r2(config)#int e0/0

r2(config-if)#standby 1 priority 120                    HSRP1 组中,将备份路由器的优先级改为 120

r2(config-if)#int e0/1

r2(config-if)#standby 2 priority 120                    HSRP2 组中,将备份路由器的优先级改为 120

r2(config-if)#^Z

r2#

*Mar  1 00:30:05.867: %SYS-5-CONFIG_I: Configured from console by console

r2#show standby

Ethernet0/0 - Group 1

  State is Standby

    1 state change, last state change 00:23:05

  Virtual IP address is 192.168.1.100

  Active virtual MAC address is 0000.0c07.ac01

    Local virtual MAC address is 0000.0c07.ac01 (v1 default)

  Hello time 3 sec, hold time 10 sec

    Next hello sent in 0.464 secs

  Preemption disabled

  Active router is 192.168.1.1, priority 110 (expires in 9.256 sec)

  Standby router is local

  Priority 120 (configured 120)

  IP redundancy name is "hsrp-Et0/0-1" (default)

Ethernet0/1 - Group 2

  State is Standby

    1 state change, last state change 00:11:36

  Virtual IP address is 192.168.2.200

  Active virtual MAC address is 0000.0c07.ac02

    Local virtual MAC address is 0000.0c07.ac02 (v1 default)

  Hello time 3 sec, hold time 10 sec

    Next hello sent in 2.836 secs

  Preemption disabled

  Active router is 192.168.2.1, priority 110 (expires in 6.960 sec)

  Standby router is local

  Priority 120 (configured 120)

  IP redundancy name is "hsrp-Et0/1-2" (default)

从上面的配置可以看出虽然备份路由器的优先级高于活动路由器此时备份路由器也不能自动变为活动路由器,还需在备份路由器上配置占先权才可。

R2

r2(config)#int e0/0

r2(config-if)#standby 1 preempt              HSRP1 组的备份路由器配置占先权

r2(config-if)#

*Mar  1 00:32:44.415: %HSRP-5-STATECHANGE: Ethernet0/0 Grp 1 state Standby -> Active

r2(config-if)#int e0/1

r2(config-if)#do show standby

Ethernet0/0 - Group 1

  State is Active

    2 state changes, last state change 00:00:50

  Virtual IP address is 192.168.1.100

  Active virtual MAC address is 0000.0c07.ac01

    Local virtual MAC address is 0000.0c07.ac01 (v1 default)

  Hello time 3 sec, hold time 10 sec

    Next hello sent in 0.388 secs

  Preemption enabled

  Active router is local                                  本地 R2 变为活动路由器

  Standby router is 192.168.1.1, priority 110 (expires in 8.432 sec)

  Priority 120 (configured 120)

  IP redundancy name is "hsrp-Et0/0-1" (default)

Ethernet0/1 - Group 2

  State is Standby

    1 state change, last state change 00:14:53

  Virtual IP address is 192.168.2.200

  Active virtual MAC address is 0000.0c07.ac02

    Local virtual MAC address is 0000.0c07.ac02 (v1 default)

  Hello time 3 sec, hold time 10 sec

    Next hello sent in 0.884 secs

  Preemption disabled

  Active router is 192.168.2.1, priority 110 (expires in 8.072 sec)

  Standby router is local

  Priority 120 (configured 120)

  IP redundancy name is "hsrp-Et0/1-2" (default)

r2(config-if)#

在配置占要求的 HSRP 1 中备份路由器已经变为 Active ,而另了一个依然为 Standby router

3. 配置 Hello 消息的计时器:此项的值通常是最合适的,所以建议保持该项不变

R2

r2(config-if)#int e0/0

r2(config-if)#standby 1 timers 4 12                 配置 hello 消息的计时器

r2(config-if)#end

r2#show standby

Ethernet0/0 - Group 1

  State is Active

    2 state changes, last state change 00:12:27

  Virtual IP address is 192.168.1.100

  Active virtual MAC address is 0000.0c07.ac01

    Local virtual MAC address is 0000.0c07.ac01 (v1 default)

  Hello time 4 sec, hold time 12 sec                     配置后的计时器

    Next hello sent in 3.060 secs

  Preemption enabled

  Active router is local

  Standby router is 192.168.1.1, priority 110 (expires in 8.100 sec)

  Priority 120 (configured 120)

  IP redundancy name is "hsrp-Et0/0-1" (default)

 

4. 配置端口跟踪 : 利用端口跟踪,活跃路由器的优先级可以基于路由器端口的可用性而自动调整,当活跃路由器的上一个跟踪变为不可用时,活跃路由器的 HSRP 优先级将被降低。此时即使备份路由器的优先级高于活跃路由器也不能自动变为活跃路由器,须在在备份路由器上配置占先权才行 .

R2

r2(config)#int e0/0

r2(config-if)#standby 1 track e0/1 50             配置端口追踪,追踪端口为 R2 e0/1

r2(config-if)#standby 1 preempt                              为其配置占先权,在其回复后抢回原有地位

r2(config-if)#^Z

r2#

*Mar  1 00:48:27.619: %SYS-5-CONFIG_I: Configured from console by console

r2#show standby

Ethernet0/0 - Group 1

  State is Active

    2 state changes, last state change 00:15:54

  Virtual IP address is 192.168.1.100

  Active virtual MAC address is 0000.0c07.ac01

    Local virtual MAC address is 0000.0c07.ac01 (v1 default)

  Hello time 4 sec, hold time 12 sec

    Next hello sent in 0.464 secs

  Preemption enabled                                          已启用占先权

  Active router is local

  Standby router is 192.168.1.1, priority 110 (expires in 9.536 sec)

  Priority 120 (configured 120)

    Track interface Ethernet0/1 state Up decrement 50    当其上行链路不可用时,其优先级自动减去 50

  IP redundancy name is "hsrp-Et0/0-1" (default)

Ethernet0/1 - Group 2

  State is Standby

    1 state change, last state change 00:29:57

  Virtual IP address is 192.168.2.200

  Active virtual MAC address is 0000.0c07.ac02

    Local virtual MAC address is 0000.0c07.ac02 (v1 default)

  Hello time 3 sec, hold time 10 sec

    Next hello sent in 2.956 secs

  Preemption disabled

  Active router is 192.168.2.1, priority 110 (expires in 9.268 sec)

  Standby router is local

  Priority 120 (configured 120)

  IP redundancy name is "hsrp-Et0/1-2" (default)

r2#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

r2(config)#int e0/1

r2(config-if)#shutdown                                       关闭 R2 e0/1

r2(config-if)#

*Mar  1 00:49:23.503: %HSRP-5-STATECHANGE: Ethernet0/1 Grp 2 state Standby -> Init

*Mar  1 00:49:25.503: %LINK-5-CHANGED: Interface Ethernet0/1, changed state to administratively down

 

*Mar  1 00:49:26.503: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1, changed state to

down

 

R1

r1(config)#int e0/0

r1(config-if)#standby 1 preempt            备份路由器发生政变,并取得后的路由器地位

r1(config-if)#

*Mar  1 00:52:29.431: %HSRP-5-STATECHANGE: Ethernet0/0 Grp 1 state Standby -> Active

r1(config-if)#do show standby

Ethernet0/0 - Group 1

  State is Active

    5 state changes, last state change 00:00:37

  Virtual IP address is 192.168.1.100

  Active virtual MAC address is 0000.0c07.ac01

    Local virtual MAC address is 0000.0c07.ac01 (v1 default)

  Hello time 4 sec, hold time 12 sec

    Next hello sent in 3.184 secs

  Preemption enabled

  Active router is local

  Standby router is 192.168.1.2, priority 70 (expires in 11.116 sec)              R2 的优先级变为 70

  Priority 110 (configured 110)

  IP redundancy name is "hsrp-Et0/0-1" (default)

 

R1

r1#debug standby                                   开启调试功能,查看其选举过程

HSRP debugging is on

4.1 在开启调试功能的同时将被关闭的端口激活

r2(config)#int e0/1

r2(config-if)#no shu                                         激活被 down 掉的端口

r2(config-if)#

*Mar  1 00:56:19.583: %LINK-3-UPDOWN: Interface Ethernet0/1, changed state to up

*Mar  1 00:56:19.915: %HSRP-5-STATECHANGE: Ethernet0/0 Grp 1 state Standby -> Active

*Mar  1 00:56:20.583: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1, changed state to

up

r2(config-if)#^Z

r2#

*Mar  1 00:56:38.111: %SYS-5-CONFIG_I: Configured from console by console

*Mar  1 00:56:38.583: %HSRP-5-STATECHANGE: Ethernet0/1 Grp 2 state Speak -> Standby

r2#show standby

Ethernet0/0 - Group 1

  State is Active

    5 state changes, last state change 00:00:41

  Virtual IP address is 192.168.1.100

  Active virtual MAC address is 0000.0c07.ac01

    Local virtual MAC address is 0000.0c07.ac01 (v1 default)

  Hello time 4 sec, hold time 12 sec

    Next hello sent in 2.984 secs

  Preemption enabled

  Active router is local                              R2 重新变为活动路由器地位

  Standby router is 192.168.1.1, priority 110 (expires in 11.320 sec)

  Priority 120 (configured 120)

    Track interface Ethernet0/1 state Up decrement 50

  IP redundancy name is "hsrp-Et0/0-1" (default)

Ethernet0/1 - Group 2

  State is Standby

    3 state changes, last state change 00:00:22

  Virtual IP address is 192.168.2.200

  Active virtual MAC address is 0000.0c07.ac02

    Local virtual MAC address is 0000.0c07.ac02 (v1 default)

  Hello time 3 sec, hold time 10 sec

    Next hello sent in 1.632 secs

  Preemption disabled

  Active router is 192.168.2.1, priority 110 (expires in 7.504 sec)

  Standby router is local

  Priority 120 (configured 120)

  IP redundancy name is "hsrp-Et0/1-2" (default)

r2#

4.2 查看调试过程

r1#

*Mar  1 00:56:16.043: HSRP: Et0/1 Grp 2 Hello  out 192.168.2.1 Active  pri 110 vIP 192.168.2.200

*Mar  1 00:56:16.603: HSRP: Et0/1 REDIRECT adv in, Passive, active 0, passive 1, from 192.168.2.2

*Mar  1 00:56:17.675: HSRP: Et0/0 Grp 1 Hello  in  192.168.1.2 Standby pri 120 vIP 192.168.1.100

*Mar  1 00:56:17.819: HSRP: Et0/0 Grp 1 Hello  out 192.168.1.1 Active  pri 110 vIP 192.168.1.100

*Mar  1 00:56:17.979: HSRP: Et0/0 REDIRECT adv in, Active, active 1, passive 2, from 192.168.1.2

*Mar  1 00:56:18.051: HSRP: Et0/0 API arp proto filter, 0000.0c07.ac01 is active vMAC for grp 1 - fi

lter

*Mar  1 00:56:18.055: HSRP: Et0/0 Grp 1 Coup   in  192.168.1.2 Standby pri 120 vIP 192.168.1.100

*Mar  1 00:56:18.055: HSRP: Et0/0 Grp 1 Active: j/Coup rcvd from higher pri router (120/192.168.1.2)

 

*Mar  1 00:56:18.055: HSRP: Et0/0 Grp 1 Active router is 192.168.1.2, was local

*Mar  1 00:56:18.059: HSRP: Et0/0 Grp 1 Standby router is unknown, was 192.168.1.2

*Mar  1 00:56:18.059: HSRP: Et0/0 Grp 1 Active -> Speak

*Mar  1 00:56:18.059: %HSRP-5-STATECHANGE: Ethernet0/0 Grp 1 state Active -> Speak

*Mar  1 00:56:18.059: HSRP: Et0/0 Grp 1 Redundancy "hsrp-Et0/0-1" state Active -> Speak

*Mar  1 00:56:18.063: HSRP: Et0/0 Redirect adv out, Passive, active 0 passive 1

*Mar  1 00:56:18.067: HSRP: Et0/0 API MAC address update

*Mar  1 00:56:18.071: HSRP: Et0/0 Grp 1 Hello  out 192.168.1.1 Speak   pri 110 vIP 192.168.1.100

*Mar  1 00:56:18.071: HSRP: Et0/0 REDIRECT adv in, Active, active 1, passive 1, from 192.168.1.2

*Mar  1 00:56:18.071: HSRP: Et0/0 Grp 1 Hello  in  192.168.1.2 Active  pri 120 vIP 192.168.1.100

*Mar  1 00:56:19.043: HSRP: Et0/1 Grp 2 Hello  out 192.168.2.1 Active  pri 110 vIP 192.168.2.200

*Mar  1 00:56:21.931: HSRP: Et0/0 Grp 1 Hello  in  192.168.1.2 Active  pri 120 vIP 192.168.1.100

*Mar  1 00:56:22.043: HSRP: Et0/1 Grp 2 Hello  out 192.168.2.1 Active  pri 110 vIP 192.168.2.200

*Mar  1 00:56:22.071: HSRP: Et0/0 Grp 1 Hello  out 192.168.1.1 Speak   pri 110 vIP 192.168.1.100

*Mar  1 00:56:25.043: HSRP: Et0/1 Grp 2 Hello  out 192.168.2.1 Active  pri 110 vIP 192.168.2.200

*Mar  1 00:56:25.931: HSRP: Et0/0 Grp 1 Hello  in  192.168.1.2 Active  pri 120 vIP 192.168.1.100

*Mar  1 00:56:26.071: HSRP: Et0/0 Grp 1 Hello  out 192.168.1.1 Speak   pri 110 vIP 192.168.1.100

*Mar  1 00:56:26.587: HSRP: Et0/1 Grp 2 Hello  in  192.168.2.2 Speak   pri 120 vIP 192.168.2.200

*Mar  1 00:56:28.043: HSRP: Et0/1 Grp 2 Hello  out 192.168.2.1 Active  pri 110 vIP 192.168.2.200

*Mar  1 00:56:29.587: HSRP: Et0/1 Grp 2 Hello  in  192.168.2.2 Speak   pri 120 vIP 192.168.2.200

*Mar  1 00:56:29.931: HSRP: Et0/0 Grp 1 Hello  in  192.168.1.2 Active  pri 120 vIP 192.168.1.100

*Mar  1 00:56:30.055: HSRP: Et0/0 Grp 1 Speak: d/Standby timer expired (unknown)

*Mar  1 00:56:30.055: HSRP: Et0/0 Grp 1 Standby router is local

*Mar  1 00:56:30.055: HSRP: Et0/0 Grp 1 Speak -> Standby

*Mar  1 00:56:30.055: %HSRP-5-STATECHANGE: Ethernet0/0 Grp 1 state Speak -> Standby

*Mar  1 00:56:30.059: HSRP: Et0/0 Grp 1 Redundancy "hsrp-Et0/0-1" state Speak -> Standby

*Mar  1 00:56:30.059: HSRP: Et0/0 Grp 1 Hello  out 192.168.1.1 Standby pri 110 vIP 192.168.1.100

*Mar  1 00:56:31.043: HSRP: Et0/1 Grp 2 Hello  out 192.168.2.1 Active  pri 110 vIP 192.168.2.200

*Mar  1 00:56:32.603: HSRP: Et0/1 Grp 2 Hello  in  192.168.2.2 Speak   pri 120 vIP 192.168.2.200

*Mar  1 00:56:33.963: HSRP: Et0/0 Grp 1 Hello  in  192.168.1.2 Active  pri 120 vIP 192.168.1.100

*Mar  1 00:56:34.043: HSRP: Et0/1 Grp 2 Hello  out 192.168.2.1 Active  pri 110 vIP 192.168.2.200

*Mar  1 00:56:34.059: HSRP: Et0/0 Grp 1 Hello  out 192.168.1.1 Standby pri 110 vIP 192.168.1.100

 

4.3 使用 no debug all no debug standby 关闭调试功能。此功能消耗大量的路由器资源,所以用完后应及时关闭,强烈建议:在路由器资源使用很大或是路由器负担很重的情况不要开启该功能。

r1#no debug all

*Mar  1 00:57:30.011: HSRP: Et0/0 Grp 1 Hello  in  192.168.1.2 Active  pri 120 vIP 192.168.1.100

*Mar  1 00:57:30.059: HSRP: Et0/0 Grp 1 Hello  out 192.168.1.1 Standby pri 110 vIP 192.168.1.100

*Mar  1 00:57:30.635: HSRP: Et0/1 Grp 2 Hello  in  192.168.2.2 Standby pri 120 vIP 192.168.2.200

All possible debugging has been turned off

r1#

5. 配置完毕,检测全网是否互通。

VPCS 3 >ping 192.168.1.3

192.168.1.3 icmp_seq=1 time=78.000 ms

192.168.1.3 icmp_seq=2 time=109.000 ms

192.168.1.3 icmp_seq=3 time=125.000 ms

192.168.1.3 icmp_seq=4 time=125.000 ms

192.168.1.3 icmp_seq=5 time=93.000 ms

 

VPCS 3 >ping 192.168.1.4

192.168.1.4 icmp_seq=1 time=79.000 ms

192.168.1.4 icmp_seq=2 time=63.000 ms

192.168.1.4 icmp_seq=3 time=47.000 ms

192.168.1.4 icmp_seq=4 time=47.000 ms

192.168.1.4 icmp_seq=5 time=156.000 ms

总结和分析:

1.        HSRP 不仅可以实现网关的备份,实现动态的网关,还可以起到负载的功能。

2.        HSRP 组包含活动路由器、备份路由器、虚拟路由器和其他路由器。一个 HSRP 组中有且只有一个为活动路由器,并负责转发数据,一个路由器的多个端口不能属于一个 HSRP 组。

3.        利用端口跟踪,活跃路由器的优先级可以基于路由器端口的可用性而自动调整,当活跃路由器的上一个跟踪变为不可用时,活跃路由器的 HSRP 优先级将被降低。此时即使备份路由器的优先级高于活跃路由器也不能自动变为活跃路由器,须在在备份路由器上配置占先权才行 .