
Public routing table : BGP
Destinations : 3 Routes : 3
BGP routing table status : <Active>
Destination/Mask Proto Pre Cost Flags NextHop Interface
Destinations : 4 Routes : 4
Public routing table : OSPF
Destinations : 14 Routes : 14
OSPF routing table status : <Active>
//R3的下一跳是35.5
3)MPLS 環境
标簽轉發
1.2 BGP的同步概念
同步的目的是為了在不做全互聯的前提下解決BGP路由黑洞
但本身是一種過時的技術(是以華為裝置無法開啟BGP同步)
同步是IBGP和IGP路由同步,如果沒有實作同步,那麼結果是路由不更新給eBGP
本身
此時iBGP得到了11.1.1.1的路由,但是IGP沒有得到,此時同步沒有完成,但是卻開啟了同步指令
router bgp 200
synchronization
結果是什麼?結果是由于該路由不是最優的,是以不會更新給eBGP鄰居R5!
1--(2--3--4)--5
2.BGP的路由提高(産生路由)
BGP的路由如何産生:
1)network指令,在bgp中不用于建立鄰居,隻是産生路由。BGP可以network其他協定産生的路由(OSPF、rip、isis、靜态、直連),這個位置有一個屬性:origin屬性為i;聚合方式也可以産生路由,起源屬性也是i
2)EGP形式,起源屬性為e
3)引入路由:import,起源屬性為?(incomplete)
3.聚合
3.1 自動聚合
僅僅在DV協定才存在
僅僅對引入的(import)路由有效
[R5]bgp 345
[R5-bgp]
[R5-bgp]su
[R5-bgp]summary au
[R5-bgp]summary automatic
Info: Automatic summarization is valid only for the routes imported through the import-route command.
<R6>dis bgp routing-table 66.0.0.0
BGP local router ID : 0.0.6.6
Local AS number : 60
Paths: 1 available, 1 best, 1 select
BGP routing table entry information of 66.0.0.0/8:
From: 55.1.1.1 (10.1.35.5)
Route Duration: 00h02m01s
Relay IP Nexthop: 10.1.56.5
Relay IP Out-Interface: Serial2/0/0
Original nexthop: 55.1.1.1
Qos information : 0x0
AS-path 345, origin incomplete, pref-val 0, valid, external, best, select, active, pre 255, IGP cost 48
Aggregator: AS 345, Aggregator ID 10.1.35.5
3.2 增加了一種手動聚合方式
利用BGP的network指令,手工産生一條彙總後的靜态的彙總路由,然後再通告該路由
6.6.6.6 0000,0110
6.6.6.9 0000,1001
6.6.6.0 /28
[R6]ip route-static 6.6.6.0 28 NULL 0 //空接口,一個路由黑洞接口,所有到達6.6.6.0/28的資料都将被丢棄進空接口,否則将會造成帶寬的浪費
[R6]bgp 60
[R6-bgp]network 6.6.6.0 28 //僅僅通告彙總後的靜态路由,去掉明細路由,否則路由條目增多的
<R5>display bgp routing-table 6.6.6.0
BGP local router ID : 10.1.35.5
Local AS number : 345
BGP routing table entry information of 6.6.6.0/28:
From: 66.1.1.1 (0.0.6.6)
Route Duration: 00h06m34s
Relay IP Nexthop: 10.1.56.6
Original nexthop: 66.1.1.1
AS-path 60, origin igp, MED 0, pref-val 0, valid, external, best, select, active, pre 255, IGP cost 48
Advertised to such 2 peers:
44.1.1.1
33.1.1.1
3.3 專門的AGGREGATE
聚合的前提是BGP表中存在明細路由
3.3.1 直接實施,沒有任何參數
[R6-bgp]aggregate 6.6.6.0 28 //會生成一條聚合路由,但并不會抑制明細路由
<R5>dis bgp routing-table
BGP Local router ID is 10.1.35.5
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 21
Network NextHop MED LocPrf PrefVal Path/Ogn
>i 2.2.2.2/32 44.1.1.1 0 100 0 20i
> 5.5.5.5/32 0.0.0.0 0 0 i
> 6.6.6.0/28 66.1.1.1 0 60i
> 6.6.6.6/32 66.1.1.1 0 0 60i
*> 6.6.6.9/32 66.1.1.1 0 0 60i
3.3.2 抑制明細路由,僅僅向鄰居公告彙總
[R6-bgp]aggregate 6.6.6.0 28 detail-suppressed
Total Number of Routes: 19
> 10.1.1.0/24 0.0.0.0 0 0 ?
[R6-bgp]dis bgp rou
BGP Local router ID is 0.0.6.6
Total Number of Routes: 20
> 2.2.2.2/32 55.1.1.1 0 345 20i
> 5.5.5.5/32 55.1.1.1 0 0 345i
*> 6.6.6.0/28 127.0.0.1 0 i
s> 6.6.6.6/32 0.0.0.0 0 0 i
s> 6.6.6.9/32 0.0.0.0 0 0 i //s代表被抑制的,即沒有更新給鄰居的路由
R5聚合後
<R2>dis bgp routing-table 6.6.6.0
BGP local router ID : 10.1.24.2
Local AS number : 20
From: 10.1.24.4 (4.4.4.4)
Route Duration: 00h00m09s
Direct Out-interface: GigabitEthernet0/0/2
Original nexthop: 10.1.24.4
AS-path 345, origin igp, pref-val 0, valid, external, best, select, active, pre 255
Aggregator: AS 345, Aggregator ID 10.1.35.5, Atomic-aggregate //在AS345的R5聚合後丢失了as屬性或者團體屬性
3.3.3
關于聚合之後的屬性可能會改變
eBGP的防環:如果在收到的bgp的as-path屬性中包含和自身相同的As号碼,則丢棄該路由
[R5-bgp]aggregate 6.6.6.0 255.255.255.240 detail-suppressed as-set //聚合後依舊攜帶原有的as集合的參數,避免環路的發生以及次優的轉發路徑
Jan 13 2018 14:46:27.729.1-08:00 R6 RM/6/RMDEBUG:
BGP.Public: 55.1.1.1 MSG ignored : Looping in ASPATH value,
while recv UPDATE .
<R6>
Jan 13 2018 14:46:27.729.2-08:00 R6 RM/6/RMDEBUG:
BGP: routes in update message need to be processed as withdrawn message due to reason mentioned above.
Jan 13 2018 14:46:27.729.3-08:00 R6 RM/6/RMDEBUG:
BGP.Public: Recv UPDATE from 55.1.1.1 with following destinations :
需求:
在R5上完成聚合,不能看到明細路由,R2上得到的路由的as-path為345 60
Atomic_Aggregate:辨別發生了路徑資訊的丢失。生成的聚合路由帶Atomic-aggregate屬性,并且不能攜帶原具體路由的團體屬性。
Aggregator:辨別路徑資訊丢失發生的位置
3.3.4 抑制部分明細,放行彙總
[R6-bgp]aggregate 6.6.6.0 28 suppress-policy SUPPRESS //使用SUPPRESS這個路由政策來命中路由,被聚合中的suppress-policy調用,命中的路由抑制,其他路由放行
!
acl number 2000
rule 5 permit source 6.6.6.9 0
route-policy SUPPRESS permit node 5
if-match acl 2000
[R6]dis bgp routing-table
> 6.6.6.0/28 127.0.0.1 0 i
> 6.6.6.6/32 0.0.0.0 0 0 i
s> 6.6.6.9/32 0.0.0.0 0 0 i //被抑制在本地的路由
3.3.4
聚合後的起源屬性是?
[R6-bgp]aggregate 6.6.6.0 255.255.255.240 suppress-policy SUPPRESS attribute-policy ATTRIBUTE //對聚合後的路由修改起源屬性為egp
route-policy ATTRIBUTE permit node 10
apply origin egp 123
驗證結果:
> 6.6.6.0/28 66.1.1.1 0 60 123e //成功
聚合後并不能改變所有屬性,常見可以修改的屬性:起源和團體屬性
——————————————————————————————
SW1和R3建立ebgp鄰居,同時聚合一條6.0.0.0的路由
[R4-route-policy]dis cu conf bgp
[V200R003C00]
#
bgp 345
peer 10.1.24.2 as-number 20
peer 33.1.1.1 as-number 345
peer 55.1.1.1 as-number 345
peer 55.1.1.1 connect-interface LoopBack0
ipv4-family unicast
undo synchronization
aggregate 6.0.0.0 255.0.0.0 as-set detail-suppressed origin-policy ORIGIN //可以更加明晰的表明某些路由起源自哪些AS
route-policy ORIGIN permit node 10
if-match acl 2000
[R4-route-policy]dis acl all
Total quantity of nonempty ACL number is 2
Basic ACL 2000, 2 rules
Acl's step is 5
rule 5 permit source 6.6.6.10 0 (1 matches)
rule 10 deny (2 matches)
<R2>dis bgp routing-table
BGP Local router ID is 10.1.24.2
> 2.2.2.2/32 0.0.0.0 0 0 i
> 5.5.5.5/32 10.1.24.4 0 345i
> 6.0.0.0 10.1.24.4 0 345 30i
> 6.6.6.0/28 10.1.24.4 0 345 60 123e
*> 6.6.6.6/32 10.1.24.4 0 345 60i
4.RR和聯邦
應用場景都是管理大型BGP域的重要的技術,設計理念不同:RR是大面積的修改了iBGP的防環規則;聯邦依舊遵循iBGP的防環規則
4.1 實施和RR的規則
角色:1)RR 2)RR的用戶端 3)非用戶端
peer 10.1.30.10 as-number 30
peer 44.1.1.1 as-number 345
peer 44.1.1.1 connect-interface LoopBack0
peer 10.1.30.10 enable
peer 44.1.1.1 enable
peer 44.1.1.1 reflect-client //指定R4和R5為RR的用戶端,意味着R3成為RR
peer 55.1.1.1 enable
peer 55.1.1.1 reflect-client
[R5-bgp]un peer 44.1.1.1 //不在需要全部互聯
4.2 RR環境下的防環規則
兩個新的屬性:起源者Originator和簇ID,Cluster list
切記:非非(非用戶端之間)不傳
1)從非用戶端收到的路由會更新給用戶端和ebgp鄰居
[R3]dis bgp routing-table 6.6.6.6
BGP local router ID : 10.1.35.3
BGP routing table entry information of 6.6.6.6/32:
Route Duration: 00h09m31s
Relay IP Nexthop: 10.1.35.5
Relay IP Out-Interface: GigabitEthernet0/0/0
AS-path 60, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, best, select, active, pre 255, IGP cost 48
10.1.30.10
44.1.1.1 //更新給用戶端
2)從用戶端收到的路由會更新給所有的鄰居(用戶端和非用戶端、eBGP,不反射回該用戶端)
BGP routing table entry information of 2.2.2.2/32:
RR-client route.
From: 44.1.1.1 (4.4.4.4)
Route Duration: 00h10m16s
Original nexthop: 44.1.1.1
AS-path 20, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, best, select, active, pre 255, IGP cost 144
10.1.30.10 //更新給ebgp
55.1.1.1 //更新給非用戶端
4.3 階層化的RR
5.團體屬性
本文轉自EnderJoe 51CTO部落格,原文連結:http://blog.51cto.com/enderjoe/2060601