A-A+

路由器配置VRRP多备份组,实现VRRP的负载均衡模式

2015年11月24日 站长资讯 暂无评论

VRRP技术是网络中解决网络中主机配置单网关容易出现单点故障问题的一项技术,通过将多台路由器配置到一个VRRP组中,每一个VRRP组虚拟出一台虚拟路由器,作为网络中主机的网关。一个VRRP组中,所有的真实的路由器选举出一个优先级别最高路由器作为主路由器。虚拟路由器的转发工作由主路由器承担。

在构建远程网络连接时,如果配置VRRP单组备份,那么会导致备份线路闲置无法使用,造成浪费,一次可以考虑采用VRRP多组备份的方案,两条链路互成备份,并且同时转发数据。

实验拓扑图:

1.在路由器上配置ip地址

  1. #在RA  
  2. <Huawei>sys  
  3. Enter system view, return user view with Ctrl+Z.  
  4. [Huawei]int s0/0/2  
  5. [Huawei-Serial0/0/2]ip add 200.1.1.2 30  
  6. [Huawei-Serial0/0/2]int e 0/0/0  
  7. [Huawei-Ethernet0/0/0]ip add 12.1.1.1 24  
  8.    
  9. #在RB  
  10. <Huawei>sys  
  11. Enter system view, return user view with Ctrl+Z.  
  12. [Huawei]int s 0/0/1  
  13. [Huawei-Serial0/0/1]ip add 65.1.1.2 30  
  14. [Huawei-Serial0/0/1]int e 0/0/2  
  15. [Huawei-Ethernet0/0/0]ip add 12.1.1.2 24  
  16.    
  17. #在RC  
  18. <Huawei>sys  
  19. Enter system view, return user view with Ctrl+Z.  
  20. [Huawei]int s 0/0/2  
  21. [Huawei-Serial0/0/2]ip add 200.1.1.1 30  
  22. [Huawei-Serial0/0/2]int s 0/0/1  
  23. [Huawei-Serial0/0/1]ip add 65.1.1.1 30  
  24. [Huawei-Serial0/0/1]int e 0/0/0  
  25. [Huawei-Ethernet0/0/0]ip add 172.16.1.1 24  

2.配置OSPF

  1. #在RA  
  2. [Huawei]ospf  
  3. [Huawei-ospf-1]area 1   
  4. [Huawei-ospf-1-area-0.0.0.1]network 12.1.1.0   0.0.0.255  
  5. [Huawei-ospf-1-area-0.0.0.1]network 200.1.1.0  0.0.0.3  
  6.   
  7. #在RB  
  8. [Huawei]ospf  
  9. [Huawei-ospf-1]  
  10. [Huawei-ospf-1]area 1  
  11. [Huawei-ospf-1-area-0.0.0.1]network 65.1.1.0   0.0.0.255  
  12. [Huawei-ospf-1-area-0.0.0.1]network 12.1.1.0   0.0.0.3  
  13.   
  14. #在RC  
  15. [Huawei]ospf  
  16. [Huawei-ospf-1]area 1  
  17. [Huawei-ospf-1-area-0.0.0.1]network 65.1.1.0    0.0.0.3  
  18. [Huawei-ospf-1-area-0.0.0.1]network 200.1.1.0   0.0.0.3  
  19. [Huawei-ospf-1-area-0.0.0.1]network 172.16.1.0  0.0.0.255  

3.配置VRRP

  1. #在RA  
  2. [Huawei]int e 0/0/0  
  3. [Huawei-Ethernet0/0/0]vrrp vrid 32 virtual-ip 12.1.1.254  
  4.   
  5. #将路由器RA在VRRP组32中优先级配置为120,成为Master路由器   
  6. [Huawei-Ethernet0/0/0]vrrp vrid 32 priority 120  
  7.   
  8. #配置路由器RA在VRRP组32中监控Serial 0/0/2端口,当端口状态转为DOWN时,RA在组32中的优先级降低30  
  9. [Huawei-Ethernet0/0/0]vrrp vrid 32 track interface Serial 0/0/2 reduced 30  
  10.   
  11. #将路由器RA配置为VRRP组33中的路由器  
  12. [Huawei-Ethernet0/0/0]vrrp vrid 33 virtual-ip 12.1.1.253  
  13.   
  14. #在RB  
  15. [Huawei]int e 0/0/0  
  16.   
  17. #将路由器RB配置为VRRP组32中的路由器  
  18. [Huawei-Ethernet0/0/0]vrrp vrid 32 virtual-ip 12.1.1.254  
  19.   
  20. #将路由器RB在VRRP组32中优先级配置为120,成为Master路由器   
  21. [Huawei-Ethernet0/0/0]vrrp vrid 33 priority 120  
  22.   
  23. [Huawei-Ethernet0/0/0]vrrp vrid 33 virtual-ip 12.1.1.253  
  24. [Huawei-Ethernet0/0/0]vrrp vrid 33 track interface Serial 0/0/2 reduced 30  

