本文說明如何為IPv6(HSRPv2)組配置備用熱備份路由器協定(HSRP)以跟蹤對象並根據對象狀態更改HSRP優先順序。
每個跟蹤對象都有一個在跟蹤命令列介面(CLI)上指定的唯一編號。HSRPv2使用此數字跟蹤特定對象。跟蹤進程定期輪詢跟蹤對象以查詢值更改,並立即或在指定延遲之後向HSRPv2傳送任何更改(作為啟動或關閉值)。本檔案使用track interface命令設定要追蹤的介面。
嘗試此組態之前,請確保符合以下要求:
配置HSRP的知識;有關詳細資訊,請參閱配置HSRP。
實施IPv6編址和基本連線的基礎知識;有關詳細資訊,請參閱實施IPv6編址和基本連線。
增強型目標跟蹤的基礎知識
在配置HSRP IPv6之前,必須在介面上啟用HSRPv2。
必須在裝置上啟用IPv6單播路由,才能配置HSRP IPv6。
本文檔中的配置基於運行Cisco IOS®軟體版本15.0(1)的Cisco7200系列路由器。
如需檔案慣例的相關資訊,請參閱思科技術提示慣例。
R2和R3路由器通過串列介面連線到R1。R2和R3的快速乙太網介面配置了HSRP IPv6,R2充當活動路由器,R3充當備用路由器。在路由器R2中,跟蹤過程配置為跟蹤串列介面1/0的介面線路協定的狀態:如果R2的串列介面S1/0關閉,R3路由器會將其狀態從Standby更改為Active。
註:使用Command Lookup Tool(僅限註冊客戶)查詢有關本文檔中使用的命令的更多資訊。
本檔案會使用以下網路設定:
本檔案會使用以下設定:
路由器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) |
目前尚無適用於此組態的具體疑難排解資訊。
修訂 | 發佈日期 | 意見 |
---|---|---|
1.0 |
22-May-2012 |
初始版本 |