设为首页收藏本站language→→ 语言切换

鸿鹄论坛

 找回密码
 论坛注册

QQ登录

先注册再绑定QQ

查看: 887|回复: 1
收起左侧

[分享] BGP十三条PK规则的排序原因

[复制链接]
发表于 2014-4-18 18:01:09 | 显示全部楼层 |阅读模式
以下为本人在床上思考总结推理之结果,欢迎交流

一,weight,local_pre,locally originated 用于控制用户数据如何出去,根据作用范围从小到大来进行排序;
1,weight是思科私有的,用于一台路由器二个BGP邻居时,作用范围是一台路由器上;
2,local_pre用于一个AS内部有二个EBGP出口时,作用范围是一个AS内部;
3,locally originated就是公有的weight,因为思科已经使用了WEIGHT,所以这个属性在思科设备上没有作用了,思科的书上很少提起这个属性。但是如果在华为的设备上,因为没有WEIGHT属性,所以将使用到这个属性;同时说一句,locally originated的路由的weight都是32768;而且CISCO把WEIGHT提于LOCAL PRE之前,我认为是考虑到了范围的大小;

再三条(4,5,6)用于控制用户数据如何进来,根据作用范围的从远到近,从强到弱来进行排序;
4,AS-PATH,可以使用通路附加来影响很远的地方的用户数据流入我这个AS内部,作用强度相对比origin强;
5,origin,可以使得一边通告出去的路由是?,另一边通告出去的路由是i,使得外部路由进来时,从i那边进来;作用强度没as-path强;
6,MED,只能影响他的上一级AS的用户的入流量方向,作用范围太近,所以排第三了;

再三条(7,8,9)使得使用我本地的AS内的流量最少,也就是利用的带宽最有效;
7,上面6条PK不出来了,走EBGP对于我本地AS内的带宽使用最少;
8,全是二个同类的BGP了,那么选到一个BGP的IGP的COST最少的,也就是利用我AS内部的带宽最少的;
9,如果到二个BGP的COST相同,可以使用这二条链路进行负载均衡,链路使用更有效;
10,如果9不被允许,选一个最稳定的下一跳,也就是先收到的那条,利用会更有效;

再后面的,是没有办法的办法,为什么要选小的,而不选大的?留给大家思考吧,这东西,仁者见仁,智者见智;
11,选最小的ROUTER-ID;
12,选cluster-id最短;
13,选nei的IP地址最小的;


参考资料:
1.Prefer the path with the largest WEIGHT. WEIGHT is a Cisco proprietary parameter, local to the router on which it is configured.
2.Prefer the path with the largest local preference (LOCAL_PREF).
3.Prefer the path that was locally originated through a network or aggregate BGP subcommand, or through redistribution from an IGP. Local paths sourced by network/redistribute commands are preferred over local aggregates sourced by the aggregate-address command.
4.Prefer the path with the shortest AS_PATH. The AS_PATH is a listing of the autonomous systems through which this particular update traveled to reach the local autonomous system. The fewer autonomous systems it crossed, the more preferred the route is. Note the following:
a.- This step is skipped if you configure bgp bestpath as-path ignore.
b.- An AS_SET counts as 1, no matter how many autonomous systems are in the set.
c.- The AS_CONFED_SEQUENCE is not included in the AS_PATH length.
5.Prefer the path with the lowest origin type: IGP is lower than EGP, and EGP is lower than INCOMPLETE.
6.Prefer the path with the lowest multi-exit discriminator (MED). Note the following:
a.- This comparison is done only if the first (neighboring) AS is the same in the two paths; any Confederation Sub-autonomous systems are ignored. In other words, MEDs are compared only if the first AS in the AS_SEQUENCE is the same for multiple paths. Any preceding AS_CONFED_SEQUENCE is ignored.
b.- If bgp always-compare-med is enabled, MEDs are compared for all paths. This option needs to be enabled over the entire AS, otherwise, routing loops can occur.
c.- If bgp bestpath med-confed is enabled, MEDs are compared for all paths that consist only of AS_CONFED_SEQUENCE (paths originated within the local confederation).
d.- Paths received from a neighbor with a MED of 4,294,967,295 will have the MED changed to 4,294,967,294 before insertion into the BGP table.
e.- Paths received with no MED are assigned a MED of 0, unless bgp bestpath missing-as-worst is enabled; in that case, they are assigned a MED of 4,294,967,294.
f.- The bgp deterministic med command also can influence this step.
7.Prefer external (eBGP) over internal (iBGP) paths. Paths containing AS_CONFED_SEQUENCE are local to the confederation and, therefore, are treated as internal paths. There is no distinction between Confederation External and Confederation Internal.
8.Prefer the path with the lowest IGP metric to the BGP next hop.
9.If the maximum-paths n command is enabled and there are multiple external or confederation external paths from the same neighboring AS or Sub-AS, BGP inserts up to n most recently received paths in the IP routing table. This allows eBGP multi-path load sharing. The maximum value of n is currently 6. The default value, when this option is disabled, is 1. The oldest received path is marked as the best path in the output of show ip bgp longer-prefixes, and the equivalent of next-hop-self is performed before forwarding this best path to internal peers.
10.If both paths are external, prefer the path that was received first (the oldest one). This step minimizes route flapping because a newer path won't displace an older one, even if it was the preferred route based on the RID. It is better practice to apply the additional decision steps in 11, 12, and 13 to iBGP paths only, to ensure a consistent best path decision within the network and thereby avoid loops. This step is skipped if any of the following is true:
a.- The bgp best path compare-routerid command is enabled.
b.- The router ID is the same for multiple paths because the routes were received from the same router.
c.- No current best path exists. An example of losing the current best path occurs when the neighbor offering the path goes down.
11.Prefer the route coming from the BGP router with the lowest router ID. The router ID is the highest IP address on the router, with preference given to loopback addresses. It can also be set manually using the bgp router-id command. If a path contains RR attributes, the originator ID is substituted for the router ID in the path selection process.
12.If the originator or RID is the same for multiple paths, prefer the path with the minimum cluster ID length. This will be present only in a BGP Route-Reflector environment in which clients peer with RRs or clients in other clusters. In this scenario, the client must be aware of the RR-specific BGP attribute.
13.Prefer the path coming from the lowest neighbor address. This is the IP address used in the BGP neighbor configuration, and it corresponds to the remote peer used in the TCP connection with the local router.
发表于 2016-3-17 15:40:58 | 显示全部楼层
谢谢共享资料
沙发 2016-3-17 15:40:58 回复 收起回复
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 论坛注册

本版积分规则

QQ|Archiver|手机版|小黑屋|sitemap|鸿鹄论坛 ( 京ICP备14027439号 )  

GMT+8, 2024-4-20 05:41 , Processed in 0.059307 second(s), 9 queries , Redis On.  

  Powered by Discuz!

  © 2001-2024 HH010.COM

快速回复 返回顶部 返回列表