BGP 13條選路原則

If the next hop is unreachable, do not consider it.
若是下一跳不可達,是不會參加選舉的!
1. weight
Prefer the path that has the largest weight.
思科的專有屬性。
2. Local Preference
If the routes have the same weight, use the route with the highest local preference.
The local preference attribute only is local to the autonomous system and does not get passed to EBGP neighbors. The higher the local preference, the more preferred the route is.
默認狀況下,從EBGP學來的路由local preference是100,解決本AS域出口路由選擇。他不會把此參數傳遞給EBGP的鄰居。
3. Originated
If the routes have the same local preference, prefer the route that was originated by BGP on this router.
優選從本路由器使發的路由,包括本地network,重分發和或IGP已有的路由,有BGP配置的聚合地址也包括在內。
查看BGP路由表時能夠看到有時路由前面帶了一個「r」,說明在IGP中已經存在此路由了。
4. AS Path
If no route was originated, prefer the route with the shortest AS path.
5. Origin Code
If all paths are of the same AS length, prefer the route with lowest origin code (IGP < EGP < INCOMPLETE).
EGP是指那種老的協議,如今已經再也不用了。
6. MED
If the origin codes are the same, prefer the path with the lowest Multi Exit Discriminator (MED 範圍0到4,294,967,295).
The MED is exchanged between ASs; however, the MED that comes into an AS does not leave.
The MED can be used to influence the outbound decision of another AS. The lower the MED, the more preferred the route.
並且MED只在相同AS的狀況下才對比,默認狀況下不一樣AS的路由是不對比MED的。解決本AS域的入口路由選擇。
另外MED的通告規則:
1. ebgp在發佈從ibgp學來的路由時,會清除MED的值。若是想強制通告,能夠在宣告的路由上使用「set metric-type internal」
2. 若是使用network或redistribute命令未來自IGP的路由通告到BGP中,那麼BGP的MED是從IGP的metric導出的。
3. 若是是aggregate-address命令注入路由,BGP的MED不被設置。
7. External paths over internal paths
If the MEDs are the same, prefer external paths over internal paths.
EBGP > confederation > IBGP
8. The path through the closest IGP neighbor
If they are still the same, prefer the path through the closest IGP neighbor.
優選對BGP下一跳具備最低IGP度量值的路徑。
9. Multiple paths
Determine if multiple paths require installation in the routing table for BGP Multipath.
若是配置了「maximum-path N」。並且從同一個AS的對等體收到多條外部路由,側能夠將N條路由加入到路由表中,使EBGP負載分擔。
N最大不能超過6;沒有配置此命令是,默認是1。能夠經過「sh ip bgp X.X.X.X」來查看最優的路徑,這個最優是按接收時間來定的。
在這條最優路由轉發到內部對等體以前,須要執行與「next-hop-self」同樣的功能。
10. Prefer the path that was received first
When both paths are external, prefer the path that was received first (the oldest one)。
這能夠使路由抖動從新收斂的影響降到最低,由於新的路徑不會取代老的路徑。
11. BGP Router ID
If they are still the same, prefer the path with the lowest BGP Router ID.
12. Cluster-ID
若是從路由反射器學到,優選最小Cluster-ID的路由。
13. Peer Adress
優選具備最低對等體地址的路由。
暫時更新到這,裏面有解釋的基本上是我常遇到的!
相關文章
相關標籤/搜索