路由路径的流量负载均衡配置
创始人
2024-06-29 02:40:14
0次

想必大家对路由器负载均衡功能都不会陌生,那么我们可以通过对路由器的转发表进行设置,从而达到流量负载均衡的目的。那么让我们一起来看看具体的路径配置内容吧。

缺省状态下,转发表中只安装路由表里的最佳路径

lab@juniper#run show route 6.6.6.6

  1. inet.0:19 destinations,22 routes(19 active,0 holddown,0 hidden)  
  2. +=Active Route,-=Last Active,*=Both   
  3.  
  4. 6.6.6.6/32*[IS-IS/18]00:03:33,metric 42   
  5. to 10.0.0.2 via fxp1.1   
  6. >to 10.0.1.2 via fxp1.2   
  7.  
  8. [edit]  
  9. lab@juniper#run show route forwarding-table   
  10. 5.5.5.5/32 user 0 10.0.1.2 ucst 490 7 fxp1.2   
  11. 6.6.6.6/32 user 0 10.0.1.2 ucst 490 7 fxp1.2   
  12. 10.0.0.0/30 intf 0 rslv 459 1 fxp1.1  

现在进行配置将路由表里的所有路径都安装进转发表

  1. lab@juniper#show routing-options   
  2. forwarding-table {   
  3. export load-balance-route;   
  4. }   
  5.  
  6. lab@juniper#show policy-options   
  7.  
  8. policy-statement load-balance-route {   
  9. then {   
  10. load-balance per-packet;   
  11. }   
  12. }  

查看路由表,路由器选择10.0.1.2作为最佳路由

  1. lab@juniper#run show route 6.6.6.6   
  2.  
  3. inet.0:19 destinations,22 routes(19 active,0 holddown,0 hidden)  
  4. +=Active Route,-=Last Active,*=Both   
  5.  
  6. 6.6.6.6/32*[IS-IS/18]00:03:33,metric 42   
  7. to 10.0.0.2 via fxp1.1   
  8. >to 10.0.1.2 via fxp1.2  

#p#转发表里对其所有前缀安装了多条路径

(注:安装的条目和PFE有关,IP-ASIC最多安装8条等价路径,以每个包为单位进行流量负载均衡,IP-II-ASIC最多安装16条,以每个流为单位进行流量负载均衡)

  1. lab@juniper#run show route forwarding-table   
  2. 1.1.1.1/32 intf 0 1.1.1.1 locl 468 1   
  3. 2.2.2.2/32 user 0 ulst 489 11   
  4. 10.0.0.2 ucst 497 2 fxp1.1   
  5. 10.0.1.2 ucst 490 2 fxp1.2   
  6. 3.3.3.3/32 user 0 ulst 489 11   
  7. 10.0.0.2 ucst 497 2 fxp1.1   
  8. 10.0.1.2 ucst 490 2 fxp1.2   
  9. 4.4.4.4/32 user 0 ulst 489 11   
  10. 10.0.0.2 ucst 497 2 fxp1.1   
  11. 10.0.1.2 ucst 490 2 fxp1.2   
  12. 5.5.5.5/32 user 0 ulst 489 11   
  13. 10.0.0.2 ucst 497 2 fxp1.1   
  14. 10.0.1.2 ucst 490 2 fxp1.2   
  15. 6.6.6.6/32 user 0 ulst 489 11   
  16. 10.0.0.2 ucst 497 2 fxp1.1   
  17. 10.0.1.2 ucst 490 2 fxp1.2   
  18. 10.0.0.0/30 intf 0 rslv 459 1 fxp1.1  

配置路由器,只对特定前缀的多条路径安装进转发表,6.0.0.0/8,4.0.0.0/8,2.0.0.0/8

  1. [edit]  
  2. lab@juniper#show policy-options policy-statement load-balance-route   
  3. from {   
  4. route-filter 6.0.0.0/8 orlonger;   
  5. route-filter 2.0.0.0/8 orlonger;   
  6. route-filter 4.0.0.0/8 orlonger;   
  7. }   
  8. then {   
  9. load-balance per-packet;   
  10. }   
  11. lab@juniper#show routing-options   
  12. forwarding-table {   
  13. export load-balance-route;   
  14. }  

