CCIE路由实验(2) -- BGP选路原则

BGP路径属性分为4类:

公认必遵(Well-Known Mandatory):BGP更新报文中必须包含的,且必须被所有BGP厂商实现所能识别的,包括ORIGIN,AS-PATH和Next_Hop

1.ORIGIN: 这个属性说明了源路由是怎样放到BGP表中的。有三个可能的值:IGP, EGP 以及INCOMPLETE.路由器选择具有最低ORIGIN类型的路径。ORIGIN类型从低到高的顺序为IGP < EGP < INCOMPLETE;

2.AP-PATH(AS路径): 指出包含在UPDATE报文中的路由信息所经过的自治系统的序列。

3.NEXT_HOT: 声明路由器所获得的BGP路由的下一跳。对EBGP和起源AS内部的IBGP会话来说,下一跳就是通告该路由的邻居路由器的源地址。对于IBGP会话中,由EBGP注入AS的路由,它的下一跳会不变的带入IBGP中。

公认自决(Well-know Discretionary): 必须被所有BGP实现所识别,但是在BGP更新报文中可以发送,也可以不发送的属性,包括LOCAL_PREF和ATOMIC_AGGREGATE两个属性。

1.LOCAL_PREF: 本地优先级属性用于高速自治系统内的路由器在有多条路径时,怎样离开自治系统。本地优先级越高,路由优先级高。这个属性仅在IBGP邻居之间传递。

2.ATOMIC_AGGREGATE: 原子聚合属性指出已被丢失了的信息。当路由聚合时会导致信息的丢失,因为聚合来自具有不同属性的不同源。如果一个路由器发送了导致信息丢失的聚合,路由器被要求将原子聚合属性附加到该路由上。

可选过渡(Optional Transitive): 可选过渡属性并不要求所有的BGP实现都支持。如果该属性不能被BGP进程识别,它就会去看过渡标志。如果过渡标志被设置了,BGP进程就会接受这个属性并将它不加改变的传送,包括AGGREGATOR和COMMUNITY.

1.AGGREGATOR(聚合者): 该属性表明了实施路由聚合的BGP路由器ID和聚合路由的路由器的AS号;

2.COMMUNITY(团体): 此属性指共享一个公共属性的一组路由器。

可选非过渡(Optional Nontransitive):可选非过渡属性并不要求所有的BGP实现都支持。如果这些属性被发送到不能对其识别的路由器,这些属性将会被丢弃,不能传送给BGP邻居,包括MED、ORIGINATOR_ID和CLUSTER_LIST.

1.MED(多出口区分):该属性通知AS外的路由器采用哪一条路径到达AS。它也被认为是路由的外部度量,低的MED值表示高的优先级。MED属性在自治系统间交换,但MED属性不能传递给第三方AS;

2.ORIGINATOR_ID(起源ID):路由反射器会附加到这个属性上,它携带本AS源路由器的路由器ID,用以防止环路。

3.CLUSTER_LIST(簇列表):此属性显示了采用的反射路径。

