詳解:Cisco HSRP的配置
HSRP的配(pèi)置(zhì)
拓撲圖
實驗步驟(zhòu):
- 配(pèi)置IP地址和路由協議
R1(config)#interface f0/0R1(config-if)#ip address 192.168.13.1 255.255.255.0R1(config-if)#no shutdownR1(config)#interface s1/1R1(config-if)#ip address 192.168.12.1 255.255.255.0R1(config-if)#no shutdownR1(config)#router ripR1(config-router)#network 192.168.12.0R1(config-router)#network 192.168.13.0R1(config-router)#passive-interface f0/0//之所以把f0/0接(jiē)口設為被動接口,是為了防(fáng)止從該口向R3發送RIP信息。R2(config)#interface f0/0R2(config-if)#ip address 192.168.2.254 255.255.255.0R2(config-if)#no shutdownR2(config)#interface s1/1R2(config-if)#clock 128000R2(config-if)#ip address 192.168.12.2 255.255.255.0R2(config-if)#no shutdownR2(config)#interface s1/3R2(config-if)#clock 128000R2(config-if)#ip address 192.168.23.2 255.255.255.0R2(config-if)#no shutdownR2(config)#router ripR2(config-router)#network 192.168.2.0R2(config-router)#network 192.168.12.0R2(config-router)#network 192.168.23.0R2(config-router)#passive-interface f0/0R3(config)#interface f0/0R3(config-if)#ip address 192.168.13.3 255.255.255.0R3(config-if)#no shutdownR3(config)#interface s1/3R3(config-if)#ip address 192.168.23.3 255.255.255.0R3(config-if)#no shutdownR3(config)#router ripR3(config-router)#network 192.168.13.0R3(config-router)#network 192.168.23.0R3(config-router)#passive-interface f0/0PC2(config)#no ip routingPC2(config)#interface f0/0PC2(config-if)#ip address 192.168.2.2 255.255.255.0PC2(config-if)#no shutdownPC2(config)#ip default-gateway 192.168.2.254
- 配置(zhì)HSRP
R1(config)#interface f0/0R1(config-if)#standby 11 ip 192.168.13.254//啟用HSRP功能,並配置虛擬IP網關地址,11為(wéi)standby的組號。相同組號的路由器屬於同一個HSRP組,需要注意的(de)是同一個組內的路由器設置虛擬網關地址必須(xū)一致(zhì)。R1(config-if)#standby 11 priority 120//配置HSRP的優先級,默認(rèn)是100,值越大優先級越高。R1(config-if)#standby 11 preempt//設置(zhì)路由器在優先級最高時(shí)成為活動路由器,如(rú)果不(bú)設(shè)置,即使路由器優先級再(zài)高也不會成為(wéi)活動路由器。R1(config-if)#standby 11 timers 3 10//其中的3為Hello Time,表示每隔多長時間發送(sòng)Hello消息。10為Hold Time,表(biǎo)示在多(duō)長時間內同組的(de)路由器沒有收到活動路由器發送的消息(xī),即(jí)認為活動(dòng)路由(yóu)器出現故障了,同組的(de)路(lù)由器該項設置必須一致。R1(config-if)#standby 11 authentication md5 key-string cisco//以上是配置認證(zhèng)密碼,防止非(fēi)法設備加入到HSRP組(zǔ),同組內(nèi)的設備密碼需保(bǎo)持一致。R3(config)#interface f0/0R3(config-if)#standby 11 ip 192.168.13.254R3(config-if)#standby 11 preemptR3(config-if)#standby 11 timers 3 10R3(config-if)#standby 11 authentication md5 key-string cisco
- 查看HSRP狀(zhuàng)態
R1#show standby briefP indicates configured to preempt.|Interface Grp Prio P State Active Standby Virtual IPFa0/0 11 120 P Active local 192.168.13.3 192.168.13.254//以上表明R1是活動(dòng)路由,R3是(shì)備份路由。R3#show standby briefP indicates configured to preempt.|Interface Grp Prio P State Active Standby Virtual IPFa0/0 11 100 P Standby 192.168.13.1 local 192.168.13.254//以上表明R3是備份路由,R1是活(huó)動路由。
- 修(xiū)改(gǎi)PC1的(de)配置(zhì)
PC1(config)#interface f0/0PC1(config-if)#ip address 192.168.13.100 255.255.255.0PC1(config-if)#no shutdownPC1(config)#ip default-gateway 192.168.13.254
- 測試,在PC1上連續ping PC2,ping的過程中關掉R1上f0/0端口,觀察ping的結果以及(jí)HSRP的狀態。
PC1#pingProtocol [ip]:Target IP address: 192.168.2.2Repeat count [5]: 3000 ----------------設置ping的次數Datagram size [100]: 1500 ------------------設置ping包的(de)報文長度Timeout in seconds [2]:Extended commands [n]: ySource address or interface: 192.168.13.100Type of service [0]:Set DF bit in IP header
關鍵詞:Cisco,HSRP
閱讀本文後您有什麽感(gǎn)想? 已(yǐ)有 人給出評價!
- 0
- 0
- 0
- 0
- 0
- 0