Paths: (1 available, best #1, table Default-IP-Routing-Table) Advertised to non peer-group peers: 12.12.12.2
Local, (aggregated by 1 1.1.1.1) 0.0.0.0 from 0.0.0.0 (1.1.1.1)
Origin IGP, localpref 100, weight 32768, valid, S, local, atomic-aggregate, best
3:任选可透明传送不支持可以传输给对端
? ? ? ?
1:aggregated
2:community团队 (no-export不向任何ebgp对等体发 no-advertisement不会向任何bgp对等体发送 local-as不会公告给任何ebgp(包括联盟对等体) 4:任选非可透明传送不支持也不传递
o
不识别该属性的BGP进程可以忽略包含这个属性的更新消息并且不向它的对端公布这 条路径 Med默认0越小越好
本地配置影响EBGP 对等体,进站路径的抉择 Originate-id起源id用于路由反射器 Cluster-id簇id
Class Well-known mandatory Well-known mandatory Well-known mandatory Well-known discretionary Well-known discretionary Optional transitive Optional transitive Optional nontransitive Optional nontransitive Optional nontransitive o o o o
Attribute ORIGIN AS_PATH NEXT_HOP LOCAL_PREF ATOMIC_AGGREGATE AGGREGATOR COMMUNITY MULTI_EXIT_DISC (MED) ORIGINATOR_ID CLUSTER_LIST
R2#sh ip bgp
BGP table version is 4, local router ID is 12.12.12.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 12.12.12.1 0 0 1 ?
r> 12.12.12.0/24 12.12.12.1 0 0 1 ? R2#
IGP METRIC 一般称其为度量,就是路径开销,越小越优 BGP METRIC 有两种意思: 1:MED 0
2:如果你将IGP 路由前缀通过NETWORK 的方式宣告进BGP 时,那么METRIC 字段用于继承 IGP 中这个路由前缀的度量值 或者是你将IGP 路由充分发进BGP 时,这个字段也是用于继承该重分发路由的METRIC 值。
RIP 1.1.1.0 2
NETWORK BGP METIC 2 REDISTRIBUTE INTO BGP Metric 2
R3#sh ip bgp
BGP table version is 5, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*>i11.11.11.0/24 2.2.2.2 0 100 0 1 i
*>i22.22.22.0/24 2.2.2.2 0 100 0 i 红色部分是路由更新所携带的路由属性
LP 只在本AS 内泛洪,影响出站流量路径的方向。
BGP 选路原则
The following list of rules determines the best path: 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. I E ? 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.
1.优选有最大Weight的路由 (范围0 到 65535) 越大越优
影响当前路由器出站流量路径抉择,并且是在当前路由器配置,影响本地. A:weight是CISCO私有的参数,路由器配置了权重后在本地有效。
从EBGP PEER 接受的路由前缀他的WEIGHT 是0