观察转发表,只对其特定前缀安装了多条路径,6.0.0.0/8,4.0.0.0/8,2.0.0.0/8

  1. lab@juniper#run show route forwarding-table   
  2. 1.1.1.1/32 intf 0 1.1.1.1 locl 468 1   
  3. 2.2.2.2/32 user 0 ulst 489 3   
  4. 10.0.0.2 ucst 497 6 fxp1.1   
  5. 10.0.1.2 ucst 490 6 fxp1.2   
  6. 3.3.3.3/32 user 0 10.0.1.2 ucst 490 6 fxp1.2   
  7. 4.4.4.4/32 user 0 ulst 489 3   
  8. 10.0.0.2 ucst 497 6 fxp1.1   
  9. 10.0.1.2 ucst 490 6 fxp1.2   
  10. 5.5.5.5/32 user 0 10.0.1.2 ucst 490 6 fxp1.2   
  11. 6.6.6.6/32 user 0 ulst 489 3   
  12. 10.0.0.2 ucst 497 6 fxp1.1   
  13. 10.0.1.2 ucst 490 6 fxp1.2   
  14. 10.0.0.0/30 intf 0 rslv 459 1 fxp1.1   
  15. 10.0.0.0/32 dest 0 10.0.0.0 recv 457 1 fxp1.1  

#p#对5.5.5.5进行traceroute,每次都使用相同的下一跳

  1. lab@juniper>traceroute 5.5.5.5   
  2. traceroute to 5.5.5.5(5.5.5.5),30 hops max,40 byte packets   
  3. 1 10.0.1.2(10.0.1.2)0.457 ms 0.774 ms 0.224 ms   
  4. 2 10.0.2.2(10.0.2.2)0.317 ms 0.360 ms 0.287 ms   
  5. 3 10.0.3.2(10.0.3.2)0.398 ms 0.439 ms 0.383 ms   
  6. 4 5.5.5.5(5.5.5.5)0.495 ms 0.533 ms 1.149 ms   
  7.  
  8. lab@juniper>traceroute 5.5.5.5   
  9. traceroute to 5.5.5.5(5.5.5.5),30 hops max,40 byte packets   
  10. 1 10.0.1.2(10.0.1.2)0.431 ms 0.380 ms 0.225 ms   
  11. 2 10.0.2.2(10.0.2.2)0.320 ms 0.367 ms 0.310 ms   
  12. 3 10.0.3.2(10.0.3.2)0.402 ms 0.438 ms 0.392 ms   
  13. 4 5.5.5.5(5.5.5.5)0.495 ms 0.546 ms 0.491 ms   
  14.  
  15. lab@juniper>traceroute 5.5.5.5   
  16. traceroute to 5.5.5.5(5.5.5.5),30 hops max,40 byte packets   
  17. 1 10.0.1.2(10.0.1.2)0.427 ms 0.381 ms 0.220 ms   
  18. 2 10.0.2.2(10.0.2.2)0.315 ms 0.362 ms 0.305 ms   
  19. 3 10.0.3.2(10.0.3.2)0.401 ms 0.431 ms 0.383 ms   
  20. 4 5.5.5.5(5.5.5.5)0.492 ms 0.529 ms 0.479 ms   
  21.  
  22. lab@juniper> 

