[
实验目的]验证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)
至此完成对该原则的全部验证过程。