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路由表如下:

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

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

pt1043

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值