關于BGP基本配置的方法
as100 as200
router a-------------------router b---------------------router c
s0:192.1.1.1/24 e0:193.1.1.3/24
s0:192.1.1.2/24 e0 193.1.1.2
//// router a ////
int lo0
ip addr 1.1.1.1 255.255.255.0
int s0/0
ip addr 192.1.1.1 255.255.255.0
clockrate 500000
router bgp 100
neighbor 192.1.1.2 remote-as 200 //指定鄰居路由器和它所在的自治系統(tǒng)
//// router b ////
int lo0
ip addr 2.2.2.2 255.255.255.0
int e0/0
ip addr 193.1.1.2 255.255.255.0
int s0/0
ip addr 192.1.1.2 255.255.255.0
router bgp 200
neighbor 192.1.1.1 remote-as 100
neighbor 193.1.1.3 remote-as 200
//// router c ////
int lo0
ip addr 3.3.3.3 255.255.255.0
int e0/0
ip addr 193.1.1.3 255.255.255.0
router bgp 200
neighbor 193.1.1.2 remote-as 200
////監(jiān)視和測試配置////
router a# show ip bgp neighbors
remote-as 200
bgp version 4,remote router id 2.2.2.2
bgp state = established
現(xiàn)在A將通過BGP向B通告路由1.0.0.0,必須滿足2個條件:
1、通過使用network命令或redistribute,BGP進程必須能知道路由。
2、被通告路由必須在IP路由表中。
我們將在BGP進程下使用network命令。這個命令滿足了***條,使得BGP進程知道路由。此network命令能使你更好控制從IGP重分布什么到BGP,并使用戶能分別列出需經(jīng)BGP通告的前綴。CISCO路由器能被配置的網(wǎng)絡描述***數(shù)為200。如果有超過200個網(wǎng)絡需要通告,那就需要動態(tài)重分布。
由于網(wǎng)絡1.0.0.0是直接相連的網(wǎng)絡,它存在于IP路由表中,故第二個條件滿足。
顯示A上的IP路由表。注意網(wǎng)絡1.0.0.0在IP路由表中。
a# show ip route
C 1.0.0. is directly connected,loopback 0
no shynchronization
在路由器A上,在BGP進程下增加命令network 1.0.0.0
a# conf t
router bgp 100
netw 1.0.0.0
用show ip bgp顯示B上的IP BGP表,network 1.0.0.0是通過192.1.1.1得到的
B# show ip bgp
network next-hop metric loca pref weight path
*>1.0.0.0 192.1.1.1 0 0 100 i
///// *表示有效,>表示***路由
b# show ip ro
B 1.0.0.0/8 [20/0] via 192.1.1.1, 00:12:02
用show ip bgp顯示C上的IP BGP表,注意network 1.0.0.0出現(xiàn)在BGP表中,它的下一跳是192.1.1.1(未變),此路由是有效的(用*號標出),它是通過iBGP會話得到的,在網(wǎng)絡號前加字母i表示了這一狀態(tài)。
c# show ip bgp
network next-hop metric locprf weight path
* i1.0.0.0 192.1.1.1 0 0 100 i
C# show ip route
無1.0.0.0路由到網(wǎng)絡1.0.0.0的路由不在IP路由表中有雙重原因。
1、192.1.1.1不在C的路由表。而且下一跳地址是:從該處得到此路由的EBGP鄰居的IP地址。當路由通過EBGP注入到AS中,從EBGP獲得的下一跳被無改變地傳送到IBGP中。
2、在缺省情況下BGP和IGP必須是同步的(因為網(wǎng)絡1.0.0.0不是通過IGP得到的)。這意味著路由器B上的BGP知道的路由沒有被重分布到IGP,這兩者是不同步的。no synchronization
為解決***個問題:
B# router bgp 200
neighbor 193.1.1.3 next-hop-self
為解決第二個問題:
C# router bgp 200