详解:Cisco HSRP的配置
HSRP的配置
拓扑图
实验步骤:
- 配置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接口设为被动接口,是为了防止从该口向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
- 配置HSRP
R1(config)#interface f0/0R1(config-if)#standby 11 ip 192.168.13.254//启用HSRP功能,并配置虚拟IP网关地址,11为standby的组号。相同组号的路由器属于同一个HSRP组,需要注意的是同一个组内的路由器设置虚拟网关地址必须一致。R1(config-if)#standby 11 priority 120//配置HSRP的优先级,默认是100,值越大优先级越高。R1(config-if)#standby 11 preempt//设置路由器在优先级最高时成为活动路由器,如果不设置,即使路由器优先级再高也不会成为活动路由器。R1(config-if)#standby 11 timers 3 10//其中的3为Hello Time,表示每隔多长时间发送Hello消息。10为Hold Time,表示在多长时间内同组的路由器没有收到活动路由器发送的消息,即认为活动路由器出现故障了,同组的路由器该项设置必须一致。R1(config-if)#standby 11 authentication md5 key-string cisco//以上是配置认证密码,防止非法设备加入到HSRP组,同组内的设备密码需保持一致。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状态
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是活动路由,R3是备份路由。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是活动路由。
- 修改PC1的配置
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的结果以及HSRP的状态。
PC1#pingProtocol [ip]:Target IP address: 192.168.2.2Repeat count [5]: 3000 ----------------设置ping的次数Datagram size [100]: 1500 ------------------设置ping包的报文长度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
阅读本文后您有什么感想? 已有 人给出评价!
- 0
- 0
- 0
- 0
- 0
- 0