发新话题
打印

[网络转载] 验证BGP选路规则之Origin(IGP<EGP<Incomplete)

验证BGP选路规则之Origin(IGP<EGP<Incomplete)

[实验目的]验证BGP选路规则之Origin(IGP<EGP<Incomplete)

[监测和调试]
Cisco官方文档中关于BGP选路原则中的第五条如下:
5.Prefer the path with the lowest origin type.
Note: IGP is lower than Exterior Gateway Protocol (EGP), and EGP is lower than INCOMPLETE.
这里IGP是指起源本AS内的BGP路由,即通过network命令发布的;EGP是指通过EGP(在使用BGP前的解决AS间通信的老爷车级的有类路由协议)重发布到BGP中的路由;INCOMPLETE是指通过IGP或静态重发布到BGP中的路由
下面通过实验进行验证。具体配置回复中补充,因为EGP早以淘汰,所以大家看看结果足矣,花时间去研究重要的东西
完成所有配置后可以看到R2的BGP表:
R2#sh ip bg
BGP table version is 7, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
               r RIB-failure
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          ; ;       Next Hop         &am p;nb sp;      Metric LocPrf Weight Path
*>i192.168.3.0         23.1.1.3                   0     100      0         i
* i                             13.1.1.3                   1     100      0         e
* i                             45.1.1.5                129    100      0         ?

R2#sh ip bg 192.168.3.0
BGP routing table entry for 192.168.3.0/24, version 7
Paths: (3 available, best #1, table Default-IP-Routing-Table)
  Not advertised to any peer
  Local
    23.1.1.3 from 23.1.1.3 (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, internal, best
  Local
    13.1.1.3 from 12.1.1.1 (13.1.1.1)
      Origin EGP, metric 1, localpref 100, valid, internal
  Local
    45.1.1.5 from 24.1.1.4 (4.4.4.4)
      Origin incomplete, metric 129, localpref 100, valid, internal
根据BGP表的显示我们看到三条路由条目首先都是可达的(同步已经关闭),这样三个条目才都有资格进入选举。因为weight( 默认都是0),local_preference(默认都是100),AS_path(都是本AS内的,所以Path显示为空) 都是相同的,这样就要通过比较Origin来决定胜负。
可以看到R2选择了Origin IGP 作为best,所以Origin中最优先的自然是IGP路由,下面不让R3通过BGP直接发布192.168.3.0网段,看E GP和Incomplete会选择谁
R3(config)#router bgp 64512
R3(config-router)#no net 192.168.3.0
R2#clear ip bg * so
R2#sh ip bg
BGP table version is 8, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
               r RIB-failure
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          ; ;     Next Hop         &am p;nb sp;   Metric LocPrf Weight    Path
*>i192.168.3.0      13.1.1.3                   1    100         0          e
*  i                           45.1.1.5                 129  100         0          ; ;  ?
R2#sh ip bg 192.168.3.0
BGP routing table entry for 192.168.3.0/24, version 8
Paths: (2 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
  Not advertised to any peer
  Local
    13.1.1.3 from 12.1.1.1 (13.1.1.1)
      Origin EGP, metric 1, localpref 100, valid, internal, best
  Local
    45.1.1.5 from 24.1.1.4 (4.4.4.4)
      Origin incomplete, metric 129, localpref 100, valid, internal
由此可见EGP优于incomplete
总结:IGP<EGP<incomplete(小于号表示the lowest origin type,the first)
至此完成对该原则的全部验证过程。

TOP

1.Prefer the path with the highest WEIGHT.

Note:  WEIGHT is a Cisco-specific parameter. It is local to the router on which it is configured.

2.Prefer the path with the highest LOCAL_PREF.

Note: A path without LOCAL_PREF is considered to have had the value set with the bgp default local-preference command, or to have a value of 100 by default.

3.Prefer the path that was locally originated via a network or aggregate BGP subcommand or through redistribution from an IGP.

Local paths that are sourced by the network or redistribute commands are preferred over local aggregates that are sourced by the aggregate-address command.

4.Prefer the path with the shortest AS_PATH.

Note: Be aware of these items:

(1)This step is skipped if you have configured the bgp bestpath as-path ignore command.

(2)An AS_SET counts as 1, no matter how many ASs are in the set.

(3)The AS_CONFED_SEQUENCE and AS_CONFED_SET are not included in the AS_PATH length.

5.Prefer the path with the lowest origin type.

Note: IGP is lower than Exterior Gateway Protocol (EGP), and EGP is lower than INCOMPLETE.

6.Prefer the path with the lowest multi-exit discriminator (MED).

Note: Be aware of these items:

(1)This comparison only occurs if the first (the neighboring) AS is the same in the two paths. Any confederation sub-ASs 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.

(2)If bgp always-compare-med is enabled, MEDs are compared for all paths.

You must disable this option over the entire AS. Otherwise, routing loops can occur.

(3)If bgp bestpath med-confed is enabled, MEDs are compared for all paths that consist only of AS_CONFED_SEQUENCE.

These paths originated within the local confederation.

(4)THE MED of paths that are received from a neighbor with a MED of 4,294,967,295 is changed before insertion into the BGP table. The MED changes to to 4,294,967,294.

(5)Paths received with no MED are assigned a MED of 0, unless you have enabled bgp bestpath missing-as-worst .

If you have enabled bgp bestpath missing-as-worst, the paths are assigned a MED of 4,294,967,294.

(6)The bgp deterministic med command can also influence this step.

Refer to How BGP Routers Use the Multi-Exit Discriminator for Best Path Selection for a demonstration.

7.Prefer eBGP over iBGP paths.

If bestpath is selected, go to Step 9 (multipath).

Note: Paths that contain AS_CONFED_SEQUENCE and AS_CONFED_SET are local to the confederation. Therefore, these paths 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.

Continue, even if bestpath is already selected.

9.Determine if multiple paths require installation in the routing table for BGP Multipath.

Continue, if bestpath is not yet selected.

10.When both paths are external, prefer the path that was received first (the oldest one).

This step minimizes route-flap because a newer path does not displace an older one, even if the newer path would be the preferred route based on the next decision criteria (Steps 11, 12, and 13).

Skip this step if any of these items is true:

(1)You have enabled the bgp best path compare-routerid command.

Note: Cisco IOS Software Releases 12.0.11S, 12.0.11SC, 12.0.11S3, 12.1.3, 12.1.3AA, 12.1.3.T, and 12.1.3.E introduced this command.

(2)The router ID is the same for multiple paths because the routes were received from the same router.

(3)There is no current best path.

The current best path can be lost when, for example, the neighbor that offers the path goes down.

11.Prefer the route that comes 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. Also, you can use the bgp router-id command to manually set the router ID.

Note: If a path contains route reflector (RR) attributes, the originator ID is substituted for the router ID in the path selection process.

12.If the originator or router ID is the same for multiple paths, prefer the path with the minimum cluster list length.

This is only present in BGP RR environments. It allows clients to 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 that comes from the lowest neighbor address.

This address is the IP address that is used in the BGP neighbor configuration. The address corresponds to the remote peer that is used in the TCP connection with the local router

TOP

哈哈,什么事都有规则呀,当然验证也得有呀.

TOP

发新话题