① BGP,怎麼配詳細的命令!
neighbor 192.168.2.1 next-hop-self
!-- This command assigns a next-hop value to 192.168.2.3 !-- for updates sent to 192.168.2.1 (the iBGP peer).
!
ip classless
ip route 192.168.0.0 255.255.0.0 Null0
MSFC Configuration on CAT2
CAT2 (enable)
CAT2 (enable) session 15
Trying Router-15...
Connected to Router-15.
Escape character is '^]'.
MSFC-CAT2>enable
MSFC-CAT2#show running-config
Building configuration...
Current configuration : 890 bytes
!
version 12.1
!
hostname MSFC-CAT2
!
boot system flash bootflash:c6msfc-jsv-mz.121-8b.E7
!
ip subnet-zero
!
!
rendancy
!-- This command enables rendancy.
high-availability
!-- This command enables high availability.
single-router-mode
!-- This command enables SRM.
!
interface Vlan10
ip address 192.168.1.3 255.255.255.0
!-- Interface Vlan10 connected to interface Vlan10 on CAT1 via the trunk.
!
interface Vlan20
ip address 192.168.2.1 255.255.255.0
!-- Interface Vlan20 connected to AS20.
!
router bgp 4
no synchronization
bgp log-neighbor-changes
network 192.168.0.0 mask 255.255.0.0
neighbor 192.168.2.2 remote-as 20
!-- This command establishes eBGP peering with AS20.
neighbor 192.168.2.3 remote-as 4
!-- This command establishes iBGP peering with interface Vlan20 on CAT1.
neighbor 192.168.2.3 next-hop-self
!-- This command assigns a next-hop value to 192.168.2.1 !-- for updates sent to 192.168.2.3 (the iBGP peer).
!
ip classless
ip route 192.168.0.0 255.255.0.0 Null0
Troubleshoot
Now that you've verified the high availability SRM configuration, you need to verify the BGP MSFC on CAT1 and CAT2. Use the show ip bgp summary command to verify the neighbor establishment. The output below confirms successful eBGP and iBGP peering with AS10 and the CAT2 MSFC respectively.
MSFC-CAT1#show ip bgp summary
BGP router identifier 192.168.2.3, local AS number 4
BGP table version is 4, main routing table version 4
3 network entries and 4 paths using 435 bytes of memory
4 BGP path attribute entries using 240 bytes of memory
2 BGP AS-PATH entries using 48 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP activity 3/14 prefixes, 4/0 paths, scan interval 15 secs
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.168.1.2 4 10 90 92 4 0 0 01:26:02 1
192.168.2.1 4 4 91 91 4 0 0 01:25:38 2
Verify the BGP state on the active MSFC in CAT2. The output below confirms successful eBGP and iBGP peering with AS20 and CAT1 respectively
MSFC-CAT2#show ip bgp summary
BGP router identifier 192.168.2.1, local AS number 4
BGP table version is 4, main routing table version 4
3 network entries and 4 paths using 435 bytes of memory
4 BGP path attribute entries using 240 bytes of memory
2 BGP AS-PATH entries using 48 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
② BGP開啟同步與關閉同步的區別
樓上已經說的很清楚了,我再啰嗦下,BGP同步就是如果一個IBGP將路由傳遞給對端IBGP,若對端IBGP開啟了同步,那麼對端IBGP的該BGP路由將不是最優,如果有
③ 什麼是BGP同步
1.BGP同步規則的定義:
在bgp同步打開的情況下,一個BGP路由器不會把那些通過ibgp鄰居學到的bgp路由通告給自己的ebgp鄰居;除非自己的igb路由表中存在這些路由,才可以向ebgp路由器通告.
2.BGP同步規則的目的:
防止一個AS(不是所有的路由器都運行bgp)內部出現路由黑洞,即向外部通告了一個本AS不可達的虛假的路由.
3.BGP同步規則的基本需求
如果一個AS內部存在非bgp路由器,那麼就出現了bgp和igp的邊界,需要在邊界路由器將bgp路由發布到igp中,才能保證AS所通告到外部的bgp路由在AS內部是連通的.實際上是要求bgp路由和igp路由的同步.
4.滿足BGP同步規則的基本需求的結果
如果將bgp路由發布到igp中,由於bgp路由主要是來自AS外部的路由(來自internet),那麼結果是igp路由器要維護數以萬計的外部路由,對路由器的cpu和memeory以及AS內部的鏈路帶寬的佔用將帶來巨大的開銷.
BGP同步規則的總結
1.在所有的方案中, 既要保證傳遞bgp路由,還要保證bgp路由的連通性.
2.關閉同步能夠實現bgp路由的傳遞,不一定能保證as內部連通性,除非as內所有路由器都運行bgp才可以保證連通性;否則,仍然需要路由再發布(bgpàigp)
3.最後,在as內部一般需要部署igp來維持AS內部網路路徑的連通性,以保證as內部的所通告的bgp路由的下一跳的可達性.這樣bgp網路就具有更好的靈活性和擴展性.
④ 介紹下BGP和相關配置命令
BGP,邊界網關協議,是自主網路系統中網關之間交換器路由信息的協議。邊界網關協議常常應用於互聯網的網關之間。路由表包含已知路由器的列表、路由器能夠達到的地址以及到達每個路由器的路徑的跳數。BGP(Border Gateway Protocol,邊界網關協議)是用來連接Internet上的獨立系統的路由選擇協議。它是Internet工程任務組制定的一個加強的、完善的、可伸縮的協議。BGP4支持CIDR定址方案,該方案增加了Internet上的可用IP地址數量。
BGP是為取代最初的外部網關協議EGP設計的。它也被認為是一個路徑矢量協議。BGP(Border Gateway Protocol)是一種在自治系統之間動態交換路由信息的路由協議。一個自治系統的經典定義是在一個管理機構控制之下的一組路由器,它使用IGP和普通度量值向其他自治系統轉發報文。
import-route isis level-2 into level-1 (這條命令一定要打的,不然後面做這BGP時是學不到EBGP通告的路由) //將level-2的路由引入到level-1中。該命令配置在與外部區域相連的Level-1-2路由器上。預設情況下,Level-2的路由信息不發布到Level-1區域中。
undo import-route isis level-1 into level-2 //不將Level-1的路由信息發布到Level-2中。該命令配置在與外部區域相連的Level-1-2路由器上。預設情況下,Level-1的路由信息都將發布到Level-2區域中。
display bgp peer //查看bgp的對等信息 Established為成功建立
diplay bgp peer ipv4-address verbose //查看bgp的某個鄰居(對等體)的詳細信息。
diplay bgp routing-table //查看bgp的路由表信息
⑤ 如何配置BGP路由協議
實驗拓撲圖:
實驗要求:
1.各AS之間實現全網互通,並在路由兩條出口中任意一條斷開均不影響全網通訊;
a.在Router P6BBR1和P7BBR1上創建EBGP;
b.在Router P6R3和P7R3之間創建EBGP;
2.在PXR1、PXR2、PXR3、PXR4、PXBBR1之間配置IBGP;
3.在PXR1、PXR2、PXR3、PXR4、PXBBR1之間可使用OSPF或RIP、EIGRP等協議完成各介面基本的互通性。這里使用OSPF,並將其中五台路由器全部定義到Aera 0中。
4.驗證BGP配置,使用show ip bgp summary來驗證BGP鄰居關系是否已建立,使用sh ip bgp顯示BGP路由選擇信息庫.查看是否從核心路由器和另一台邊緣路由器那裡獲悉了路由,查看邊緣路由器的IP路由選擇表,其中是否有BGP路由?
5.最後,老師要求在每一台路由器上都要開啟telnet訪問,便於老師telnet到各個路由器檢查我們的實驗配置,方便幫助我們排錯.因開啟telnet需要設置密碼,所有密碼均設置cisco.
實驗步驟(以下將以P7BBR1、P7R1、P7R2、P7R3、P7R4作說明,在P6BBR1和P6的其它路由器則可參考以此驟):
1.刪除路由器中原來的配置(earse Start),以免被以前實驗中的配置影響實驗的順利進行,然後重啟各路由器(Reload),或針對介面使用default interface (s0)刪除該介面的所有配置.
2.按照網路拓撲圖上所標示的IP地址在所有ROUTER的介面上按要求配置好IP Address,在DCE介面上配置好時鍾頻率(clock rate 64000),所有介面確保UP狀態(NO shutdown).
3.在所有Route中均需配置一個環回介面(Interface loopback 0),並配置相應的IP地址,用於BGP中宣告網路。OSPF路由協議通告完成後需確保各路由器間可以互相PING通Loopback O的地址.各路由器的OSPF配置命令如下:
P7BBR1:
P7BBR1(config-router)#network 172.31.7.0 0.0.0.255 area 0
P7BBR1(config-router)#network192.168.7.1 0.0.0.0 area 0
P7R1:
P7R1(config-router)#network 172.31.7.0 0.0.0.255 area 0
P7R1(config-router)#network 10.7.0.0 0.0.0.255 area 0
P7R1(config-router)#network 10.7.1.0 0.0.0.255 area 0
P7R1(config-router)#network 10.7.4.1 0.0.0.0 area 0
P7R2:
P7R2(config-router)#network 172.31.7.0 0.0.0.255 area 0
P7R2(config-router)#network 10.7.0.0 0.0.0.255 area 0
P7R2(config-router)#network 10.7.2.0 0.0.0.255 area 0
P7R2(config-router)#network 10.7.4.2 0.0.0.0 area 0
P7R3:
P7R3(config-router)#network 10.7.3.0 0.0.0.255 area 0
P7R3(config-router)#network 10.7.1.0 0.0.0.255 area 0
P7R3(config-router)#network 10.7.4.3 0.0.0.0 area 0
P7R4:
P7R4(config-router)#network 10.7.3.0 0.0.0.255 area 0
P7R4(config-router)#network 10.7.2.0 0.0.0.255 area 0
P7R4(config-router)#network 10.7.4.4 0.0.0.0 area 0
4.P7BBR1中配置完S0的IP地址後,需要在SO介面上封裝幀中繼(encapsulation frame-relay),並將下一跳IP地址(172.31.7.1&172.31.7.2)映射到永久虛電路(PVC),在映射PVC時,broadcast這個參數一定要加,這樣幀中繼映射將支持廣播和多播,否則在通告OSPF時無法將網路通告出去,並且要禁用反向地址解析。
P7BBR1(config-if)#frame-relay map ip 172.31.7.1 172 broadcast
P7BBR1(config-if)#frame-relay map ip 172.31.7.2 173 broadcast
P7BBR1(config-if)#no frame-relayinverse-arp
5.同理,在P7R1的S0介面也要封裝幀中繼,以及將下一跳IP地址(172.31.7.3)映射到永久虛電路,禁用反向地址解析.
P7R1(config-if)#frame-relay map ip 172.31.7.3271 broadcast
P7R1(config-if)#no frame-relayinverse-arp
6.在P7R2的S0介面也封裝幀中繼,禁用反向地址解析,配置如下:
P7R1(config-if)#frame-relay map ip 172.31.7.3271 broadcast
P7R1(config-if)#no frame-relayinverse-arp
7.在點到多點的模式下,OSPF將非廣播網路中的所有路由器到路由器的連接視為點到點的鏈路,不選舉DR和BDR,也不會將2類網路LSA擴散到鄰接路由器,因在P7BBR1、P7R1、P7R2之間是幀中繼的網路,需要配置為點到多點的模式,具體配置如下(各路由器的配置方法一致,均在S0介面配置):
P7BBR1(config-if)#ip ospf network point-to-multipoint.
8.到目前為止,需確保整個內網的路由器的各個介面都可以互相PING通,如果PING不通,先不要進行下面的工作,把整個內網調通再進行後續操作.因為此時若有某些介面無法PING通,說明你已經錯了,建議你不要再錯下去了,你先排錯再說,以免越來越混淆.
9.下面,開始配置IBGP和EBGP,首先在P7BBR1路由器上配置BGP,因在P7BBR1的BGP配置中,有很多鄰居的更新策略相同,而在CISCO路由器上,可將更新策略相同的鄰居劃分到同一個對等體組(peer-group)中,以簡化配置,並可提高更新的效率,在此使用peer-group.
P7BBR1:
P7BBR1(config)#router bgp 64159(進入BGP路由器配置模式,路由器位於AS64159中)
P7BBR1(config-router)#no syncronization(關閉同步規則)
P7BBR1(config-router)#network172.31.7.0 mask 255.255.255.0 (在BGP中通告網路)
P7BBR1(config-router)#network 192.168.88.0 mask 255.255.255.0(在BGP中通告網路)
P7BBR1(config-router)#neighbor ok peer-group(創建名為OK的對等體組)
P7BBR1(config-router)#neighbor ok remote-as 64159 (指定BGP鄰居,這里指定的是對等體組)
P7BBR1(config-router)#neighbor ok update-source loopback0(同鄰居OK組建立對等關系,將一個環回介面的地址用作源地址)
P7BBR1(config-router)#neighbor ok next-hop-self(將自己作為下一跳通告給鄰居)
P7BBR1(config-router)#neighbor 10.7.4.1 peer-group ok(將P7R1的L0加入到OK對等體組)
P7BBR1(config-router)#neighbor 10.7.4.2 peer-group ok(將P7R2的L0加入到OK對等體組)
P7BBR1(config-router)#neighbor 10.7.4.3 peer-group ok(將P7R3的L0加入到OK對等體組)
P7BBR1(config-router)#neighbor 10.7.4.4 peer-group ok(將P7R4的L0加入到OK對等體組)
P7BBR1(config-router)#neighbor 192.168.6.1 remote-as 64158 (指定192.168.6.1為BGP鄰居)
P7BBR1(config-router)#neighbor 192.168.6.1 ebgp-multihop 2 (指定到鄰居192.168.6.1的跳線為2)
P7BBR1(config-router)#neighbor 192.168.6.1 update-source loopback0 (同鄰居192.168.6.1建立對等關系,並將環回介面的地址用作源地址)
P7BBR1(config-router)#no auto-summary (關閉自動匯總)
10.路由表中沒有到鄰居192.168.6.1的路由,需要手工添加靜態路由到192.168.6.1,否則將不可達,EBGP將不能成功建立.
P7BBR1(config)#ip route 192.168.6.1 255.255.255.255 192.168.88.6
11.以下是另外四台路由器的BGP配置,不另加旁註,具體參考以上旁註:
P7R1:
P7R1(config)#router bgp 64159
P7R1(config-router)#no synchronization
P7R1(config-router)#network 10.7.0.0 mask 255.255.255.0
P7R1(config-router)#network 10.7.1.0 mask 255.255.255.0
P7R1(config-router)#network172.31.7.0 mask 255.255.255.0
P7R1(config-router)#neighbor ok peer-group
P7R1(config-router)#neighbor ok remote-as 64159
P7R1(config-router)#neighbor ok update-source lookback0
P7R1(config-router)#neighbor 10.7.4.2 peer-group ok
P7R1(config-router)#neighbor 10.7.4.3 peer-group ok
P7R1(config-router)#neighbor 10.7.4.4 peer-group ok
P7R1(config-router)#neighbor192.168.7.1 peer-group ok
P7R1(config-router)#no auto-summary
P7R2:
P7R2(config)#router bgp 64159
P7R2(config-router)#no synchronization
P7R2(config-router)#network 10.7.0.0 mask 255.255.255.0
P7R2(config-router)#network 10.7.2.0 mask 255.255.255.0
P7R2(config-router)#network172.31.7.0 mask 255.255.255.0
P7R2(config-router)#neighbor ok peer-group
P7R2(config-router)#neighbor ok remote-as 64159
P7R2(config-router)#neighbor ok update-source lookback0
P7R2(config-router)#neighbor 10.7.4.1 peer-group ok
P7R2(config-router)#neighbor 10.7.4.3 peer-group ok
P7R2(config-router)#neighbor 10.7.4.4 peer-group ok
P7R2(config-router)#neighbor192.168.7.1 peer-group ok
P7R2(config-router)#no auto-summary
P7R3:
P7R3(config)#router bgp 64159
P7R3(config-router)#no synchronization
P7R3(config-router)#network 10.7.1.0 mask 255.255.255.0
P7R3(config-router)#network 10.7.3.0 mask 255.255.255.0
P7R3(config-router)#network 192.168.86.0 mask 255.255.255.0
P7R3(config-router)#neighbor ok peer-group
P7R3(config-router)#neighbor ok remote-as 64159
P7R3(config-router)#neighbor ok update-source lookback0
P7R3(config-router)#neighbor ok next-hop-self
P7R3(config-router)#neighbor 10.6.4.3 remote-as 64158
P7R3(config-router)#neighbor 10.6.4.3 ebgp-multihop 2
P7R3(config-router)#neighbor 10.6.4.3 update-source loopback 0
P7R3(config-router)#neighbor 10.7.4.1 peer-group ok
P7R3(config-router)#neighbor 10.7.4.2 peer-group ok
P7R3(config-router)#neighbor 10.7.4.4 peer-group ok
P7R3(config-router)#no auto-summary
在P7R3中添加到10.6.4.3的靜態路由:
P7R3(config)#ip route 10.6.4.3 255.255.255.255 192.168.86.1
P7R4:
P7R4(config)#router bgp 64159
P7R4(config-router)#no synchronization
P7R4(config-router)#network 10.7.3.0 mask 255.255.255.0
P7R4(config-router)#network 10.7.2.0 mask 255.255.255.0
P7R4(config-router)#neighbor ok peer-group
P7R4(config-router)#neighbor ok remote-as 64159
P7R4(config-router)#neighbor ok update-source lookback0
P7R4(config-router)#neighbor 10.7.4.1 peer-group ok
P7R4(config-router)#neighbor 10.7.4.3 peer-group ok
P7R4(config-router)#neighbor 10.7.4.2 peer-group ok
P7R4(config-router)#neighbor192.168.7.1 peer-group ok
P7R4(config-router)#no auto-summary
12.整個配置基本上就是這樣,後面的工作就是驗證BGP的配置是否正確,可以使用show ip bgp summary,show ip bgp,show ip route等命令查看配置結果.並可以在任意一個路由器上PING另一個AS的任意一個介面,看看是否PING通.當然,首先要在P6那邊的五個路由器也做好相應的配置.還可以將P7BBR1的E0介面shutdown,看看結果會是如何.如有問題,多看書查閱相關資料,舉一反三,相信可以查明原因.
⑥ 華為路由器 如何開啟BGP同步 我在BGP協議中無法使用sy命令,是VRP版本的問題嗎
各位 我剛學BGP也遇到了這個問題,查了查資料,目前得出的答案是在華為設備中,無法開啟同步。。。。華三和思科的可以。。如果說的不對,敬請指正。
⑦ BGP同步如何解釋。
同步只存在於IBGP中,即AS內部。當AS內bgp路由器全互連時,不需要同步,否則應打開同步。
同步指igp和bgp同步,即:AS內的非ibgp路由器必須知道如何到達下一個as,更具體說:非ibgp路由器必須知道如何到達另一個as內的某個網路如何走。
為何要同步?因為as1內bgp路由器(A)要想到達as2某個網路,其下一跳是指向as2和as1互連介面地址(N)。在A到達N之前,A必須穿過as1內的其它路由器(包括bgp和非bgp路由器),非bgp路由器必須知道如何到達N,才能正確的把A報文送到N,否則將丟棄A報文。
因此當bgp路由器從ibgp-peer獲取了某條路由信息N時,它必須檢測此N(或當同步關閉後,至少是N的下一跳)是否在igp中也可達,再決定此路由是否可用,進而裝載到路由表中,進而向ebgp-peer更新
之所以有"同步"問題,是因為IGP的收斂需要一定時間,而IBGP通過TCP連接直接發送無收斂時間,如果未等IGP收斂,就將IBGP通告的路由加入路由表,會造成"黑洞"。