对6.6.6.6进行traceroute,每次都使用不同的下一跳

  1. lab@juniper>traceroute 6.6.6.6   
  2. traceroute to 6.6.6.6(6.6.6.6),30 hops max,40 byte packets   
  3. 1 10.0.1.2(10.0.1.2)0.427 ms 0.375 ms 10.0.0.2(10.0.0.2)0.224 ms   
  4. 2 10.0.2.2(10.0.2.2)0.364 ms 0.349 ms 0.292 ms   
  5. 3 10.0.3.2(10.0.3.2)0.385 ms 0.433 ms 0.386 ms   
  6. 4 10.0.5.2(10.0.5.2)0.467 ms 0.518 ms 0.462 ms   
  7. 5 6.6.6.6(6.6.6.6)0.572 ms 0.622 ms 0.567 ms   
  8.  
  9. lab@juniper>traceroute 6.6.6.6   
  10. traceroute to 6.6.6.6(6.6.6.6),30 hops max,40 byte packets   
  11. 1 10.0.0.2(10.0.0.2)0.436 ms 10.0.1.2(10.0.1.2)0.382 ms 0.355 ms   
  12. 2 10.0.2.2(10.0.2.2)0.316 ms 0.372 ms 0.315 ms   
  13. 3 10.0.3.2(10.0.3.2)0.394 ms 0.443 ms 0.391 ms   
  14. 4 10.0.5.2(10.0.5.2)0.473 ms 0.519 ms 0.465 ms   
  15. 5 6.6.6.6(6.6.6.6)0.572 ms 0.610 ms 0.586 ms   
  16.  
  17. lab@juniper#run traceroute 6.6.6.6   
  18. traceroute to 6.6.6.6(6.6.6.6),30 hops max,40 byte packets   
  19. 1 10.0.1.2(10.0.1.2)7.488 ms 0.511 ms 10.0.0.2(10.0.0.2)0.243 ms   
  20. 2 10.0.2.2(10.0.2.2)0.367 ms 0.351 ms 0.299 ms   
  21. 3 10.0.3.2(10.0.3.2)0.404 ms 0.435 ms 0.384 ms   
  22. 4 10.0.5.2(10.0.5.2)0.478 ms 0.542 ms 0.470 ms   
  23. 5 6.6.6.6(6.6.6.6)0.589 ms 0.615 ms 0.572 ms   
  24.  
  25. [edit logical-routers]  
  26. lab@juniper#run traceroute 6.6.6.6   
  27. traceroute to 6.6.6.6(6.6.6.6),30 hops max,40 byte packets   
  28. 1 10.0.0.2(10.0.0.2)0.429 ms 10.0.1.2(10.0.1.2)0.388 ms 0.363 ms   
  29. 2 10.0.2.2(10.0.2.2)0.322 ms 0.361 ms 0.304 ms   
  30. 3 10.0.3.2(10.0.3.2)0.393 ms 0.452 ms 0.387 ms   
  31. 4 10.0.5.2(10.0.5.2)0.471 ms 0.522 ms 0.471 ms   
  32. 5 6.6.6.6(6.6.6.6)0.594 ms 0.632 ms 0.571 ms  

基本上转发表流量负载均衡的所有路径配置就完成了。

相关内容

热门资讯

PHP新手之PHP入门 PHP是一种易于学习和使用的服务器端脚本语言。只需要很少的编程知识你就能使用PHP建立一个真正交互的...
网络中立的未来 网络中立性是什... 《牛津词典》中对“网络中立”的解释是“电信运营商应秉持的一种原则,即不考虑来源地提供所有内容和应用的...
各种千兆交换机的数据接口类型详... 千兆交换机有很多值得学习的地方,这里我们主要介绍各种千兆交换机的数据接口类型,作为局域网的主要连接设...
粉嫩如何诠释霸道 东芝M805... “霸道粉”是个什么玩意东芝M805拿过来的时候,笔者扑哧笑了,不是笑这款笔记本,而是笑这款产品的颜色...
如何利用交换机和端口设置来管理... 在网络管理中,总是有些人让管理员头疼。下面我们就将介绍一下一个网管员利用交换机以及端口设置等来进行D...
什么是大数据安全 什么是大数据... 在《为什么需要大数据安全分析》一文中,我们已经阐述了一个重要观点,即:安全要素信息呈现出大数据的特征...
全面诠释网络负载均衡 负载均衡的出现大大缓解了服务器的压力,更是有效的利用了资源,提高了效率。那么我们现在来说一下网络负载...
如何允许远程连接到MySQL数... [[277004]]【51CTO.com快译】默认情况下,MySQL服务器仅侦听来自localhos...
30分钟搞定iOS自定义相机 最近公司的项目中用到了相机,由于不用系统的相机,UI给的相机切图,必须自定义才可以。就花时间简单研究...
Windows恶意软件20年“... 在Windows的早期年代,病毒游走于系统之间,偶尔删除文件(但被删除的文件几乎都是可恢复的),并弹...