華為BGP選路規(guī)則詳解
在華為設(shè)備上,BGP選路規(guī)則是有十一條規(guī)則,那么這么多選路規(guī)則中是怎么使用的,以下以實驗方式對十一條選路規(guī)則一一分析做講解。
華為BGP十一條選路規(guī)則
1、優(yōu)選協(xié)議首選值(pref val) 最高的值
2、優(yōu)選本地優(yōu)先級(local_pref)最高的路由
3、依次優(yōu)選手動聚合路由,自動聚合路由,network命令引入的路由,import-route命令引入的路由,從對等體學(xué)到的路由
4、優(yōu)選AS_PATH最短的路由
5、依次優(yōu)選origin類型為IGP,EGP,incomplete的路由
6、對于來自同一AS的路由,優(yōu)選MED值最低的路由。
7、依次優(yōu)選EBGP路由、IBGP路由、local cross路由、remote cross路由。
8、優(yōu)選BGP下一跳IGP度量值metric最小的路由
9、優(yōu)選cluster_list最短的路由
10、優(yōu)選router ID最小的設(shè)備發(fā)布的路由(如果路由攜帶originator_ID屬性,選路過程中將比較originator_ID的大小,不再比較router ID,并優(yōu)選originator_ID最小的路由)
11、優(yōu)選從具有最小IP address的對等體學(xué)來的路由。
實驗拓?fù)鋱D:
從以上拓?fù)淇梢钥吹剑兴呐_路由器。AR1,AR2,AR3,AR4,其中R1,R2,R3屬于AS 123,R4屬于AS 4。
在R4上發(fā)布一條路由,4.4.4.4到BGP中,在R1上可以學(xué)到兩條4.4.4.4的BGP路由
從上面可以看到學(xué)到的兩條BGP路由,下一跳分別是R2和R3,根據(jù)BGP路由選路規(guī)則中的第十條,優(yōu)選router-id最小的設(shè)備發(fā)布的路由,優(yōu)選了R2。
選路規(guī)則第一條:
preferred-value
preferred-value主要控制怎么離開本設(shè)備,Preferred-value是BGP協(xié)議的私有屬性,該命令只對BGP路由生效。Preferred-value是BGP選路規(guī)則中的weight值,不是RFC規(guī)定的標(biāo)準(zhǔn)屬性,所以該命令僅在本地生效,在BGP的出口策略中不生效。
實驗?zāi)康模?/p>
使用preferred-value修改R1前往R4時優(yōu)選R3(控制流量怎么離開本設(shè)備)
配置命令:
#?配置路由策略 route-policy?p_v?permit?node?10? ?apply?preferred-value?1 # #?BGP視圖下引用策略,該命令可以理解收到R3發(fā)過來的路由,調(diào)用路由策略p_v,在策略里面修改preferred-value為1? bgp?123 ??peer?3.3.3.3?route-policy?p_v?import #?使用命令查看BGP路由,發(fā)現(xiàn)4.4.4.4路由的下一跳變?yōu)镽3了,prefval值等于1.說明修改成功,也對路由有了影響。 [R1-bgp]display?bgp?routing-table? ?BGP?Local?router?ID?is?1.1.1.1? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?2 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>i??4.4.4.4/32?????????3.3.3.3?????????0??????????100????????1??????4i ?*?i?????????????????????2.2.2.2?????????0??????????100????????0??????4i
驗證查看:
選路規(guī)則第二條:
本地優(yōu)先級表明路由器BGP路由本地優(yōu)先級,用于判斷怎么離開本AS的最佳路由,默認(rèn)值是100,越大越優(yōu)。
local-preference 屬性只能在IBGP鄰居之間傳遞,對于IBGP鄰居可以配在出方向或者入方向都可以,對于EBGP鄰居只能用在入方向上。
實驗?zāi)康?
通過修改local-preference屬性控制AS 123訪問AS 4都優(yōu)先走R3出去。
配置命令:
#?第一種方法,通過修改從EBGP收到的路由中的local-preference屬性實現(xiàn),其中的原理是從EBGP鄰居學(xué)習(xí)到的路由會通告給IBGP鄰居,在收到這個路由器上對該路由進(jìn)行修改local-preference屬性,那么通告給IBGP鄰居的路由屬性則是修改屬性后的路由。 #?在R3配置路由策略 route-policy?l_p?permit?node?10? ?apply?local-preference?101? # #?在R3的BGP下調(diào)用策略, bgp?123 ??peer?10.1.34.4?route-policy?l_p?import # #?查看R1路由表,可以看到優(yōu)選了R3去往R4,其中l(wèi)ocprf是101display?bgp?routing-table? ?BGP?Local?router?ID?is?1.1.1.1? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?2 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>i??4.4.4.4/32?????????3.3.3.3?????????0??????????101????????0??????4i ?*?i?????????????????????2.2.2.2?????????0??????????100????????0??????4i #?查看R2路由表 display?bgp?routing-table? ?BGP?Local?router?ID?is?2.2.2.2? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?1 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>???4.4.4.4/32?????????10.1.24.4???????0?????????????????????0??????4i #?從R2路由表中看到,R2只有一條路由,這是因為IBGP鄰居從IBGP鄰居學(xué)到的路由不會在通告給IBGP鄰居,可以理解為R3把R4的路由通告給R1后,然后R1收到后,并不會把該路由通告給R2,而R2通告給R1的路由也如此,所以在R2上和R3上都只存在一條R4的路由。 #?可以通過把R1配置為路由反射器,使R2也可以學(xué)到R3通告的路由。 bgp?123 ??peer?2.2.2.2?reflect-client ??peer?3.3.3.3?reflect-client # #?配置完路由反射后再次查看R2的路由表 display?bgp?routing-table? ?BGP?Local?router?ID?is?2.2.2.2? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?2 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>i??4.4.4.4/32?????????3.3.3.3?????????0??????????101????????0??????4i ?*???????????????????????10.1.24.4???????0?????????????????????0??????4i #?可以看到存在兩條路由,并且去往4.4.4.4的下一跳是R3,從而實現(xiàn)通過local-preference實現(xiàn)控制AS123去往AS4的選路。 #?第二種方式,在IBGP鄰居配置local-preference對AS的路由控制,實現(xiàn)原理通過在R3上修改R3向IBGP鄰居發(fā)送的路由屬性從而實現(xiàn),在IBGP鄰居的出方向調(diào)用路由策略。 #?在R3的BGP下調(diào)用路由策略 bgp?123 ??peer?1.1.1.1?route-policy?l_p?export #?配置完成后查看R1的BGP路由表和R2的BGP路由表 display?bgp?routing-table? ?BGP?Local?router?ID?is?1.1.1.1? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?1 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>i??4.4.4.4/32?????????3.3.3.3?????????0??????????101????????0??????4i display?bgp?routing-table? ?BGP?Local?router?ID?is?2.2.2.2? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?2 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>i??4.4.4.4/32?????????3.3.3.3?????????0??????????101????????0??????4i ?*???????????????????????10.1.24.4???????0?????????????????????0??????4i #?結(jié)果是跟第一種方式一樣的 #?第三種方式,在IBGP鄰居的入方向調(diào)用路由策略,需要在R1接收R3路由的入方向調(diào)用策略,實現(xiàn)原理是R1在收到R3路由的時候,對收到的路由修改local-perference值進(jìn)行影響路喲選路。 #?在R1上配置路由策略 route-policy?l_p?permit?node?10? ?apply?local-preference?101? #?在R1的BGP下調(diào)用路由策略 bgp?123 ??peer?3.3.3.3?route-policy?l_p?import #?查看路由表 display?bgp?routing-table? ?BGP?Local?router?ID?is?1.1.1.1? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?1 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>i??4.4.4.4/32?????????3.3.3.3?????????0??????????101????????0??????4i display?bgp?routing-table ?BGP?Local?router?ID?is?2.2.2.2? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?2 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>i??4.4.4.4/32?????????3.3.3.3?????????0??????????101????????0??????4i ?*???????????????????????10.1.24.4???????0?????????????????????0??????4i #?得到結(jié)論跟前二者一樣
?
?
選路規(guī)則第三條
依次優(yōu)選手動聚合路由,自動聚合路由,network命令引入的路由,import-route命令引入的路由,從對等體學(xué)到的路由,這個可以理解為自身路由器有多種方式產(chǎn)生一條路由,那么對自己而言那一條路由才會被自己優(yōu)選呢。
實驗?zāi)康模?/p>
以下以R3和R4來做一個實驗,R4通告給R3一條4.4.4.0/24的路由,R3自己import-route方式,network方式,手動聚合方式產(chǎn)生一條4.4.4.0/24的路由,進(jìn)行觀察R3會選擇那一條路由。
配置命令:
?
?
#?首先看到R3上學(xué)到了R4發(fā)送的一條4.4.4.0/24的路由 [R3]display?bgp?routing-table ?BGP?Local?router?ID?is?3.3.3.3? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?1 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>???4.4.4.0/24?????????10.1.34.4???????0?????????????????????0??????4? [R3] #?R3?通過import-route方式產(chǎn)生一條4.4.4.0/24的路由 ip?route-static?4.4.4.0?255.255.255.0?NULL0 #?BGP引入路由 bgp?123 ??import-route?static # [R3-bgp]display?bgp?routing-table ?BGP?Local?router?ID?is?3.3.3.3? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?2 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>???4.4.4.0/24?????????0.0.0.0?????????0?????????????????????0??????? ?*???????????????????????10.1.34.4???????0?????????????????????0??????4? [R3-bgp] #?查看R3路由表可以看到優(yōu)選了import-route的路由 #?然后R3在通過network產(chǎn)生一條4.4.4.0/24的路由,在BGP下宣告4.4.4.0/24的路由 bgp?123 ??network?4.4.4.0?255.255.255.0? #?查看R3的路由表 [R3]display?bgp?routing-table ?BGP?Local?router?ID?is?3.3.3.3? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?3 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>???4.4.4.0/24?????????0.0.0.0?????????0?????????????????????0??????i ?*???????????????????????0.0.0.0?????????0?????????????????????0??????? ?*???????????????????????10.1.34.4???????0?????????????????????0??????4? [R3] #?可以看到優(yōu)選了network產(chǎn)生的路由 #?然后R3在通過手動聚合產(chǎn)生一條4.4.4.0/24的路由 bgp?123 ??aggregate?4.4.4.0?255.255.255.0? #? #?查看R3上的路由表 [R3-bgp]display?bgp?routing-table ?BGP?Local?router?ID?is?3.3.3.3? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?5 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>???4.4.4.0/24?????????127.0.0.1?????????????????????????????0??????i ?*???????????????????????0.0.0.0?????????0?????????????????????0??????i ?*???????????????????????0.0.0.0?????????0?????????????????????0??????? ?*???????????????????????10.1.34.4???????0?????????????????????0??????4? ?*>???4.4.4.4/32?????????10.1.34.4???????0?????????????????????0??????4i [R3-bgp] #?根據(jù)以上路由表可以看到優(yōu)選了手動聚合的路由,下一跳為127.0.0.1的這條為手動聚合的路由。
?
?
選路規(guī)則第四條
優(yōu)選AS_PATH最短的路由,該規(guī)則比較容易理解,從字面意思上來看,就是攜帶的as_path最短的路由最優(yōu)。從原理上來講,可以理解為as_path越多,就是所跨越的AS域越多,路就越遠(yuǎn)就沒那么優(yōu)。
AS_Path屬性是BGP的私有屬性,記錄了某條路由從本地到目的地址所要經(jīng)過的所有AS編號,通過應(yīng)用AS_Path屬性可以控制路由選擇及防止路由環(huán)路。當(dāng)?shù)竭_(dá)同一目的地存在多條路由時,BGP會比較路由的AS_Path屬性,AS_Path列表較短的路由將被認(rèn)為是最佳路由。
實驗?zāi)康模?/p>
通過在R2和R3上修改AS_PATH長度,來影響R1的選路。
配置命令:
?
?
#?在修改as_path長度前進(jìn)行查看R1的BGP路由表display?bgp?routing-table ?BGP?Local?router?ID?is?1.1.1.1? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?4 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>i??4.4.4.0/24?????????2.2.2.2?????????0??????????100????????0??????4? ?*?i?????????????????????3.3.3.3?????????0??????????100????????0??????4? ?*>i??4.4.4.4/32?????????2.2.2.2?????????0??????????100????????0??????4i ?*?i?????????????????????3.3.3.3?????????0??????????100????????0??????4i #?在R2配置as-path長度,首先使用路由策略定義好要增加的AS-PATH長度 route-policy?as?permit?node?10? ?apply?as-path?100?200?300?additive #?然后在BGP接受EBGP路由時調(diào)用該策略 bgp?123 peer?10.1.24.4?route-policy?as?import #? #?配置完成后查看R1的路由表 display?bgp?routing-table ?BGP?Local?router?ID?is?1.1.1.1? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?2 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>i??4.4.4.0/24?????????3.3.3.3?????????0??????????100????????0??????4? ?*>i??4.4.4.4/32?????????3.3.3.3?????????0??????????100????????0??????4i #?R1優(yōu)選了R3出去,然后查看R2自身的BGP路由表 [R2-bgp]display?bgp?routing-table? ?BGP?Local?router?ID?is?2.2.2.2? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?4 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>i??4.4.4.0/24?????????3.3.3.3?????????0??????????100????????0??????4? ?*???????????????????????10.1.24.4???????0?????????????????????0??????100?200?30 0?4? ?*>i??4.4.4.4/32?????????3.3.3.3?????????0??????????100????????0??????4i ?*???????????????????????10.1.24.4???????0?????????????????????0??????100?200?30 0?4i [R2-bgp] #可以看到R2自身修改了后,也優(yōu)先選擇R3做為下一跳了
?
?
選路規(guī)則第五條
依次優(yōu)選origin類型為IGP,EGP,incomplete的路由。
origin標(biāo)識BGP路由的來源,記錄了一條路由怎么成為BGP路由的,network產(chǎn)生的BGP路由標(biāo)識為IGP,import-route 產(chǎn)生的BGP路由標(biāo)識為incomplete在路由表中顯示為?號的路由。EGP為運行EGP協(xié)議產(chǎn)生的路由,BGP和EBGP不是同一個東西,在目前網(wǎng)絡(luò)中基本見不到EGP的存在了。
該選路規(guī)則可以理解為network進(jìn)BGP的路由優(yōu)于引入進(jìn)BGP的路由。
實驗?zāi)康模?/p>
R1上存在著R2通告的路由和R3通告的路由,通過router-id優(yōu)選了R2通告的路由,實現(xiàn)通過修改起源屬性影響R1的選路。
配置命令:
?
?
#?先查看R1的BGP路由表display?bgp?routing-table ?BGP?Local?router?ID?is?10.1.12.1? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?2 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>i??4.4.4.4/32?????????2.2.2.2?????????0??????????100????????0??????4i ?*?i?????????????????????3.3.3.3?????????0??????????100????????0??????4i #?可以看到目前學(xué)到的兩條路由起源屬性都是IGP的,通過在R2上修改起源屬性為EGP的,進(jìn)而影響選路,并且證實I>E #?配置R2路由策略 route-policy?ogn?permit?node?10? ?apply?origin?egp?10 #?BGP下調(diào)用策略,因為origin屬性是公認(rèn)必遵屬性,所有路由器都可以識別的屬性,所以可以通過如方向調(diào)用,也可以通過出方向調(diào)用。 bgp?123 ??peer?10.1.24.4?route-policy?ogn?import #?配置完成查看R2的路由表,檢查結(jié)果 [R2-bgp]display?bgp?routing-table? ?BGP?Local?router?ID?is?10.1.12.2? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?2 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>i??4.4.4.4/32?????????3.3.3.3?????????0??????????100????????0??????4i ?*???????????????????????10.1.24.4???????0?????????????????????0??????4e [R2-bgp] #?從路由表可以看到R2優(yōu)選了從R3學(xué)到的IGP路由,而沒有優(yōu)選自己的EGP路由 #?在R3上修改origin屬性為incomplete,證實E>? route-policy?origin?permit?node?10? ?apply?origin?incomplete #?在R3的BGP下調(diào)用策略,在R1鄰居上調(diào)用策略,使用出方向的方法,這樣不會修改自身路由器所學(xué)到路由,只會對通告給R1的路由有影響。 #?查看R3的BGP路由表 [R3-bgp]display?bgp?routing-table ?BGP?Local?router?ID?is?10.1.13.3? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?2 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>???4.4.4.4/32?????????10.1.34.4???????0?????????????????????0??????4i ?*?i?????????????????????2.2.2.2?????????0??????????100????????0??????4e [R3-bgp] #?從上述路由表可以看到自己通過R4學(xué)到的路由是IGP的,優(yōu)于EGP所以優(yōu)選了從R4學(xué)到的路由,然后在看R1上的路由表 display?bgp?routing-table? ?BGP?Local?router?ID?is?10.1.12.1? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?2 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>i??4.4.4.4/32?????????2.2.2.2?????????0??????????100????????0??????4e ?*?i?????????????????????3.3.3.3?????????0??????????100????????0??????4? #?從上述路由表可以看到R1上從R2學(xué)到的優(yōu)選了,而沒有優(yōu)選從R3學(xué)到的,是因為R3學(xué)到的路由是incomplete。從而證實了I>E>?
?
?
選路規(guī)則第六條
對于來自同一AS的路由,優(yōu)選MED值最低的路由。
該條選路規(guī)則跟第二條選路規(guī)則剛好是相反的,local-preference是控制流量怎么出本AS的,而MED是控制流量怎么回本AS的。
MED的傳遞范圍,只能在兩個AS之間攜帶,不能在到第三個AS。比如AS 10 通告給AS 20攜帶了MED,在AS 20是會攜帶MED屬性的,而當(dāng)AS20通告給AS 30時,就不會在攜帶MED屬性。
MED傳遞規(guī)則:
從EBGP鄰居學(xué)習(xí)來的路由,傳遞給自己IBGP鄰居的時候MED可以傳遞
從EBGP鄰居學(xué)習(xí)來的路由,傳遞給自己的EBGP鄰居的時候,MED不攜帶
從IBGP鄰居學(xué)習(xí)來的路由,傳遞給自己EBGP鄰居的時候,MED不攜帶
MED功能:
將通告的BGP路由的本AS內(nèi)的IGP開銷通過MED值攜帶出去,讓對端的AS知道我本地這條路由IGP的開銷
default med:
可以在BGP下直接配置default med,但是該命令只對引入的路由和聚合路由生效,而且只會傳遞給自己的EBGP鄰居,不會傳遞給自己的IBGP鄰居。
限制:
默認(rèn)情況下路由器只有收到來源于同一個AS鄰居的BGP路由才會比較MED值,如果這條路由分別來自于不同的AS是不會比較MED值的。如果需要比較來自不同AS的MED值,需要配置命令compare-different-as-med
實驗?zāi)康?/p>
在R2訪問R1的開銷為50,R3訪問R1的開銷為10,在R4訪問R1的時候優(yōu)選走到R3去訪問。
配置命令:
?
?
#?先看一下R4訪問R1的默認(rèn)選舉display?bgp?routing-table? ?BGP?Local?router?ID?is?10.1.24.4? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?3 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>???4.4.4.4/32?????????0.0.0.0?????????0?????????????????????0??????i ?*>???10.10.10.10/32?????10.1.24.2?????????????????????????????0??????123i ?*???????????????????????10.1.34.3?????????????????????????????0??????123i #?從路由表可以看出,R4訪問R1是通過router-id比較出優(yōu)先走R2的,然后通過在R2和R3上配置使得R4通過MED優(yōu)選R3 #?配置R2的路由策略,并且修改IGP的開銷 route-policy?med?permit?node?10? ?apply?cost-type?internal? # interface?GigabitEthernet0/0/0 ?isis?cost?50 #BGP下調(diào)用策略 bgp?123 ??peer?10.1.24.4?route-policy?med?export # #?R3配置路由策略,并且調(diào)用策略 route-policy?med?permit?node?10? ?apply?cost-type?internal? # bgp?123 ??peer?10.1.34.4?route-policy?med?export #配置完成,在R4上再次查看前往R1的選路 display?bgp?routing-table? ?BGP?Local?router?ID?is?10.1.24.4? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?3 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>???4.4.4.4/32?????????0.0.0.0?????????0?????????????????????0??????i ?*>???10.10.10.10/32?????10.1.34.3?????????????????????????????0??????123i ?*???????????????????????10.1.24.2???????50????????????????????0??????123i #?根據(jù)路由表可以看到,R4選擇了R3做為優(yōu)選下一跳設(shè)備,使用該方法在沒有對AS4進(jìn)行配置時,從而影響了AS4的選路。
?
?
選路規(guī)則第七條
依次優(yōu)選EBGP路由、IBGP路由、local cross路由、remote cross路由。
該選路規(guī)則的理解為,從EBGP鄰居對等體學(xué)到的路由優(yōu)于從IBGP鄰居對等體學(xué)到的路由。
實驗?zāi)康模?/p>
在R3上存在著兩條4.4.4.4/32的路由,分別是從R4學(xué)到的和R1反射的路由。R4學(xué)到的路由為EBGP類型,R1反射的路由為IBGP路由,通過觀察路由表看對比情況
配置命令:
?
?
#?查看R3的BGP路由表 [R3-bgp]display?bgp?routing-table ?BGP?Local?router?ID?is?10.1.13.3? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?3 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>???4.4.4.4/32?????????10.1.34.4???????0?????????????????????0??????4i ?*?i?????????????????????2.2.2.2?????????0??????????100????????0??????4i ?*>i??10.10.10.10/32?????1.1.1.1?????????0??????????100????????0??????i [R3-bgp] #?可以看到優(yōu)選了下一跳為R4的路由表,然后看詳細(xì)信息,查看下一跳為R2的路由為什么沒被優(yōu)選 [R3-bgp]display?bgp?routing-table?4.4.4.4 ?BGP?local?router?ID?:?10.1.13.3 ?Local?AS?number?:?123 ?Paths:???2?available,?1?best,?1?select ?BGP?routing?table?entry?information?of?4.4.4.4/32: ?From:?10.1.34.4?(10.1.24.4) ?Route?Duration:?04h43m10s?? ?Direct?Out-interface:?GigabitEthernet0/0/1 ?Original?nexthop:?10.1.34.4 ?Qos?information?:?0x0 ?AS-path?4,?origin?igp,?MED?0,?pref-val?0,?valid,?external,?best,?select,?active ,?pre?255 ?Advertised?to?such?1?peers: ????1.1.1.1 ?BGP?routing?table?entry?information?of?4.4.4.4/32: ?From:?1.1.1.1?(10.1.12.1) ?Route?Duration:?03h21m11s?? ?Relay?IP?Nexthop:?10.1.13.1 ?Relay?IP?Out-Interface:?GigabitEthernet0/0/0 ?Original?nexthop:?2.2.2.2 ?Qos?information?:?0x0 ?AS-path?4,?origin?igp,?MED?0,?localpref?100,?pref-val?0,?valid,?internal,?pre?2 55,?IGP?cost?20,?not?preferred?for?peer?type ?Originator:??10.1.12.2 ?Cluster?list:?10.1.12.1 ?Not?advertised?to?any?peer?yet ?#?通過以上回顯可以看到?jīng)]被優(yōu)選的原因是??not?preferred?for?peer?type?不是對等體類型首選,可以理解為對等體類型就是EBGP和IBGP
?
?
選路規(guī)則第八條
優(yōu)選BGP下一跳IGP度量值metric最小的路由
可以理解為BGP下一跳IGP的開銷值小的優(yōu)選,比如有兩條路由,不同的下一跳,其中preferred-value都為0,local-prefreence都為100,都是通過對等體學(xué)到的,AS_PATH長度一致,起源屬性都是IGP,MED值都為空,都是通過IBGP鄰居學(xué)到的,前七項都無法比較出這條路由的優(yōu)選,然后就會比較第八項。根據(jù)上述的描述,有不同的下一跳,那么就會存在著到達(dá)這個下一跳的路由,而下一跳路由是通過IGP學(xué)到的,就存在著IGP的開銷,比如R1到R2的開銷是20,R1到R3的開銷是10,那么就會優(yōu)選R3。
實驗?zāi)康模?/p>
R1訪問R4優(yōu)選了R2,通過修改IGP的開銷值影響R1訪問R4優(yōu)選R3
配置命令:
?
?
#?查看R1路由表,在沒有做修改前優(yōu)先選擇的R2下一跳display?bgp??routing-table? ?BGP?Local?router?ID?is?10.1.12.1? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?3 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>i??4.4.4.4/32?????????2.2.2.2?????????0??????????100????????0??????4i ?*?i?????????????????????3.3.3.3?????????0??????????100????????0??????4i ?*>???10.10.10.10/32?????0.0.0.0?????????0?????????????????????0??????i #?在R1上修改R1跟R2的互聯(lián)的接口,修改ISIS開銷值為20,增加開銷 interface?GigabitEthernet0/0/0 ?isis?cost?20 #?查看R1的路由表 [R1]display?bgp?routing-table ?BGP?Local?router?ID?is?10.1.12.1? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?3 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>i??4.4.4.4/32?????????3.3.3.3?????????0??????????100????????0??????4i ?*?i?????????????????????2.2.2.2?????????0??????????100????????0??????4i ?*>???10.10.10.10/32?????0.0.0.0?????????0?????????????????????0??????i [R1] #?優(yōu)選了R3做為下一跳設(shè)備
?
?
負(fù)載分擔(dān)
在BGP選路規(guī)則中,當(dāng)前八條都無法選擇出最優(yōu)路由的時候,就可以開啟BGP的負(fù)載分擔(dān)。
需要注意事項:
默認(rèn)在前八條中的第四條AS_PATH在該場景中需要一樣,當(dāng)PA_PATH長度是一樣,但是屬于不同AS是無法進(jìn)行負(fù)載分擔(dān)的。當(dāng)在這個場景下,需要實現(xiàn)負(fù)載分擔(dān)可以通過命令忽略AS_PATH檢查,可以在BGP下配置load-balancing as-path-ignore命令忽略AS_PATH檢查。
實驗?zāi)康模?/p>
默認(rèn)BGP是不開啟負(fù)載分擔(dān)的,需要手動去開啟BGP的負(fù)載分擔(dān)。通過在R1上配置負(fù)載分擔(dān),實現(xiàn)R1訪問R4的負(fù)載分擔(dān)。
?
?
#?先查看沒有修改配置的R1到R4的路由表 [R1-bgp]display?ip?routing-table?4.4.4.4? Route?Flags:?R?-?relay,?D?-?download?to?fib ------------------------------------------------------------------------------ Routing?Table?:?Public Summary?Count?:?1 Destination/Mask????Proto???Pre??Cost??????Flags?NextHop?????????Interface ????????4.4.4.4/32??IBGP????255??0??????????RD???2.2.2.2?????????GigabitEthernet 0/0/0 [R1-bgp] #?通過路由表看到只有一條路由 #?可以通過在R1的BGP下配置命令開啟負(fù)載分擔(dān) bgp?123 ??maximum?load-balancing?8 #?再次查看R1的IP路由表 [R1-bgp]display?ip?routing-table?4.4.4.4 Route?Flags:?R?-?relay,?D?-?download?to?fib ------------------------------------------------------------------------------ Routing?Table?:?Public Summary?Count?:?2 Destination/Mask????Proto???Pre??Cost??????Flags?NextHop?????????Interface ????????4.4.4.4/32??IBGP????255??0??????????RD???2.2.2.2?????????GigabitEthernet 0/0/0 ????????????????????IBGP????255??0??????????RD???3.3.3.3?????????GigabitEthernet 0/0/1 [R1-bgp] #?從上面路由表可以看到去往R4有了兩個下一跳了,這是在IP路由表中的表現(xiàn),其原理就是BGP路由表在加載到IP路由表的時候,如果前面八條都沒有比較出來后,配置maximum?load-balancing命令后,就會把沒比較出來的也加載到IP路由表中去,但是在BGP路由表中還是一樣的會比較出一個最優(yōu)。查看BGP路由表時,可以看到依然只有一條是最優(yōu)的。 [R1-bgp]display?bgp?routing-table? ?BGP?Local?router?ID?is?10.1.12.1? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?3 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>i??4.4.4.4/32?????????2.2.2.2?????????0??????????100????????0??????4i ?*?i?????????????????????3.3.3.3?????????0??????????100????????0??????4i ?*>???10.10.10.10/32?????0.0.0.0?????????0?????????????????????0??????i [R1-bgp] #?通過第十條選路原則比較出的最優(yōu),而不會把兩條路由都標(biāo)識為最優(yōu)路由
?
?
選路規(guī)則第九條
優(yōu)選cluster_list最短的路由,該選路原則的意思跟字面意思是一樣的,在RR場景存在著一個屬性cluster_list屬性,這是一個列表類型,跟AS_PATH很像,每經(jīng)過一個RR就會增加一條cluster_list記錄
要模擬實現(xiàn)第九條選路場景需要對原有拓?fù)溥M(jìn)行一個修改,改成分級RR的場景
[外鏈圖片轉(zhuǎn)存失敗,源站可能有防盜鏈機(jī)制,建議將圖片保存下來直接上傳(img-QCkF1Od7-1681473046862)(華為BGP選路規(guī)則詳解.assets/image-20230413164802056.png)]
以上拓?fù)銻3做為ASBR收到R4的路由,通告給R5,R5做為頂級RR,R1和R2都做為R5的客戶端,R1也做為RR對R2進(jìn)行反射路由。
實驗?zāi)康模?/p>
通過實驗現(xiàn)象驗證第九條選路規(guī)則
配置命令:
?
?
#?根據(jù)以上描述進(jìn)行配置R5 bgp?123 ?peer?1.1.1.1?as-number?123? ?peer?1.1.1.1?connect-interface?LoopBack0 ?peer?2.2.2.2?as-number?123? ?peer?2.2.2.2?connect-interface?LoopBack0 ?peer?3.3.3.3?as-number?123? ?peer?3.3.3.3?connect-interface?LoopBack0 ?# ?ipv4-family?unicast ??undo?synchronization ??peer?1.1.1.1?enable ??peer?1.1.1.1?reflect-client ??peer?2.2.2.2?enable ??peer?2.2.2.2?reflect-client ??peer?3.3.3.3?enable # #R1配置 bgp?123 ?peer?2.2.2.2?as-number?123? ?peer?2.2.2.2?connect-interface?LoopBack0 ?peer?5.5.5.5?as-number?123? ?peer?5.5.5.5?connect-interface?LoopBack0 ?# ?ipv4-family?unicast ??undo?synchronization ??peer?2.2.2.2?enable ??peer?2.2.2.2?reflect-client ??peer?5.5.5.5?enable # #?完成配置查看R2的路由表display?bgp?routing-table? ?BGP?Local?router?ID?is?10.1.12.2? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?4 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>i??4.4.4.4/32?????????3.3.3.3?????????0??????????100????????0??????4i ?*?i?????????????????????3.3.3.3?????????0??????????100????????0??????4i ?*>i??10.10.10.10/32?????1.1.1.1?????????0??????????100????????0??????i ?*?i?????????????????????1.1.1.1?????????0??????????100????????0??????i #?通過上面可以看到有兩條下一跳為3.3.3.3的路由,但是看起來都一模一樣,看不出來區(qū)別,需要看詳細(xì)信息。使用命令查看詳細(xì)信息 display?bgp?routing-table?4.4.4.4? ?BGP?local?router?ID?:?10.1.12.2 ?Local?AS?number?:?123 ?Paths:???2?available,?1?best,?1?select ?BGP?routing?table?entry?information?of?4.4.4.4/32: ?From:?5.5.5.5?(5.5.5.5) ?Route?Duration:?00h08m35s?? ?Relay?IP?Nexthop:?10.1.25.5 ?Relay?IP?Out-Interface:?GigabitEthernet0/0/2 ?Original?nexthop:?3.3.3.3 ?Qos?information?:?0x0 ?AS-path?4,?origin?igp,?MED?0,?localpref?100,?pref-val?0,?valid,?internal,?best, ?select,?active,?pre?255,?IGP?cost?20 ?Originator:??10.1.13.3 ?Cluster?list:?5.5.5.5 ?Not?advertised?to?any?peer?yet ?BGP?routing?table?entry?information?of?4.4.4.4/32: ?From:?1.1.1.1?(10.1.12.1) ?Route?Duration:?00h11m07s?? ?Relay?IP?Nexthop:?10.1.25.5 ?Relay?IP?Out-Interface:?GigabitEthernet0/0/2 ?Original?nexthop:?3.3.3.3 ?Qos?information?:?0x0 ?AS-path?4,?origin?igp,?MED?0,?localpref?100,?pref-val?0,?valid,?internal,?pre?2 55,?IGP?cost?20,?not?preferred?for?Cluster?List ?Originator:??10.1.13.3 ?Cluster?list:?10.1.12.1,?5.5.5.5 ?Not?advertised?to?any?peer?yet #?根據(jù)以上命令回顯可以看到,在下方的回顯中?Cluster?list:?不一樣,而沒有優(yōu)選的原因為not?preferred?for?Cluster?List。
?
?
選路規(guī)則第十條
優(yōu)選router ID最小的設(shè)備發(fā)布的路由(如果路由攜帶originator_ID屬性,選路過程中將比較originator_ID的大小,不再比較router ID,并優(yōu)選originator_ID最小的路由)
要實現(xiàn)第十條選路原則,有兩種概念,一種是比較router id之前一直都是通過該方式的,還有一種是在經(jīng)過了RR后,存在著originator_ID屬性就不會在比較router-id,以下以一個更改后的拓?fù)鋪眢w現(xiàn)出originator_ID的比較。
實驗?zāi)康模?/p>
通過實驗表現(xiàn)出originator_ID選舉的現(xiàn)象
配置命令:
#?配置R1跟R6建立BGP鄰居,配置R5跟R6建立BGP鄰居,并且配置為反射客戶端 #?R6配置 bgp?123 ?peer?1.1.1.1?as-number?123? ?peer?1.1.1.1?connect-interface?LoopBack0 ?peer?5.5.5.5?as-number?123? ?peer?5.5.5.5?connect-interface?LoopBack0 ?# ?ipv4-family?unicast ??undo?synchronization ??peer?1.1.1.1?enable ??peer?5.5.5.5?enable # #?在R6上查看路由表 [R6-bgp]display?bgp?routing-table? ?BGP?Local?router?ID?is?6.6.6.6? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?2 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>i??4.4.4.4/32?????????2.2.2.2?????????0??????????100????????0??????4i ?*?i?????????????????????3.3.3.3?????????0??????????100????????0??????4i [R6-bgp] #?可以看到優(yōu)選了R2的,查看詳細(xì)信息 [R6-bgp]display?bgp?routing-table?4.4.4.4 ?BGP?local?router?ID?:?6.6.6.6 ?Local?AS?number?:?123 ?Paths:???2?available,?1?best,?1?select ?BGP?routing?table?entry?information?of?4.4.4.4/32: ?From:?1.1.1.1?(10.1.12.1) ?Route?Duration:?00h14m51s?? ?Relay?IP?Nexthop:?10.1.16.1 ?Relay?IP?Out-Interface:?GigabitEthernet0/0/0 ?Original?nexthop:?2.2.2.2 ?Qos?information?:?0x0 ?AS-path?4,?origin?igp,?MED?0,?localpref?100,?pref-val?0,?valid,?internal,?best, ?select,?active,?pre?255,?IGP?cost?20 ?Originator:??10.1.12.2 ?Cluster?list:?10.1.12.1 ?Not?advertised?to?any?peer?yet ?BGP?routing?table?entry?information?of?4.4.4.4/32: ?From:?5.5.5.5?(5.5.5.5) ?Route?Duration:?00h05m56s?? ?Relay?IP?Nexthop:?10.1.56.5 ?Relay?IP?Out-Interface:?GigabitEthernet0/0/1 ?Original?nexthop:?3.3.3.3 ?Qos?information?:?0x0 ?AS-path?4,?origin?igp,?MED?0,?localpref?100,?pref-val?0,?valid,?internal,?pre?2 55,?IGP?cost?20,?not?preferred?for?router?ID ?Originator:??10.1.13.3 ?Cluster?list:?5.5.5.5 ?Not?advertised?to?any?peer?yet [R6-bgp] #?查看詳細(xì)信息可以看到,兩條路由都攜帶了Originator屬性,但是都不一樣,從而比較了Originator屬性的大小。在存在Originator屬性的情況下,是不會比較router-id的。
選路規(guī)則第十一條
優(yōu)選從具有最小IP address的對等體學(xué)來的路由。
選路規(guī)則的最后一條是比較對等體的地址的,那么什么時候會用到第十一條比較呢?
實驗?zāi)康模?/p>
配置實驗,使得通過最后一條選路規(guī)則比較出最優(yōu)。需要對拓?fù)溆幸粋€改變
R3學(xué)到R4的路由,R5跟R1做為RR反射給R2,此時在R2的路由表中就會存在著兩條R4的路由。
配置命令:
#?配置R3,跟R1和R5建立鄰居 bgp?123 ?peer?1.1.1.1?as-number?123? ?peer?1.1.1.1?connect-interface?LoopBack0 ?peer?5.5.5.5?as-number?123? ?peer?5.5.5.5?connect-interface?LoopBack0 ?peer?10.1.34.4?as-number?4? ?# ?ipv4-family?unicast ??undo?synchronization ??peer?1.1.1.1?enable ??peer?1.1.1.1?next-hop-local? ??peer?5.5.5.5?enable ??peer?5.5.5.5?next-hop-local? ??peer?10.1.34.4?enable #?配置R5跟R2和R3建立鄰居,并且配置路由反射 bgp?123 ?peer?2.2.2.2?as-number?123? ?peer?2.2.2.2?connect-interface?LoopBack0 ?peer?3.3.3.3?as-number?123? ?peer?3.3.3.3?connect-interface?LoopBack0 ?# ?ipv4-family?unicast ??undo?synchronization ??peer?2.2.2.2?enable ??peer?2.2.2.2?reflect-client ??peer?3.3.3.3?enable ??peer?3.3.3.3?reflect-client #?配置R1,跟R5一樣 bgp?123 ?peer?2.2.2.2?as-number?123? ?peer?2.2.2.2?connect-interface?LoopBack0 ?peer?3.3.3.3?as-number?123? ?peer?3.3.3.3?connect-interface?LoopBack0 ?# ?ipv4-family?unicast ??undo?synchronization ??peer?2.2.2.2?enable ??peer?2.2.2.2?reflect-client ??peer?3.3.3.3?enable ??peer?3.3.3.3?reflect-client #?查看R2的路由表 [R2-bgp]display?bgp?routing-table ?BGP?Local?router?ID?is?10.1.12.2? ?Status?codes:?*?-?valid,?>?-?best,?d?-?damped, ???????????????h?-?history,??i?-?internal,?s?-?suppressed,?S?-?Stale ???????????????Origin?:?i?-?IGP,?e?-?EGP,???-?incomplete ?Total?Number?of?Routes:?2 ??????Network????????????NextHop????????MED????????LocPrf????PrefVal?Path/Ogn ?*>i??4.4.4.4/32?????????3.3.3.3?????????0??????????100????????0??????4i ?*?i?????????????????????3.3.3.3?????????0??????????100????????0??????4i [R2-bgp] #?可以看到存在著兩條R4的路由,然后通過查看詳細(xì)信息,看是什么原因下面那條沒被優(yōu)選的 [R2-bgp]display?bgp?routing-table?4.4.4.4 ?BGP?local?router?ID?:?10.1.12.2 ?Local?AS?number?:?123 ?Paths:???2?available,?1?best,?1?select ?BGP?routing?table?entry?information?of?4.4.4.4/32: ?From:?1.1.1.1?(10.1.12.1) ?Route?Duration:?00h01m11s?? ?Relay?IP?Nexthop:?10.1.12.1 ?Relay?IP?Out-Interface:?GigabitEthernet0/0/0 ?Original?nexthop:?3.3.3.3 ?Qos?information?:?0x0 ?AS-path?4,?origin?igp,?MED?0,?localpref?100,?pref-val?0,?valid,?internal,?best, ?select,?active,?pre?255,?IGP?cost?20 ?Originator:??10.1.13.3 ?Cluster?list:?10.1.12.1 ?Not?advertised?to?any?peer?yet ?BGP?routing?table?entry?information?of?4.4.4.4/32: ?From:?5.5.5.5?(5.5.5.5) ?Route?Duration:?00h08m18s?? ?Relay?IP?Nexthop:?10.1.12.1 ?Relay?IP?Out-Interface:?GigabitEthernet0/0/0 ?Original?nexthop:?3.3.3.3 ?Qos?information?:?0x0 ?AS-path?4,?origin?igp,?MED?0,?localpref?100,?pref-val?0,?valid,?internal,?pre?2 55,?IGP?cost?20,?not?preferred?for?peer?address ?Originator:??10.1.13.3 ?Cluster?list:?5.5.5.5 ?Not?advertised?to?any?peer?yet [R2-bgp]
查看詳細(xì)信息可以看到,是因為not preferred for peer address才沒有被優(yōu)選的,然后通過上面的信息可以看到在攜帶了Originator: 屬性的情況下,是沒有比較router-id的,而此時是要比較Originator,但是都一樣比較不出來,所以才比較到了具有最小IP address的對等體學(xué)來的路由。
審核編輯:黃飛
?
評論
查看更多