BGP
阿新 • • 發佈:2020-09-12
一、背景
1、介紹
IGP--內部閘道器協議:RGP、eigrp、ospf、isis
EGP--外部閘道器協議:EGP、BGP
small:rip
big:eigrp
large:ospf/isis
huge:egp/bgp
2、術語
2.1、AS
自治系統:一組被統一管理的路由器(可以說一個運營商是一個自治系統,或有多個自治系統)
一個AS相當於一個ZSP
範圍:1-65535
-
共有:1-64511
-
私有:64512-65535
2.2、對等體(鄰居)
ibgp bear:內部鄰居
二、基本特性
- RGP、BGP是在應用層,BGP基於TCP179埠、rip基於udp520
- ospf、eigrp是在傳輸層
- isis是在網路層
2、分類
無類:ripv2、eigrp、isis、ospf、bgp
---無類:VLSM、CIDR
3、執行特徵
高階距離向量或者又叫高階路徑向量
4、選路原則
BGP按照如下項序選擇一條沒有環路並且可用的路由:
- 權重:Prefer highest weight (local to router).
5、最佳路徑
三、基本部署
1 [r1]=> 2 router bgp 100 3 no synchronization //關閉同步 4 bgp router-id 1.1.1.1 5 bgp log-neighbor-changes 6 network 1.1.1.1 mask 255.255.255.255 7 neighbor 12.1.1.2 remote-as 2345 8 no auto-summary 9 10 [r2]= > 11 router bgp 2345 12 no synchronization 13 bgp router-id 2.2.2.2 14 bgp log-neighbor-changes 15 network 2.2.2.2 mask 255.255.255.255 16 neighbor 12.1.1.1 remote-as 100 17 no auto-summary 18 19 router bgp 2345 20 neighbor 3.3.3.3 remqte-as 2345 21 neighbor 3.3.3.3 update-source Loopback1 22 23 [r3]= > 24 router bgp 2345 25 no synchronization 26 bgp router-id 3.3.3.3 27 bgp log-neighbor-changes 28 neighbor 2.2.2.2 remote as 2345 29 neighbor 2.2.2.2 update-source Loopback1 30 no auto-summary 31 32 //檢視bgp鄰居表 33 show ip bgp summary 34 show ip bgp neighbor 35 36 //檢視bgp資料庫/拓撲表 37 show ip bgp 38 39 //檢視bgp路由 40 show ip route bgp 41 42 //檢視bgp配置 43 show run | s r b
四、路由分組
四個資料包:
- open message
-
每60秒騷擾一下對方,告訴對方,我還活著
-
-
notification message
五、鄰居建立
ebgp基於loopback建立鄰居
1、通過靜態路由指向對方環回介面
2、基於靜態路由的連通性,建立bgp鄰居
3、開啟[ebgp 多跳 multi-hop]
程式碼:
1 [r1] 2 ip route 2.2.2.2 255.255.255.255 Serial3/0 3 4 router bgp 100 5 bgp router-id 1.1.1.1 ! 6 network 1.1.1.1 mask 255.255.255.255 7 neighbor 2.2.2.2 remote-as 2345 8 neighbor 2.2.2.2 ebgp-multihop 2 9 neighbor 2.2.2.2 update-source Loopback1 10 //r2與r1同,就只是network和neighbor不同
BGP鄰居建立條件:
ebpg傳送的包的ttl=1
更新源檢測
六、網路設計
解決路由黑洞:---重分發:
很麻煩、解決:---bgp同步:老闆本的bgp預設開啟同步:
路由要根據BGP學到,也要根據內部協議學的才可以