HSRPHot Standby Routing Protocol(热备份路由协议)的缩写。它的作用是能够把一台或多台路由器用来做备份,所谓热备份是指当使用的路由器不能正常工作时,候补的路由器能够实现平滑的替换,尽量不被察觉。 通常,我们的网络上主机设置一条缺省路由,指向主机所在网段内的一个路由器 R,这样,主机发出的目的地址不在本网段的报文将被通过缺省路由发往路由器 R,从而实现了主机与外部网络的通信。在这种情况下,当路由器 R 坏掉时,本网段内所有以路由器 R 为缺省路由下一跳的主机将断掉与外部的通信。HSRP 实现容错备份功能,可以有效解决上述可靠性问题。
热备份路由协议_路由

 
HSRP

 
S1 :

 
switch > enable
switch # configure terminal
switch(config) # hostname sw1
sw1(config) # exit
sw1#vlan database
sw1(vlan) # vlan 2
sw1(vlan) # vlan 3
sw1(vlan) # exit
sw1(config) # interface fastethernet 0/1
sw1(config-if) # switchport trunk encapsulation dot1q
sw1(config-if) # switchport mode trunk
sw1(config-if) # end
sw1#configure terminal
sw1(config) # interface vlan 2
sw1(config) # ip routing
sw1(config-if) # ip address 172.16.2.99 255.255.255.0
sw1(config-if) # no shutdown
sw1(config-if) # standby 2 ip 172.16.2.100
sw1(config-if) # standby 2 priority 105
sw1(config-if) # standby 2 preempet
sw1(config-if) # standby 2 track fastethernet 1/0
sw1(config) # interface vlan 3
sw1(config-if) # ip address 172.16.3.99 255.255.255.0
sw1(config-if) # no shutdown
sw1(config-if) # standby 3 ip 192.168.3.100
sw1(config-if) # standby 3 preempet
sw1(config) # interface fastethernet 0/2
sw1(config-if) # no switchport
sw1(config-if) # ip address 172.16.4.1 255.255.255.0
sw1(config-if) # no shutdown
sw1(config) # router eigrp 100
sw1(config-router) # network 172.16.0.0
sw1(config-router) #end
sw1#

 
S2 :
switch > enable
switch # configure terminal
switch(config) # hostname sw2
sw2(config) # exit
sw2#vlan database
sw2(vlan) # vlan 2
sw2(vlan) # vlan 3
sw2(vlan) # exit
sw2(config) # interface fastethernet 0/1
sw2(config-if) # switchport trunk encapsulation dot1q
sw2(config-if) # switchport mode trunk
sw2(config-if) # end
sw2#configure terminal
sw2(config) # interface vlan 2
sw2(config) # ip routing
sw2(config-if) # ip address 172.16.2.101 255.255.255.0
sw2(config-if) # no shutdown
sw2(config-if) # standby 2 ip 172.16.2.100
sw2(config-if) # standby 2 preempet
sw2(config) # interface vlan 3
sw2(config-if) # ip address 172.16.3.101 255.255.255.0
sw2(config-if) # no shutdown
sw2(config-if) # standby 3 ip 192.168.3.100
sw2(config-if) # standby 3 priority 105
sw2(config-if) # standby 3 track fastethernet 1/1
sw2(config-if) # standby 3 preempet
sw2(config) # interface fastethernet 0/2
sw2(config-if) # no switchport
sw2(config-if) # ip address 172.16.5.1 255.255.255.0
sw2(config-if) # no shutdown
sw2(config) # router eigrp 100
sw2(config-router) # network 172.16.0.0
sw2(config-router) #end
sw2#

 

S3 :
switch > enable
switch # configure terminal
switch(config) # hostname sw3
sw3(config) # exit
sw3#vlan database
sw3(vlan) # vlan 2
sw3(vlan) # vlan 3
sw3(vlan) # exit
sw3(config) # interface range fastethernet 0/1 - 2
sw3(config-if) # switchport trunk encapsulation dot1q
sw3(config-if) # switchport mode trunk
sw3(config-if) # end
sw3#configure terminal
sw3(config) # interface fastethernet 0/3
sw3(config) # switchport mode access
sw3(config-if) # switchport access vlan 2
sw3(config) # interface fastethernet 0/4
sw3(config) # switchport mode access
sw3(config-if) # switchport access vlan 3
sw3(config-if) #end
sw3#

 
R1 :
router > enable
router# configure terminal
router(config) # hostname r1
r1(config) # interface fastethernet 1/0
r1(config-subif) # ip add 172.16.4.2 255.255.255.0
r1(config-if) # no shutdown
r1(config) # interface fastethernet 0/0
r1(config-subif) # ip add 100.1.1.100 255.255.255.0
r1(config-if) # no shutdown
r1(config) # interface fastethernet 1/1
r1(config-subif) # ip add 172.16.5.2 255.255.255.0
r1(config-if) # no shutdown
r1(config) # router eigrp 100
r1(config-router) # network 172.16.0.0
r1(config-router) # network 100.1.1.0
r1(config-router) #end