目录

简介

本文档介绍如何配置IPv6(HSRPv2)组的备用热备份路由器协议(HSRP),以跟踪对象并根据对象状态更改HSRP优先级。

每个被跟踪对象都有一个在跟踪命令行界面(CLI)上指定的唯一编号。HSRPv2使用此编号跟踪特定对象。跟踪过程会定期轮询跟踪对象以了解值更改,并立即或在指定延迟后将任何更改(作为up或down值)发送到HSRPv2。本文档使用track interface命令配置要跟踪的接口。

先决条件

要求

尝试进行此配置之前,请确保满足以下要求:

使用的组件

本文档中的配置基于运行Cisco IOS®软件版本15.0(1)的Cisco7200系列路由器。

规则

有关文档规则的信息,请参阅 Cisco 技术提示规则。

配置

R2和R3路由器通过串行接口连接到R1。R2和R3的快速以太网接口配置了HSRP IPv6,使R2充当活动路由器,R3充当备用路由器。在路由器R2中,跟踪过程配置为跟踪串行接口1/0的接口线路协议的状态:如果R2的串行接口S1/0关闭,R3路由器会将其状态从“备用”更改为“主用”

注意:使用命令查找工具(限注册客户)可查找有关本文档中使用的命令的详细信息。

网络图

本文档使用以下网络设置:

to-hsrpv2-config-01.gif

配置

本文档使用以下配置:

路由器 R1 配置
!
version 15.0
!
hostname R1
!
ipv6 unicast-routing
ipv6 cef
!
!
interface Serial1/0
 no ip address
 ipv6 address 2010:10:10:10::1/64
 serial restart-delay 0
!
!
interface Serial1/1
 no ip address
 ipv6 address 2011:11:11:11::1/64
 serial restart-delay 0
 !
end

路由器 R2 配置
!
version 15.0
!
hostname R2
!
ipv6 unicast-routing
ipv6 cef
!
track 1 interface Serial1/0 line-protocol

!--- Tracking process 1 is configured in the router !--- to track state of the interface line protocol !--- of serial interface 1/0

!
interface Serial1/0
 no ip address
 ipv6 address 2010:10:10:10::2/64
 serial restart-delay 0
!
!
interface FastEthernet2/0
 no ip address
 duplex auto
 speed auto
 ipv6 address 1010:1:1:1::10/64
 standby version 2
 standby 10 ipv6 autoconfig

!--- Assigns a standby group and standby IP address.

 standby 10 preempt delay minimum 45

!--- The preempt command allows the router to become the !--- active router when it has the priority higher than all the other !--- HSRP-configured routers. Without this command, even if a router has higher !--- priority value, it will not become an active router. !--- The delay minimum value causes the local router to postpone !--- taking over the active role for a minimum of 45 seconds.

 standby 10 track 1 decrement 10

!--- Configures HSRP to track an object and change the Hot Standby !--- priority on the basis of the state of the object. 


!--- In this example,the HSRP tracks the interface s1/0 mentioned !--- in the track process 1.


!--- Decrement value specified the amount by which the Hot Standby !--- priority for the router is decremented (or incremented) when the tracked object !--- goes down (or comes back up). The range is from 1 to 255. The default is 10. 

!
end

路由器 R3 配置
!
version 15.0
!
hostname R3
!
ipv6 unicast-routing
ipv6 cef
!
interface Serial1/0
 no ip address
 ipv6 address 2011:11:11:11::2/64
 serial restart-delay 0
!
interface FastEthernet2/0
 no ip address
 duplex auto
 speed auto
 ipv6 address 1010:1:1:1::11/64
 standby version 2
 standby 10 ipv6 autoconfig
 standby 10 priority 95
 standby 10 preempt delay minimum 45
!
end

验证

在R2和R3路由器上使用show standby命令以检验配置。

路由器 R2
R2#show standby
FastEthernet2/0 - Group 10 (version 2)
  State is Active
    5 state changes, last state change 00:26:03
  Virtual IP address is FE80::5:73FF:FEA0:A
  Active virtual MAC address is 0005.73a0.000a
    Local virtual MAC address is 0005.73a0.000a (v2 IPv6 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 1.872 secs
  Preemption enabled, delay min 45 secs
  Active router is local
  Standby router is FE80::C802:AFF:FE10:38, priority 95 (expires in 8.048 sec)
  Priority 100 (default 100)
    Track object 1 state Up decrement 10
  Group name is "hsrp-Fa2/0-10" (default)

路由器 R3
R3#show standby
FastEthernet2/0 - Group 10 (version 2)
  State is Standby
    4 state changes, last state change 00:26:25
  Virtual IP address is FE80::5:73FF:FEA0:A
  Active virtual MAC address is 0005.73a0.000a
    Local virtual MAC address is 0005.73a0.000a (v2 IPv6 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.176 secs
  Preemption enabled, delay min 45 secs
  Active router is FE80::C801:14FF:FEF4:38, priority 100 (expires in 9.888 sec)
    MAC address is ca01.14f4.0038
  Standby router is local
  Priority 95 (configured 95)
  Group name is "hsrp-Fa2/0-10" (default)

要显示跟踪信息,请在路由器R2中使用show track命令。

路由器 R2
R2#show track 1
Track 1
  Interface Serial1/0 line-protocol
  Line protocol is Up
    3 changes, last change 00:28:39
  Tracked by:
    HSRP FastEthernet2/0 10

!--- Displays the information about the objects that !--- are tracked by tracking process 1.

R2#show track int brief
Track   Object                           Parameter        Value Last Change
1       interface   Serial1/0            line-protocol    Up    00:31:19

!--- Displays the information about the tracked interface.

如果活动路由器(本例中为R2)关闭,备用路由器会立即将其状态更改为Active,如下表所示:

当活动路由器(R2)关闭时……
路由器 R2
R2(config)#interface s1/0
R2(config-if)#shut
R2(config-if)#
*May 21 20:56:54.223: %TRACKING-5-STATE: 1 interface Se1/0 line-protocol Up->Down
R2(config-if)#
*May 21 20:56:56.203: %LINK-5-CHANGED: Interface Serial1/0, changed state to administratively down
*May 21 20:56:57.203: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to down
R2(config-if)#
*May 21 20:57:43.087: %HSRP-5-STATECHANGE: FastEthernet2/0 Grp 10 state Active -> Speak
R2(config-if)#
*May 21 20:57:54.479: %HSRP-5-STATECHANGE: FastEthernet2/0 Grp 10 state Speak -> Standby


!--- When the interface goes down, the active router changes !--- its state to Standby.

路由器 R3
R3#
*May 21 20:56:53.419: %HSRP-5-STATECHANGE: FastEthernet2/0 Grp 10 state Standby-> Active


!--- The standby router is now the active router.
 

R3#show standby
FastEthernet2/0 - Group 10 (version 2)
  State is Active
    5 state changes, last state change 00:02:32
  Virtual IP address is FE80::5:73FF:FEA0:A
  Active virtual MAC address is 0005.73a0.000a
    Local virtual MAC address is 0005.73a0.000a (v2 IPv6 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.080 secs
  Preemption enabled, delay min 45 secs
  Active router is local
  Standby router is FE80::C801:14FF:FEF4:38, priority 90 (expires in 9.664 sec)
  Priority 95 (configured 95)
  Group name is "hsrp-Fa2/0-10" (default)

故障排除

目前没有针对此配置的故障排除信息。

相关信息