主页 > 软件开发  > 

BGP分解实验·18——BGP选路原则之权重

BGP分解实验·18——BGP选路原则之权重

在本地对进入的NLRI做权重设置,从而对过滤特定的路由进行优选。严格来说,权重值并不能算是路径属性,因为它并处传递,所能影响的仅仅限于本地路由器。

实验拓扑如下:

完成实验拓扑的基础实验,R1的配置如下:

hostname R1 ! interface Loopback0 ip address 10.1.0.1 255.255.255.0 ! interface Loopback1 ip address 10.1.1.1 255.255.255.0 ! interface Ethernet0/0 ip address 100.80.13.1 255.255.255.248 no sh ! interface Ethernet0/1 ip address 100.64.12.1 255.255.255.252 no sh ! router bgp 1 bgp router-id 1.1.1.1 network 10.1.0.0 mask 255.255.255.0 network 10.1.1.0 mask 255.255.255.0 aggregate-address 10.1.0.0 255.255.252.0 summary-only neighbor 100.64.12.2 remote-as 2 neighbor 100.80.13.3 remote-as 3 ! end

R2的配置如下:

hostname R2 ! interface Loopback2 ip address 10.1.2.2 255.255.255.0 ! interface Loopback3 ip address 10.1.3.2 255.255.255.0 ! interface Ethernet0/0 ip address 100.64.12.2 255.255.255.252 no sh ! interface Ethernet0/1 ip address 100.96.23.2 255.255.255.248 no sh ! router bgp 2 bgp router-id 2.2.2.2 network 10.1.2.0 mask 255.255.255.0 network 10.1.3.0 mask 255.255.255.0 aggregate-address 10.1.0.0 255.255.252.0 summary-only neighbor 100.64.12.1 remote-as 1 neighbor 100.96.23.3 remote-as 3 ! end

R3的配置如下:

hostname R3 ! interface Loopback0 ip address 192.168.2.2 255.255.255.255 ! interface Ethernet0/0 ip address 100.80.13.3 255.255.255.248 no sh ! interface Ethernet0/1 ip address 100.96.23.3 255.255.255.248 no sh ! router bgp 3 bgp router-id 3.3.3.3 bgp log-neighbor-changes network 192.168.2.2 mask 255.255.255.255 neighbor 100.80.13.1 remote-as 1 neighbor 100.96.23.2 remote-as 2 ! end

配置后查看R3的BGP表如下:

在条件相同的情况下,BGP会选择最靠近本地的Next Hop,通常即选择IP地址较大的路径。如果没有其他配置干预,BGP可能会选择IP地址较大的路径,或者选择不同的路由器配置中的Next Hop地址100.96.23.2。

R1和R2的BGP表如下:(仅作参考,本实验查看R1和R2的意义不大;关键看R3的变化与控制)

R3增加的配置如下:

ip prefix-list WE seq 5 permit 10.1.0.0/22 ! route-map WE permit 10 match ip address prefix-list WE set weight 10 ! route-map WE permit 20 ! router bgp 3 neighbor 100.80.13.1 route-map WE in ! end clear ip bgp * soft in

增加条件控制后,刷新BGP表后的BGP表如下:

查看R3的BGP路由属性如下:

再查看R3的BGP路由表如下:

权重属性的参数调整选路适用于单宿主网络在网关路由器上的配置。

另外:本地优先级也属于公认自选属性。

标签:

BGP分解实验·18——BGP选路原则之权重由讯客互联软件开发栏目发布,感谢您对讯客互联的认可,以及对我们原创作品以及文章的青睐,非常欢迎各位朋友分享到个人网站或者朋友圈,但转载请说明文章出处“BGP分解实验·18——BGP选路原则之权重