BGP-As-Path:

AS_Path属性按矢量顺序记录了某条路由从本地到目的地址所要经过的所有AS编号。在接收路由时,设备如果发现AS_Path列表中有本AS号,则不接收该路由,从而避免了AS间的路由环路。

当BGP Speaker传播自身引入的路由时:

当BGP Speaker将这条路由通告到EBGP对等体时,便会在Update报文中创建一个携带本地AS号的AS_Path列表。

当BGP Speaker将这条路由通告给IBGP对等体时,便会在Update报文中创建一个空的AS_Path列表。

当BGP Speaker传播从其他BGP Speaker的Update报文中学习到的路由时:

当BGP Speaker将这条路由通告给EBGP对等体时,便会把本地AS编号添加在AS_Path列表的最前面(最左面)。收到此路由的BGP设备根据AS_Path属性就可以知道去目的地址所要经过的AS。离本地AS最近的相邻AS号排在前面,其他AS号按顺序依次排列。

当BGP Speaker将这条路由通告给IBGP对等体时,不会改变这条路由相关的AS_Path属性。

如下图:实现60的网络走R3;10的网络走10的网络!离开AS200进入AS 100时进行添加AS!

R2的配置

bgp 200 peer 1.1.1.1 as-number 100 peer 1.1.1.1 ebgp-max-hop 255 peer 1.1.1.1 connect-interface LoopBack0 peer 4.4.4.4 as-number 200 peer 4.4.4.4 connect-interface LoopBack0 peer 5.5.5.5 as-number 200

ipv4-family unicast undo synchronization peer 1.1.1.1 enable peer 1.1.1.1 route-policy 10 export peer 4.4.4.4 enable peer 4.4.4.4 next-hop-local
peer 5.5.5.5 enable peer 5.5.5.5 next-hop-local

route-policy 10 permit node 10 if-match acl 2000 apply as-path 200 200 additive route-policy 10 permit node 20

R1的路由表

R1的路由60详细的信息增加多两个AS!