有关BGP协议的13条选路规则,一些总结和看法 [收藏]

来源:互联网 发布:手机网络wifi测速在线 编辑:程序博客网 时间:2024/04/29 12:54

via 卢琪的博客 


对于一个NE来说,BGP协议是一门必修课,它是全球互联网的大框架。而当BGP路由器从多个途径获取路有时候,却有一套繁琐的选路过程。总共有13个步骤。而在文章的最后,我总结了一套比较快速的记忆方法。当然,我也在用,很容易就能记住这冗长的13条。

首先奉上原文(中英文对照),这些是网上摘录。

1.weight

 

prefer the path that has the largest weight

优先选择高权重值的路径

cisco私有属性

 

2.loacl preference 

if the routes have the same weight,use the route with the highest loacl preference. 

具有相同权重值的,将选取最高优先级得路径

the loacl preference attribute only is local to the autonomous system and does not get passed to EBGP neighbor

本地优先属性只在本自治系统有效,不会传递给EBGP邻居

 

3.originated

if the routes have same local preference,prefer the route that was originated by BGP on this router.

优选从本地路由器使发的路由,包括本地network,redistribute和IGP已有的路由,有BGP配置的聚合地址也包括在内。

 

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 dicriminator(多路径入口,主要影响入站流量)

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对比的。

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

优选具有最低对等体地址的路由。

 

 

 

以上便是13条步骤,如果要记忆的话,其实只需要记住它的关键字母而已。

总结如下: WLOAO  EMI  MP FP RID  CID PA

W weight。

L  local-preference 。

O originate(优选本地路由器产生的路由。)

A (AS_PATH,优选条数最少的)。

O(originate code。 选择优先级  i>e>?(incomplete))

E  (ebgp 路由优于  ibgp 路由)

M(MED,对于同一路由,优选MED比较小的那一条)

 I(如果从多条路径学到同一路由条目,优选IGP的cost最小的那个邻居作为数据包的下一跳)

MP:若果设置了多路径multiple-path,则做负载均衡。数据同时走多条路线。

FP:最先学习到的那一条路径。oldest path。

RIP:如果对端设置了router-id,则选择router-id最小的那一台路由器作为下一跳。

CID:选择cluster-id最小的那一台路由器作为下一跳。

PA:选择peer-address最小的那一台路由器作为下一跳。

 

总之记住

WLOAO  EMI  MP FP RID  CID PA  这一个序列基本上可以推导出以上的内容。背单词总会的吧。这么多个字母充其量,两个单词,四六级都过来的人,这几个破字母难不倒你的。

 

重点是,在记住这一串字母的之前,首先要了解每个字母的意义,当背到相应字母的时候,停下来,想一下,这个字母代表什么,冥想一下,理清楚之后再背下一个,最后再连贯起来,就很容易记住这些规则。

 

 

最后说一句:重要的不在于努力,重要的在于方法。好方法可以帮助你少走很多弯路。

over


原创粉丝点击