1. 程式人生 > >BGP選路十三條原則

BGP選路十三條原則

BGP叫邊界閘道器協議(Border Gateway Protocol),是一種無類別路徑向量協議。主要用於AS之間交換路由協議,如何最佳路徑選擇,對應以下13條選路原則

BGP在進行路徑選擇有一個前提: <1>路由均優(即打了>); <2>下一跳可達; <3>關閉自動彙總(no synchronized);

1、Prefer highest weight 權重值 2、Prefer highest local preference 本地優先順序 3、Prefer route originated by the local router 本地下一跳 4、Prefer shortest AS path. ASpath 5、Prefer lowest origin code 起源屬性 6、Prefer lowest MED MED:多出口鑑別器 7、Prefer EBGP path over IBGP path. EBGP優於IGP 8、Prefer the path through the closest IGP neighbor. 優先最近的IGP鄰居 9、Balance traffic. 實現負載均衡 10、Prefer oldest route for EBGP paths. 優選最先建立的BGP鄰居 11、Prefer the path with the lowest neihbor BGP router ID. 優選最小BGP鄰居的router ID 12、Prefer shortest cluster list. 優選最小的RR列表 13、Prefer the path with the lowest neighbor IP address. 優選最小鄰居IP地址

具體從傳播範圍,預設值和比較方式進行討論,具體如下:

1、Prefer highest weight (CISCO私有) 傳播範圍:改屬性只能在路由器本地有意義,路由器傳送任何BGP路由的時候不會攜帶該屬性

預設值:對於下一跳地址為0.0.0.0的BGP路由,在本地的BGP表中預設值為32768,如該路由是從鄰居學習到,無論來源是IGP還是BGP權重預設值為0,如果該路由是本地通告,但是來源於IGP,則該路由預設權重值也為0

比較方式:weight屬性值越大,該路由器條目越優

2、Prefer highest local preference 優選於本地優先順序最高的路由 (公有)。

傳播範圍:只能在AS內部傳播,在傳播IBGP路由 的時候進行修改。

預設值:無論IBGP 還是EBGP 都為100.

比較原則:越大越好

3、Prefer route originated by the local router

優選於下一跳地址為0.0.0.0的本地產生的路由,鄰居通告的將成為次優路由。

4、Prefer shortest AS path.

優選於AS路徑最短的路由。BGP為了防止環路,在每經過一個AS時將為路由打上所經過的AS號(表現為在路由表中從左往右),當路由器收到一條EBGP路由,只要改EBGP路由內包含有接收者路由器所在AS號,該路由將被直接丟棄。

傳播範圍:整個Internet (AS路徑越長代表經過的AS越多,路徑也就越差)

5、Prefer lowest origin code (公有)

優選於最低origin屬性(IGP優先於EGP優先於Incomplete)

傳播範圍:整個Internet

6、Prefer lowest MED (exchanged between autonomous systems). MED:Multi-exit Discriminator 多出口鑑別器

優選於最小的MED

傳播範圍:在直連的鄰居的一跳AS內傳遞

預設值:IETF預設是最大值,cisco預設最小為0

比較方法:越小越好,同一臺路由器傳遞才可以比較

7、Prefer EBGP path over IBGP path.

相對IBGP優選於EBGP

8、Prefer the path through the closest IGP neighbor.

優選經過最近的IGP鄰居的路徑

10、Prefer oldest route for EBGP paths.

都是外部路徑,優選於最先收到的  ,( 減少鏈路抖動 )

11、Prefer the path with the lowest neihbor BGP router ID.

優選於擁有最小RID的鄰居路由

12、Prefer shortest cluster list.

優選具有最低RR列表長度的路徑

13、Prefer the path with the lowest neighbor IP address.

優選最小鄰居IP地址