1.什么是hsrp?

hsrp全称:hot standby router protocol

中文:热备份路由协议

2.hsrp有什么作用?

从这个协议的名字可以看出来,主要是用作路由器冗余的。热备份说的是当网络中一条线路无法工作时,其他备份线路可以自动接替其工作。

3.原理

……

4.实验模拟

实验环境:

思科3640系列路由器(ios为C3660-IK9O3S-M,,Version 12.4)

实验要求:

当内部网络对外访问的主线路无法工作时,备份线路自动接替主线路的工作,保证网络的正常访问。

实验拓扑:

说明:

R1为外网路由器,R2和R3为内网路由器,别且配置为内网网关,R4和R5为内网用户。

实验配置:

R1 

 
  
  1. interface Loopback0  
  2.  ip address 1.1.1.1 255.255.255.0  
  3. !           
  4. interface FastEthernet0/0  
  5.  ip address 192.168.12.1 255.255.255.0  
  6.  duplex auto  
  7.  speed auto  
  8. !  
  9. interface FastEthernet0/1  
  10.  ip address 192.168.13.1 255.255.255.0  
  11.  duplex auto  
  12.  speed auto  
  13. !  
  14. router ospf 1  
  15.  log-adjacency-changes  
  16.  network 0.0.0.0 255.255.255.255 area 0 

 R2 

 
  
  1. interface FastEthernet0/0  
  2.  ip address 192.168.12.2 255.255.255.0  
  3.  duplex auto  
  4.  speed auto  
  5. !  
  6. interface FastEthernet0/1  
  7.  ip address 192.168.1.2 255.255.255.0  
  8.  duplex auto  
  9.  speed auto  
  10.  standby ip 192.168.1.100  
  11.  standby priority 90  
  12.  standby preempt  
  13. !  
  14. router ospf 1  
  15.  log-adjacency-changes  
  16.  network 0.0.0.0 255.255.255.255 area 0 

 R3 

 
  
  1. interface FastEthernet0/0  
  2.  ip address 192.168.13.3 255.255.255.0  
  3.  duplex auto  
  4.  speed auto  
  5. !  
  6. interface FastEthernet0/1  
  7.  ip address 192.168.1.3 255.255.255.0  
  8.  duplex auto  
  9.  speed auto  
  10.  standby ip 192.168.1.100  
  11.  standby preempt  
  12. !  
  13. router ospf 1  
  14.  log-adjacency-changes  
  15.  network 0.0.0.0 255.255.255.255 area 0 

 R4 

 
  
  1. interface FastEthernet0/0  
  2.  ip address 192.168.1.1 255.255.255.0  
  3.  no ip route-cache  
  4.  duplex auto  
  5.  speed auto  
  6. !  
  7. interface FastEthernet0/1  
  8.  no ip address  
  9.  no ip route-cache  
  10.  shutdown  
  11.  duplex auto  
  12.  speed auto  
  13. !  
  14. ip default-gateway 192.168.1.100 

 实验验证:

在R4上ping 1.1.1.1,结果为联通,traceroute 1.1.1.1 ,结果如下: 

 
  
  1. Type escape sequence to abort.  
  2. Tracing the route to 1.1.1.1  
  3.  
  4.   1 192.168.1.3 276 msec 156 msec 80 msec  
  5.   2 192.168.13.1 124 msec *  208 msec