BGP分解实验·20——BGP选路原则之路径属性

当BGP路由传递出本地AS时,会在as-path属性中添加本地ASN作为成员;这一属性是eBGP重要的防环参考依据。

实验拓扑如下:

完成实验拓扑的基础配置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.98.12.1 255.255.255.0
 no sh
!
router bgp 11
 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.98.12.2 remote-as 23
!
end

基础配置R2如下:

hostname R2
!
interface Ethernet0/0
 ip address 100.98.12.2 255.255.255.0
 no sh
!
interface Ethernet0/1
 ip address 10.23.1.2 255.255.255.0
 no sh
!
router bgp 23
 bgp router-id 2.2.2.2
 neighbor 10.23.1.3 remote-as 23
 neighbor 10.23.1.3 next-hop-self
 neighbor 100.98.12.1 remote-as 11
!
end

基础配置R3如下:

hostname R3
!
interface Ethernet0/0
 ip address 10.23.1.3 255.255.255.0
 no sh
!
interface Ethernet0/1
 ip address 100.99.34.3 255.255.255.0
 no sh
!
router bgp 23
 bgp router-id 3.3.3.3
 neighbor 10.23.1.2 remote-as 23
 neighbor 10.23.1.2 next-hop-self
 neighbor 100.99.34.4 remote-as 44
!
end

基础配置R4如下:

hostname R4
!
interface Loopback0
 ip address 4.4.4.4 255.255.255.255
!
interface Ethernet0/0
 ip address 100.99.34.4 255.255.255.0
 no sh
!
interface Ethernet0/1
 ip address 100.100.45.4 255.255.255.0
 no sh
!
router bgp 44
 bgp router-id 4.4.4.4
 network 4.4.4.4 mask 255.255.255.255
 neighbor 100.99.34.3 remote-as 23
 neighbor 100.100.45.5 remote-as 55
!
end

基础配置R5如下:

hostname R5
!
interface Loopback0
 ip address 10.1.2.1 255.255.255.0
!
interface Loopback1
 ip address 10.1.3.1 255.255.255.0
!
interface Ethernet0/0
 ip address 100.100.45.5 255.255.255.0
 no sh
!
router bgp 55
 bgp router-id 5.5.5.5
 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.100.45.4 remote-as 44
!
end

等待BGP完成收敛后,观察R3和R4去往目标网络10.1.0.0/22的路由,这时可以看到优选路径都是其最短AS-PATH。

在R5上增加配置如下:

route-map ADDASN permit 10
 set as-path prepend 56 57 58 59 60
!
router bgp 55
 neighbor 100.100.45.4 route-map ADDASN out
!
end

cle ip b * so o

当使用as-path属性做出选路决策时,BGP会选择历经AS比较少的路由,即as-path较短的路径。

PS://使用多出口鉴别器属性可以用于多宿主环境操控本地AS的入站流量。

如果一条BGP路由携带周知团队属性值0xFFFFFF01,那么该路由不能传递给eBGP对等体。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

pt1043

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

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

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

打赏作者

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

抵扣说明:

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

余额充值