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值。即只能在路由器的入方向做修改。
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在選路過程中起作用。
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條目。
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地址。