实验拓扑:

 

cisco 路由器 hsrp_cisco 路由器 hsrp

PC机的虚拟网关组是172.16.1.254/24,默认走GWA出到internel,在GWA和GWB上做一个hsrp的备份组,当GWA的f0/0,或者上行链路f0/1出现故障时,可通过备份的网关GWB出到internel,对业务量的影响很小。

注:hsrp为cisco私有协议

PC机的ip地址配置如下:

cisco 路由器 hsrp_cisco 路由器 hsrp_02

路由器配置:

1、相关的接口地址配置略;to_Inter上有一个lo0地址1.1.1.1/24;

2、在GWA和GWB上起eigrp路由协议;

 

GWA(config)#router eigrp 90

GWA(config-router)#no auto

GWA(config-router)#network 172.16.1.0

GWA(config-router)#network 202.100.1.0

 

 

GWB(config)#router eigrp 90

GWB(config-router)#no auto

GWB(config-router)#network 172.16.1.0

GWB(config-router)#network 202.200.1.0

 

 

to_Inter(config)#router eigrp 90

to_Inter(config-router)#no auto

to_Inter(config-router)#network 202.100.1.0

to_Inter(config-router)#network 202.200.1.0

to_Inter(config-router)#network 1.1.1.1

 

hsrp配置:

GWA(config)#inter f0/0

GWA(config-if)#standby 1 ip 172.16.1.254      虚拟网关组ip

GWA(config-if)#standby 1 priority 120         优先级

GWA(config-if)#standby 1 preempt              配置开启抢占

GWA(config-if)#standby 1 authentication md5 key-string cisco    验证

GWA(config-if)#standby 1 track fastEthernet 0/1 50    跟踪上行链路的状况

GWB(config-router)#inter f0/0

GWB(config-if)#standby 1 ip 172.16.1.254

GWB(config-if)#standby 1 priority 100       100本来就是缺省的优先级

GWB(config-if)#standby 1 preempt 

GWB(config-if)#standby 1 authentication md5 key-string cisco

GWB就没有必要跟踪上行链路的状况了

验证:

制造GWAf0/0端口故障

未出故障之前,

cisco 路由器 hsrp_cisco 路由器 hsrp_03

 

 

跟踪路由:

 

cisco 路由器 hsrp_cisco 路由器 hsrp_04

故障后:

cisco 路由器 hsrp_cisco 路由器 hsrp_05

 

cisco 路由器 hsrp_cisco 路由器 hsrp_06

恢复故障后:

 

cisco 路由器 hsrp_cisco 路由器 hsrp_07

f0/1出现故障的状况也是一样的,但停留的时间比较长,延时大一些。

值得注意的是,当f0/0口出现故障时,在GWA上查看show standby br会出现查看不出谁是active谁是standby,因为f0/0口故障了就使得GWA与GWB失去了依靠f0/0进行通信,也就是172.16.1.100ping不通172.16.1.200,但是上行链路f0/1故障的时候不会导致两者间不能通信,故可以查看到standby的状态。