温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

46、BGP配置实验之As path选路

发布时间:2020-07-07 12:27:49 来源:网络 阅读:1036 作者:开源殿堂 栏目:网络安全

1、as-path选路解析

属性
传播范围
默认值
优先值方向
备注
weight本路由器本路由器32768,其他路由器0大值优先INCISCO私有

Local preferenceAS内部100:边界路由器,通告给IBGP邻居,告知如何离开本AS大值优先OUT
As pathAS之间短优先IN、OUT

修改As path值的方法:

方法一:在OUT方向上修改As path值,例如

ip prefix-list 1 seq 5 permit 33.33.33.0/24

route-map AS permit 10

 match ip address prefix-list 1

 set as-path prepend 2 2 2 2 2

route-map AS permit 20

router bgp 3

 neighbor 23.1.1.2 route-map AS out

方法二:在IN方向上修改As path值,例如


2、实验拓扑

46、BGP配置实验之As path选路3、基础配置

R1配置

interface Loopback0

 ip address 1.1.1.1 255.255.255.0

interface Serial0/0

 ip address 13.1.1.1 255.255.255.0

interface Serial0/1

 ip address 14.1.1.1 255.255.255.0

router ospf 110

 router-id 1.1.1.1

 log-adjacency-changes

 network 1.1.1.0 0.0.0.255 area 0

 network 14.1.1.0 0.0.0.255 area 0

router bgp 4

 no synchronization

 bgp router-id 1.1.1.1

 neighbor 4.4.4.4 remote-as 4

 neighbor 4.4.4.4 update-source Loopback0

 neighbor 4.4.4.4 next-hop-self

 neighbor 13.1.1.3 remote-as 3

 no auto-summary


R2配置

interface Loopback0

 ip address 2.2.2.2 255.255.255.0

interface Serial0/1

 ip address 23.1.1.2 255.255.255.0

interface FastEthernet1/0

 ip address 24.1.1.2 255.255.255.0

router ospf 110

 router-id 2.2.2.2

 network 2.2.2.0 0.0.0.255 area 0

 network 24.1.1.0 0.0.0.255 area 0

router bgp 4

 no synchronization

 bgp router-id 2.2.2.2

 neighbor 4.4.4.4 remote-as 4

 neighbor 4.4.4.4 update-source Loopback0

 neighbor 4.4.4.4 next-hop-self

 neighbor 23.1.1.3 remote-as 3

 no auto-summary


R3配置

interface Loopback0

 ip address 3.3.3.3 255.255.255.0

interface Loopback1

 ip address 33.33.33.33 255.255.255.0        

interface Serial0/0

 ip address 13.1.1.3 255.255.255.0

interface Serial0/1

 ip address 23.1.1.3 255.255.255.0router bgp 3

 no synchronization

 bgp router-id 3.3.3.3

 network 3.3.3.0 mask 255.255.255.0

 network 33.33.33.0 mask 255.255.255.0

 neighbor 13.1.1.1 remote-as 4

 neighbor 23.1.1.2 remote-as 4

 no auto-summary


R4配置

interface Loopback0

 ip address 4.4.4.4 255.255.255.0

interface Serial0/1

 ip address 14.1.1.4 255.255.255.0

interface FastEthernet1/0

 ip address 24.1.1.4 255.255.255.0

router ospf 110

 router-id 4.4.4.4

 network 4.4.4.0 0.0.0.255 area 0

 network 14.1.1.0 0.0.0.255 area 0

 network 24.1.1.0 0.0.0.255 area 0

router bgp 4

 no synchronization

 bgp router-id 4.4.4.4

 neighbor 1.1.1.1 remote-as 4

 neighbor 1.1.1.1 update-source Loopback0

 neighbor 2.2.2.2 remote-as 4

 neighbor 2.2.2.2 update-source Loopback0

 no auto-summary


4、默认选路

46、BGP配置实验之As path选路根据BGP选路原则第八条可以知道,R4到达3.3.3.0/24、33.33.33.0/24都是经过R2。

46、BGP配置实验之As path选路

46、BGP配置实验之As path选路


5、在OUT方向上修改As path值

R4到达3.3.3.0/24、33.33.33.0/24都是经过R2,我们通过修改As path值将R4到达3.3.3.0/24经过R2、达到33.33.33.0/24都是经过R1。

R3配置

ip prefix-list 1 seq 5 permit 33.33.33.0/24

route-map AS permit 10

 match ip address prefix-list 1

 set as-path prepend 2 2 2 2 2

route-map AS permit 20

router bgp 3

 neighbor 23.1.1.2 route-map AS out


46、BGP配置实验之As path选路


6、在IN方向上修改As path值

R4到达3.3.3.0/24、33.33.33.0/24都是经过R2,我们通过修改As path值将R4到达3.3.3.0/24经过R2、达到33.33.33.0/24都是经过R1。

R2配置

ip prefix-list 1 seq 5 permit 33.33.33.0/24

route-map AS permit 10

 match ip address prefix-list 1

 set as-path prepend 2 2 2 2 2

route-map AS permit 20

router bgp 4

 neighbor 23.1.1.3 route-map AS in

46、BGP配置实验之As path选路

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI