BGP-17 配置BGP负载均衡

    首先,在JUNOS里面,默认负载均衡方式是基于流的负载均衡,同一源IP地址,同一目标IP地址的一组数据被称为一个流,当网络中有两条等价的路径时,基于流的负载均衡规定,同一条流的流量只会在一条链路上被传输。因此,我们需要将默认基于流的负载均衡,强制指定为基于包的负载均衡。

   先看一下配置命令:

  负载均衡命令.png


拓扑:

拓扑.png

   1.配置BGP。

r1 一条路径.png

r2 bgp.png

r3 bgp.png

2.检查路径。

2.1查看路由:

r1 路由1.png

可以看到R1优选了下一跳10.0.1.1。

2.2查看转发表:

r1 转发表1.png

3.配置基于包的负载均衡。

r1 负载均衡.png


4.查看路径。

4.1路由:

R1 负载均衡 路由.png

r1 detail.png

4.2查看转发表:

r1 zhuanfabiao.png

可以明确地看到在转发表里面的defalut.inet 目的地址10.0.2.0/30 的下一跳分别为10.0.1.1和10.0.0.2。


 我对于BGP的理解有限,我的问题是为什么路由表里面 不是两条路径前面都带*,而是一条里面两个下一跳,路由的明细里面,10.0.0.2依旧是INACTIVE,而在10.0.1.1里面两个下一跳,并且10.0.1.1显示selected。

    “数据包实际的转发是按照RE下发的转发表进行的”,转发表里面确实出现了两个下一跳。

     文档里的显示的原文如下:

    The show route detail command output designates one gateway as selected. This output is potentially confusing in the context of load balancing. The selected gateway is used for many purposes in addition to deciding which gateway to install into the kernel when Junos OS is not performing per-packet load-balancing. For instance, the ping mpls command uses the selected gateway when sending packets. Multicast protocols use the selected gateway in some cases to determine the upstream interface. Therefore, even when Junos OS is performing per-packet load-balancing by way of a forwarding-table policy, the selected gateway information is still required for other purposes. It is useful to display the selected gateway for troubleshooting purposes. Additionally, it is possible to use forwarding-table policy to override what is installed into the kernel (for example, by using the install-nexthop action). In this case, the next-hop gateway installed in the forwarding table might be a subset of the total gateways displayed in the show route command.


     大概的意思就是:实际上负载均衡了,但是在路由表里面显示的话还是选择了一个gateway,用于其他用途。比如PING,比如kernel(kernel junos系统的内核),比如多播协议。


    还有一个很有趣的问题,一开始我用VMX做,检查到转发表的时候:

    r1 转发表1.png

    发现没有负载均衡,我检查了下配置和路由表都没有问题。所以上述的路由器均采用SRX340。

猜你喜欢

转载自blog.51cto.com/13582804/2103904
BGP