BGP – 實戰 – Confederations

概念:

iBGP peer不會傳遞從別的iBGP peer上學到的route,這讓iBGP peer間的很難互通。不同於一般IGP的建立,BGP Neighbor建立不需要相鄰著,可以跨越設備。當如果要用鄰居關係形成傳遞鏈傳遞route,就需要使用下指令。

有兩種:Reflector、Confederation

這裡跳過了 Reflectors ,還是簡單描述Reflector指定鄰居作為Client。
1. 收到非Client的iBGP Neighbor傳來的Route,會傳遞給Client的iBGP Neighbor。
2.收到Client的iBGP Neighbor傳來的Route,會傳給其他iBGP Neighbors。
3.收到eBGP的Neighbor傳來的Route,會傳給其他iBGP Neghbors。

Reflector機制算是簡單的。然而BGP適用於對外,跨組織甚至於跨國際,有沒有甚麼方法,讓組織或國際內的AS,在對內時AS是有所區分,在對外時,外面看來的AS是一致的?

另外一種:Confederation

BGP形成鄰居是需要兩者互指,如果AS號碼不一樣是eBGP,相同則是iBGP。如果要多個AS對外是一致的,相當於形成多個AS形成一個聯盟Confederation,就需要下指令:

bgp confederation identifier <AS number>

如果要使用 Confederation,設備本身的BGP AS是內部AS,然後用以下指令去指定同一聯盟不同的peers ASs。

bgp confederation peers <AS number>

要是AS沒有納入在這兩種中,就會不斷報錯,無法形成鄰居。

%BGP-3-NOTIFICATION: received from neighbor 10.1.48.8 2/2 (peer in wrong AS) 2 bytes 00C8

目標:

學會如何設定 BGP Confederation,並且了解其運作。

設定:

!R1
conf t
int g0/0
ip addr 10.1.12.1 255.255.255.0
no sh
int loopback 1
ip addr 1.1.1.1 255.255.255.0
router bgp 100
redistribute connected
neighbor 10.1.12.2 remote-as 200
exit
! R2
conf t
int g0/0
ip addr 10.1.12.2 255.255.255.0
no sh
int g1/0
ip addr 10.1.23.2 255.255.255.0
no sh
int loopback 1
ip addr 2.2.2.2 255.255.255.0
router bgp 65100
bgp confederation identifier 200
bgp confederation peers 65200
redistribute connected
neighbor 10.1.12.1 remote-as 100
neighbor 10.1.23.3 remote-as 65200
exit
!R3
conf t
int g0/0
ip addr 10.1.23.3 255.255.255.0
no sh
int g1/0
ip addr 10.1.34.3 255.255.255.0
no sh
int loopback 1
ip addr 3.3.3.3 255.255.255.0
router bgp 65200
bgp confederation identifier 200
bgp confederation peers 65100
redistribute connected
neighbor 10.1.23.2 remote-as 65100
neighbor 10.1.34.4 remote-as 300
exit
!R4
conf t
int g0/0
ip addr 10.1.34.4 255.255.255.0
no sh
int loopback 1
ip addr 4.4.4.4 255.255.255.0
router bgp 300
redistribute connected
neighbor 10.1.34.3 remote-as 200
exit

流程:

照著貼上設定之後,可以發現BGP很快就形成Neighbor,但是route等一下才會交換。

稍後片刻,可以看到R1有了R4的route,觀察AS-Path,200 300 i。

中間有 AS 200 其實是由 65100 跟 65200 組成,AS range 在64512 – 65535是Private AS。

show ip bgp

觀察R2收到AS 65200的route會加上括號(),如果要對外面的AS傳送route,整個()都會被換成 <identifier AS>。

同一AS聯盟的route其AD為多少?

接著,新增一個R5,AS65300,納入AS200聯盟。是否R2的peer AS要增加R5的?R5能夠正常收到R2的route嗎?這個實際操作就知道了。

結論心得:

BGP Confederation好用!

可以解決iBGP間需要彼此交換route得形成Full-mesh的麻煩設定,只需要對左右鄰居設定稍微改變就能形成如IGP那般的route交換鏈,能夠省下很多設定時間。

也可以讓BGP區分內外,可以讓private AS轉換成Public AS,就很像NAT。