Well-Known Mandatory:
1.ORIGIN(#5)
2.AP-PATH(#4)
3.NEXT_HOT

Well-know Discretionary:
1.LOCAL_PREF(#2)
2.ATOMIC_AGGREGATE

Optional Transitive:
1.AGGREGATOR
2.COMMUNITY

Optional Nontransitive:
1.MED(#6)
2.ORIGINATOR_ID
3.CLUSTER_LIST(#12)

1.优选weight值更高的路由
2.优选local preference值更高的路由
3.优选从本路由器始发的路由
4.优选具有最短AS-PATH的BGP路由
5.优选更低Origin属性的路由
6.优选最小MED值的路由
7.优选从EBGP邻居学习到的路由
8.优选从更近的BGP邻居学到的路由
9.BGP的等价负载均衡
10.优选从EBGP邻居先学习到的路由
11.优选具有更小的route-id的BGP邻居
12.优选拥有最短的cluster-list长度的路由
13.优选具有最低BGP邻居地址的路由

基本配置:
enable
conf t
no ip do lo
enable pass cisco
line con 0
logg sync
exec-t 0 0
line vty 0 4
pass cisco
logg sync
exit
host

1.优选weight值更高的路由
weight是Cisco私有的参数,路由器配置了weight值后只在本地生效
缺省情况下,通过本路由器宣告、重分布或者汇总的路由的weight位32768,从BGP邻居学习到的路由的weight值为0
可以更改从邻居学习到路由的weight值,不能修改发给邻居的weight值。即只能在路由器的入方向做修改。

CCIE路由实验(2) -- BGP选路原则

R1:
int f0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int f1/0
ip add 13.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
no shut
exit

router eigrp 1
no auto-summary
network 12.1.1.0 0.0.0.255
network 11.1.1.0 0.0.0.255
exit

router bgp 100
bgp router-id 11.1.1.1
neighbor 22.1.1.1 remote-as 100
neighbor 22.1.1.1 update-source l0
neighbor 22.1.1.1 next-hop-self
neighbor 13.1.1.3 remote-as 200
exit

R2:
int f0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int f1/0
ip add 23.1.1.2 255.255.255.0
no shut
exit
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit

router eigrp 1
no auto-summary
network 12.1.1.0 0.0.0.255
network 22.1.1.0 0.0.0.255
exit

router bgp 100
bgp router-id 22.1.1.1
neighbor 11.1.1.1 remote-as 100
neighbor 11.1.1.1 update-source l0
neighbor 11.1.1.1 next-hop-self
neighbor 23.1.1.3 remote-as 200
exit

R3:
int f1/0
ip add 13.1.1.3 255.255.255.0
no shut
exit
int f0/0
ip add 23.1.1.3 255.255.255.0
no shut
exit
int l0
ip add 33.1.1.1 255.255.255.0
no shut
exit

router bgp 200
bgp router-id 33.1.1.1
neighbor 13.1.1.1 remote-as 100
neighbor 23.1.1.2 remote-as 100
exit

R1:
show ip bgp summary

R3:
router bgp 200
network 33.1.1.0 mask 255.255.255.0
exit

show ip bgp

R1:
show ip bgp

router bgp 100
neighbor 22.1.1.1 weight 1000
exit

clear ip bgp * in
show ip bgp

ip prefix-list 33.1 permit 33.1.1.0/24
route-map WEIGHT permit 10
match ip address prefix-list 33.1
set weight 200
exit
route-map WEIGHT permit 9999
exit

router bgp 100
neighbor 22.1.1.1 route-map WEIGHT in
exit

clear ip bgp * in
show ip bgp

R3:
int l1
ip add 33.1.2.1 255.255.255.0
exit

router bgp 200
network 33.1.2.0 mask 255.255.255.0
exit

R1:
show ip bgp

R1:
router bgp 100
no neighbor 22.1.1.1 weight 1000
exit

no route-map WEIGHT permit 10
no ip prefix-list 33.1

router bgp 100
no neighbor 22.1.1.1 route-map WEIGHT in
exit

2.优选local preference值更高的路由
通过第一条选路原则选不出最优BGP条目的情况下,优选具有最大local preference值的BGP条目
local preference值可以在IBGP邻居之间传递,不能在EBGP邻居之间传递
对于从EBGP邻居学习到的BGP条目,local preference缺省值为100,这个值可以通过命令bgp default local-preference修改

R1:
show ip bgp 33.1.1.0

ip prefix-list 33.1 permit 33.1.1.0/24
route-map LOCAL_PREF permit 10
match ip address prefix-list 33.1
set local-preference 200
exit
route-map LOCAL_PREF permit 9999
exit

router bgp 100
neighbor 22.1.1.1 route-map LOCAL_PREF in
exit

clear ip bgp * in
show ip bgp

R1:
router bgp 100
bgp default local-preference 300
exit

clear ip bgp * in
show ip bgp

R2:
show ip bgp

R1:
no route-map LOCAL_PREF
no ip prefix-list 33.1

router bgp 100
no neighbor 22.1.1.1 route-map LOCAL_PREF in
no bgp default local-preference 300
exit

3.优选从本路由器始发的路由
在通过前两条原则不能选出最优BGP条目的情况下,优选从本地注入的BGP条目。从本地注入BGP条目的方法有: network, redistribution, aggregate
由于第一条原则为Cisco私有,不是所有厂家都支持,因此该条原则的作用就显现出来了。

R1:
int l100
ip add 100.1.1.1 255.255.255.0
exit

router bgp 100
network 100.1.1.0 mask 255.255.255.0
exit

R2:
int l100
ip add 100.1.1.1 255.255.255.0
exit

ip prefix-list 100 permit 100.1.1.0/24
route-map WEIGHT permit 10
match ip address prefix-list 100
set weight 0
exit

router bgp 100
network 100.1.1.0 mask 255.255.255.0 route-map WEIGHT
exit

R2:
show ip bgp

R1:
int l100
no ip add 100.1.1.1 255.255.255.0
exit

router bgp 100
no network 100.1.1.0 mask 255.255.255.0
exit

R2:
int l100
no ip add 100.1.1.1 255.255.255.0
exit

no ip prefix-list 100
no route-map WEIGHT

router bgp 100
no network 100.1.1.0 mask 255.255.255.0 route-map WEIGHT
exit

4.优选具有最短AS-PATH的BGP路由
使用as-path prepend工具修改AS path长度
修改AS path长度只能在EBGP邻居关系之间进行,IBGP邻居关系是不可以的
如果在in方向做as-path prepend, AS号增加在最前面;如果在out方向做as-path prepend,AS号增加在自身AS号的后面

R1:
ip prefix-list 33.1 permit 33.1.1.0/24
route-map AS permit 10
match ip address prefix-list 33.1
set as-path prepend 10 20 30
exit
route-map LOCAL_PREF permit 9999
exit

router bgp 100
neighbor 13.1.1.3 route-map AS in
exit

R1:
clear ip bgp * in
show ip bgp

R1:
no ip prefix-list 33.1
no route-map AS

router bgp 100
no neighbor 13.1.1.3 route-map AS in
exit

5.优选更低Origin属性的路由
前四条不能选出最优条目情况下,优选最低起源类型的BGP路由
最低起源类型的顺序是IGP<EGP<incomplete,其中EGP的方式现在已经不用了
通过Network, aggregate方式产生的BGP路由起源属性是IGP,通过重分布产生的BGP路由的起源属性是incomplete

R1:
show ip bgp

ip prefix-list 33.1 permit 33.1.1.0/24
route-map ORIGIN permit 10
match ip address prefix-list 33.1
set origin incomplete
exit
route-map ORIGIN permit 9999
exit

router bgp 100
neighbor 13.1.1.3 route-map ORIGIN in
exit

R1:
clear ip bgp * in
show ip bgp

R1:
no ip prefix-list 33.1
no route-map ORIGIN

router bgp 100
no neighbor 13.1.1.3 route-map ORIGIN in
exit

6.优选最小MED值的路由
MED生成:
本地network方式产生的BGP条目,会带上IGP的metric,传给所有邻居
如果从IBGP邻居学习到一条BGP条目的metric位0或者其他值,缺省不会传给EBGP邻居,显示为空。
如果从EBGP邻居学习到一条BGP条目的metric位0或者其他值,缺省传给其他IBGP邻居,但不传给EBGP。
汇总方式生成的BGP条目,metri值为空
重分布方式生成的BGP条目,metric值为IGP的cost, metric, hop,汇总也会清除
缺省情况下,空的metric当0看待

注意要点:
只有在通过两条路径得到的一个AS(对等体)是同一个AS时才进行MED比较,任何联盟AS序列号(AS_CONFED_SEQUENCE)都会被忽略。
如果路由器上配置了BGP ALWAYS-COMPARE-MED,则在全部路径进行MED比较。需要全体AS同时启用这个功能,否则可能发生路由环路。
如果路由器上配置了bgp bestpath med confed,将对所有只包括AS_CONFED_SEQUENCE的路径进行MED比较(即路径是起源于本地联盟)。
如果接收到的路径没有分配MED值,则将此路径分配为0. 除非路由器上配置了BGP BESTPATH MED MISSING-AS-WORST,将被看做MED值为4294967295的路由,在注入到BGP路由选择表之前改为4294967295.

只能在相邻的AS传递,一般在OUT方向做,影响入站的流量。

R1/R2:
show ip bgp

R3:
ip prefix-list 33.1 permit 33.1.1.0/24

route-map R1 permit 10
match ip address prefix-list 33.1
set metric 500
exit
route-map R1 permit 9999
exit

route-map R2 permit 10
match ip address prefix-list 33.1
set metric 1000
exit
route-map R2 permit 9999
exit

router bgp 200
neighbor 13.1.1.1 route-map R1 out
neighbor 23.1.1.2 route-map R2 out
exit

clear ip bgp * soft out

R1/R2:
show ip bgp

R1:
ip prefix-list 33.1 permit 33.1.1.0/24
route-map AS permit 10
match ip address prefix-list 33.1
set as-path prepend 20
exit
route-map AS permit 9999
exit

router bgp 100
neighbor 13.1.1.3 route-map AS in
exit

R2:
ip prefix-list 33.1 permit 33.1.1.0/24
route-map AS permit 10
match ip address prefix-list 33.1
set as-path prepend 10
exit
route-map AS permit 9999
exit

router bgp 100
neighbor 23.1.1.3 route-map AS in
exit

R1/R2:
clear ip bgp * in
show ip bgp

R2:
router bgp 100
bgp always-compare-med
exit

R1/R2:
clear ip bgp * in
show ip bgp

R2:
int l0
ip add 22.1.1.1 255.255.255.0
exit

router bgp 100
network 22.1.1.0 mask 255.255.255.0
exit

R3:
show ip bgp

router bgp 200
bgp bestpath med missing-as-worst
exit

show ip bgp

7.优选从EBGP邻居学习到的路由
前面六条不能选出最优BGP条目的情况下,优选从EBGP邻居学习到的路由条目。

R1:
int f0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int f1/0
ip add 13.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
no shut
exit

router eigrp 1
no auto-summary
network 12.1.1.0 0.0.0.255
network 11.1.1.0 0.0.0.255
exit

router bgp 100
bgp router-id 11.1.1.1
neighbor 22.1.1.1 remote-as 100
neighbor 22.1.1.1 update-source l0
neighbor 22.1.1.1 next-hop-self
neighbor 13.1.1.3 remote-as 200
exit

R2:
int f0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int f1/0
ip add 23.1.1.2 255.255.255.0
no shut
exit
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit

router eigrp 1
no auto-summary
network 12.1.1.0 0.0.0.255
network 22.1.1.0 0.0.0.255
exit

router bgp 100
bgp router-id 22.1.1.1
neighbor 11.1.1.1 remote-as 100
neighbor 11.1.1.1 update-source l0
neighbor 11.1.1.1 next-hop-self
neighbor 23.1.1.3 remote-as 200
exit

R3:
int f1/0
ip add 13.1.1.3 255.255.255.0
no shut
exit
int f0/0
ip add 23.1.1.3 255.255.255.0
no shut
exit
int l0
ip add 33.1.1.1 255.255.255.0
no shut
exit

router bgp 200
bgp router-id 33.1.1.1
neighbor 13.1.1.1 remote-as 100
neighbor 23.1.1.2 remote-as 100
exit

R1:
show ip bgp summary

R3:
router bgp 200
network 33.1.1.0 mask 255.255.255.0
exit

8.优选从更近的BGP邻居学到的路由
优选对BGP下一跳具有最低IGP度量值的路径。

R1:
int f0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int f1/0
ip add 13.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 11.1.1.1
network 12.1.1.0 0.0.0.255 area 0
network 13.1.1.0 0.0.0.255 area 0
network 11.1.1.0 0.0.0.255 area 0
exit

router bgp 100
bgp router-id 11.1.1.1

neighbor 22.1.1.1 remote-as 100
neighbor 22.1.1.1 update-source l0
neighbor 22.1.1.1 next-hop-self

neighbor 33.1.1.1 remote-as 200
neighbor 33.1.1.1 update-source l0
neighbor 33.1.1.1 ebgp-multihop
exit

R2:
int f0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int f1/0
ip add 23.1.1.2 255.255.255.0
no shut
exit
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 22.1.1.1
network 12.1.1.0 0.0.0.255 area 0
network 22.1.1.0 0.0.0.255 area 0
network 23.1.1.0 0.0.0.255 area 0
exit

router bgp 100
bgp router-id 22.1.1.1

neighbor 11.1.1.1 remote-as 100
neighbor 11.1.1.1 update-source l0
neighbor 11.1.1.1 next-hop-self

neighbor 33.1.1.1 remote-as 200
neighbor 33.1.1.1 update-source l0
neighbor 33.1.1.1 ebgp-multihop
exit

R3:
int f1/0
ip add 13.1.1.3 255.255.255.0
no shut
exit
int f0/0
ip add 23.1.1.3 255.255.255.0
no shut
exit
int l0
ip add 33.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 33.1.1.1
network 13.1.1.0 0.0.0.255 area 0
network 23.1.1.0 0.0.0.255 area 0
network 33.1.1.0 0.0.0.255 area 0
exit

router bgp 200
bgp router-id 33.1.1.1
neighbor 11.1.1.1 remote-as 100
neighbor 11.1.1.1 update-source l0
neighbor 11.1.1.1 ebgp-multihop

neighbor 22.1.1.1 remote-as 100
neighbor 22.1.1.1 update-source l0
neighbor 22.1.1.1 ebgp-multihop
exit

R3:
end
show ip bgp summary
conf t

R2:
router bgp 100
network 22.1.1.0 mask 255.255.255.0
exit

R3:
end
show ip bgp summary
show ip route ospf
conf t

R2:
int l0
ip ospf cost 9
exit

R3:
end
show ip bgp 22.1.1.0
conf t

9.BGP的等价负载均衡
前面8条原则不能选出最优路由情况下,可以实现负载均衡。在支持EBGP的等价负载均衡的时候,通过直连链路建立EBGP邻居时,尽管直连链路的带宽不一致,但是作为直连的路由条目,IGP的度量值却是一样的,因此能够实现负载均衡。当然这种情况下实现负载均衡并不合理。

R1:
int f0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int f1/0
ip add 13.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
no shut
exit

router eigrp 1
no auto-summary
network 12.1.1.0 0.0.0.255
network 11.1.1.0 0.0.0.255
exit

router bgp 100
bgp router-id 11.1.1.1
neighbor 22.1.1.1 remote-as 100
neighbor 22.1.1.1 update-source l0
neighbor 22.1.1.1 next-hop-self
neighbor 13.1.1.3 remote-as 200
exit

R2:
int f0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int f1/0
ip add 23.1.1.2 255.255.255.0
no shut
exit
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit

router eigrp 1
no auto-summary
network 12.1.1.0 0.0.0.255
network 22.1.1.0 0.0.0.255
exit

router bgp 100
bgp router-id 22.1.1.1
neighbor 11.1.1.1 remote-as 100
neighbor 11.1.1.1 update-source l0
neighbor 11.1.1.1 next-hop-self
neighbor 23.1.1.3 remote-as 200
exit

R3:
int f1/0
ip add 13.1.1.3 255.255.255.0
no shut
exit
int f0/0
ip add 23.1.1.3 255.255.255.0
no shut
exit
int l0
ip add 33.1.1.1 255.255.255.0
no shut
exit

router bgp 200
bgp router-id 33.1.1.1
neighbor 13.1.1.1 remote-as 100
neighbor 23.1.1.2 remote-as 100

network 33.1.1.0 mask 255.255.255.0
exit

--------------------------------------------
R2:
router bgp 100
network 22.1.1.0 mask 255.255.255.0
exit

R3:
end
show ip bgp
show ip route bgp
conf t

router bgp 200
maximum-paths 2
exit

end
show ip route bgp
conf t

router bgp 200
no maximum-path 200
exit

10.优选从EBGP邻居先学习到的路由
通过前边9条原则不能选出最优BGP路由条目的情况下,同事从多个EBGP邻居学到的相同BGP条目,优选最先学习到的路由。
一般情况下,先建立邻居关系,意味着先学习到BGP路由条目。但是在有多个EBGP邻居的情况下,对某一条路由而言,并不一定从先建立的EBGP邻居学到。
在使能bgp bestpath compare-routerid命令后,跳过本条选路原则,拥有最小的router-id的路由器的路由想会被选为最优。

R2:
router bgp 100
network 22.1.1.0 mask 255.255.255.0
exit

R3:
end
show ip bgp summary
show ip bgp
conf t

router bgp 200
neighbor 13.1.1.1 shut
no neighbor 13.1.1.1 shut
exit

end
show ip bgp
show ip bgp summary
conf t

router bgp 200
bgp bestpath compare-routerid
exit

end
show ip bgp
show ip bgp summary
exit

11.优选具有更小的route-id的BGP邻居
在从多个IBGP邻居学到相同路由的情况下,通过前面10跳原则不能选出最优路由,则拥有最小的router-id的路由北选为最优。
在从多个EBGP邻居学到相同路由的情况下,使能bgp bestpath compare-routerid命令后,则跳过第10跳原则,拥有最小的router-id的路由被选为最优。
一个路由器从多个RR收到相同的路由进行最优路径选择时,router-id被该位originator-id,此id是在本AS学到路由的第一条路由器的router-id, 而不是RR的router-id.
因此,如果BGP路由只是从一个ASBR学到到然后传入AS内部,由于ORIGINATOR-ID为相同的ASBR的router-id,因此会跳过本条选路原则。
也就是说,如果包括路由反射器,originator-id会代替router-id在选路过程中起作用。

CCIE路由实验(2) -- BGP选路原则

R1:
int f0/0
ip add 123.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
no shut
exit

router eigrp 1
no auto-summary
network 123.1.1.0 0.0.0.255
network 11.1.1.0 0.0.0.255
exit

router bgp 100
bgp router-id 11.1.1.1
neighbor 22.1.1.1 remote-as 100
neighbor 22.1.1.1 update-source l0
neighbor 22.1.1.1 next-hop-self

neighbor 33.1.1.1 remote-as 100
neighbor 33.1.1.1 update-source l0
neighbor 33.1.1.1 next-hop-self
exit

R2:
int f0/0
ip add 123.1.1.2 255.255.255.0
no shut
exit
int f1/0
ip add 24.1.1.2 255.255.255.0
no shut
exit
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit

router eigrp 1
no auto-summary
network 123.1.1.0 0.0.0.255
network 22.1.1.0 0.0.0.255
exit

router bgp 100
bgp router-id 22.1.1.1
neighbor 11.1.1.1 remote-as 100
neighbor 11.1.1.1 update-source l0
neighbor 11.1.1.1 next-hop-self

neighbor 33.1.1.1 remote-as 100
neighbor 33.1.1.1 update-source l0
neighbor 33.1.1.1 next-hop-self

neighbor 24.1.1.4 remote-as 200
exit

R3:
int f0/0
ip add 123.1.1.3 255.255.255.0
no shut
exit
int l0
ip add 33.1.1.1 255.255.255.0
no shut
exit
int f1/0
ip add 34.1.1.3 255.255.255.0
no shut
exit

router bgp 100
bgp router-id 33.1.1.1
neighbor 11.1.1.1 remote-as 100
neighbor 11.1.1.1 update-source l0
neighbor 11.1.1.1 next-hop-self

neighbor 22.1.1.1 remote-as 100
neighbor 22.1.1.1 update-source l0
neighbor 22.1.1.1 next-hop-self

neighbor 34.1.1.4 remote-as 200
exit

R4:
int f0/0
ip add 24.1.1.4 255.255.255.0
no shut
exit
int f1/0
ip add 34.1.1.4 255.255.255.0
no shut
exit
int l0
ip add 44.1.1.1 255.255.255.0
exit

router bgp 200
bgp router-id 44.1.1.1
neighbor 24.1.1.2 remote-as 100
neighbor 34.1.1.3 remote-as 100

network 44.1.1.0 mask 255.255.255.0
exit

R1:
show ip bgp
show ip bgp 44.1.1.0

R3:
router bgp 100
bgp router-id 3.3.3.3
exit

R1:
show ip bgp 44.1.1.0

12.优选拥有最短的cluster-list长度的路由

在IBGP邻居之间传送路由过程中,常用多RR环境。当一个路由器从多个RR收到相同BGP路由进行最优路径选择时,优选拥有最短的cluster-list长度的BGP条目。

CCIE路由实验(2) -- BGP选路原则

R1:
int f0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int f1/0
ip add 13.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
no shut
exit

router eigrp 1
no auto-summary
network 12.1.1.0 0.0.0.255
network 13.1.1.0 0.0.0.255
network 11.1.1.0 0.0.0.255
exit

router bgp 100
bgp router-id 11.1.1.1
neighbor 22.1.1.1 remote-as 100
neighbor 22.1.1.1 update-source l0
neighbor 22.1.1.1 next-hop-self

neighbor 33.1.1.1 remote-as 100
neighbor 33.1.1.1 update-source l0
neighbor 33.1.1.1 next-hop-self
exit

R2:
int f0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int f1/0
ip add 23.1.1.2 255.255.255.0
no shut
exit
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit

router eigrp 1
no auto-summary
network 12.1.1.0 0.0.0.255
network 23.1.1.0 0.0.0.255
network 22.1.1.0 0.0.0.255
exit

router bgp 100
bgp router-id 22.1.1.1
neighbor 11.1.1.1 remote-as 100
neighbor 11.1.1.1 update-source l0
neighbor 11.1.1.1 next-hop-self

neighbor 33.1.1.1 remote-as 100
neighbor 33.1.1.1 update-source l0
neighbor 33.1.1.1 next-hop-self

exit

R3:
int f0/0
ip add 13.1.1.3 255.255.255.0
no shut
exit
int f1/0
ip add 23.1.1.3 255.255.255.0
no shut
exit
int l0
ip add 33.1.1.1 255.255.255.0
no shut
exit
int f2/0
ip add 34.1.1.3 255.255.255.0
no shut
exit

router eigrp 1
no auto-summary
network 13.1.1.0 0.0.0.255
network 23.1.1.0 0.0.0.255
network 34.1.1.0 0.0.0.255
network 33.1.1.0 0.0.0.255
exit

router bgp 100
bgp router-id 33.1.1.1
neighbor 11.1.1.1 remote-as 100
neighbor 11.1.1.1 update-source l0
neighbor 11.1.1.1 next-hop-self

neighbor 22.1.1.1 remote-as 100
neighbor 22.1.1.1 update-source l0
neighbor 22.1.1.1 next-hop-self

neighbor 44.1.1.1 remote-as 100
neighbor 44.1.1.1 update-source l0
neighbor 44.1.1.1 next-hop-self
exit

R4:
int f0/0
ip add 34.1.1.4 255.255.255.0
no shut
exit
int l0
ip add 44.1.1.1 255.255.255.0
no shut
exit
int f1/0
ip add 45.1.1.4 255.255.255.0
no shut
exit

router eigrp 1
no auto-summary
network 34.1.1.0 0.0.0.255
network 44.1.1.0 0.0.0.255
exit

router bgp 100
bgp router-id 44.1.1.1
neighbor 33.1.1.1 remote-as 100
neighbor 33.1.1.1 update-source l0
neighbor 33.1.1.1 next-hop-self

neighbor 45.1.1.5 remote-as 200
exit

R5:
int f0/0
ip add 45.1.1.5 255.255.255.0
no shut
exit
int l0
ip add 55.1.1.1 255.255.255.0
exit

router bgp 200
bgp router-id 55.1.1.1
neighbor 45.1.1.4 remote-as 100

network 55.1.1.0 mask 255.255.255.0
exit

R3:
router bgp 100
neighbor 11.1.1.1 route-reflector-client
neighbor 22.1.1.1 route-reflector-client
exit

R2:
router bgp 100
neighbor 11.1.1.1 route-reflector-client
exit

R1:
show ip bgp
show ip bgp 55.1.1.0

13.优选具有最低BGP邻居地址的路由

IBGP环境中,在前面12条原则不能选出最优BGP条目的情况下,优选来自用最低地址建立BGP连接的邻居的路由条目。这个地址是建立邻居用的IP地址,而不是接口IP地址。

上一篇:有道翻译——JS解密


下一篇:input 的属性autocomplete 默认为on