4.验证测试

  1. #在RA  
  2. [Huawei]dis vrrp brief   
  3. VRID  State        Interface                Type     Virtual IP       
  4. ----------------------------------------------------------------  
  5. 32    Master       Eth0/0/0                 Normal   12.1.1.254       
  6. 33    Backup       Eth0/0/0                 Normal   12.1.1.253  
  7. ----------------------------------------------------------------  
  8. Total:2     Master:1     Backup:1     Non-active:0     
  9.   
  10.    
  11. #在RB  
  12.   
  13. [Huawei]dis vrrp brief  
  14. VRID  State        Interface                Type     Virtual IP       
  15. ----------------------------------------------------------------  
  16. 32    Backup       Eth0/0/0                 Normal   12.1.1.254       
  17. 33    Master       Eth0/0/0                 Normal   12.1.1.253    
  18. ----------------------------------------------------------------  
  19. Total:2     Master:2     Backup:0     Non-active:0      
  20.   
  21.    
  22. 在CLIENT1  
  23. PC>ping 172.16.1.100  
  24.   
  25. Ping 172.16.1.100: 32 data bytes, Press Ctrl_C to break  
  26. From 172.16.1.100: bytes=32 seq=1 ttl=126 time=94 ms  
  27. From 172.16.1.100: bytes=32 seq=2 ttl=126 time=47 ms  
  28. From 172.16.1.100: bytes=32 seq=3 ttl=126 time=63 ms  
  29. From 172.16.1.100: bytes=32 seq=4 ttl=126 time=47 ms  
  30. From 172.16.1.100: bytes=32 seq=5 ttl=126 time=63 ms  
  31.   
  32. PC>tracert 172.168.1.100  
  33.   
  34. traceroute to 172.168.1.100, 8 hops max  
  35. (ICMP), press Ctrl+C to stop  
  36. 1  12.1.1.1   46 ms  16 ms  31 ms  
  37.  2    *  *  *  
  38.  3    *  *  *  
  39.  4    *  *  *  
  40.  5    *  *  *  
  41.  http://www.xiaoxiongboke.com  
  42. ———————————  

当RA停止工作后,因为我们使用的是VRRP多组备份,从
CILENT1到CILENT3的线路将走RB路由器

在CLIENT1

  1. PC>ping 172.16.1.100  
  2.   
  3. Ping 172.16.1.100: 32 data bytes, Press Ctrl_C to break  
  4. From 172.16.1.100: bytes=32 seq=1 ttl=126 time=94 ms  
  5. From 172.16.1.100: bytes=32 seq=2 ttl=126 time=47 ms  
  6. From 172.16.1.100: bytes=32 seq=3 ttl=126 time=63 ms  
  7. From 172.16.1.100: bytes=32 seq=4 ttl=126 time=47 ms  
  8. From 172.16.1.100: bytes=32 seq=5 ttl=126 time=63 ms  
  9.   
  10. --- 172.16.1.100 ping statistics ---  
  11.   5 packet(s) transmitted  
  12.   5 packet(s) received  
  13.   0.00% packet loss  
  14.   round-trip min/avg/max = 47/62/94 ms  
  15.   
  16. PC>tracert 172.168.1.100  
  17.   
  18. traceroute to 172.168.1.100, 8 hops max  
  19. (ICMP), press Ctrl+C to stop  
  20.  1  12.1.1.2   47 ms  31 ms  16 ms  
  21.  2    *  *  *  
  22.  3    *  *  *  
  23.  4    *  *  *  
  24.  5    *  *  *  

这样,我们就可以到达负载分担的目地。

标签:

给我留言