實例解析BGP基本配置之路由反射器(3)
BGP檢查配置之前,我們向大家介紹了:BGP基本配置之中路由反射器實例的概述和基本配置
檢查BGP之RA
- RA#sh ip bgp
- Network Next Hop Metric LocPrf Weight Path
- *> 1.1.1.0/24 0.0.0.0 0 32768 i
- *> 2.2.2.0/24 192.1.1.2 0 0 200 i
- *> 3.3.3.0/24 192.1.1.2 0 200 i
可以看到RA已經通過BGP學習到了各個虛擬接口,這兩條路由下一跳均為192.1.1.2。這里需指出當AS邊界路由器通過EBGP轉發路由信息時,總是將這些路由信息的下一跳設定為自己。
檢查BGP之RB
- RB#sh ip bgp
- Network Next Hop Metric LocPrf Weight Path
- *> 1.1.1.0/24 192.1.1.1 0 0 100 i
- *> 2.2.2.0/24 0.0.0.0 0 32768 i
- *>i3.3.3.0/24 193.1.1.2 0 100 0 i
可以看到RB也學習到了這些虛擬接口
檢查BGP之RC
- RC#sh ip bgp
- Network Next Hop Metric LocPrf Weight Path
- *>i1.1.1.0/24 192.1.1.1 0 100 0 100 i
- *>i2.2.2.0/24 193.1.1.1 0 100 0 i
- *> 3.3.3.0/24 0.0.0.0 0 32768 i
RC也學習到了這些路由
檢查BGP之RD
- RD#sh ip bgp
- Network Next Hop Metric LocPrf Weight Path
- *>i3.3.3.0/24 194.1.1.1 0 100 0 i
我們注意到這時RD并沒有學習到1.1.1.0/24和2.2.2.0/24兩個網段。這是因為在一個BGP域中,RC并不會將它通過RB學習到的路由轉發給RD。這是我們需要將RC配置成路由反射器。配置如下:
- RC(config)# router bgp 200
- RC(config)#neighbor 193.1.1.1 route-reflector-client
- RC(config)#neighbor 194.1.1.2 route-reflector-client
這兩條命令是將RB和RD設為RC的路由反射器客戶端
BGP再次檢查
我們再次在RD上進行驗證,之前用 clear ip bgp * 重啟BGP進程,稍等一會兒在RD上進行查看;
- RD#sh ip bgp
- Network Next Hop Metric LocPrf Weight Path
- *>i1.1.1.0/24 192.1.1.1 0 100 0 100 i
- *>i2.2.2.0/24 193.1.1.1 0 100 0 i
- *>i3.3.3.0/24 194.1.1.1 0 100 0 i
這時RD已經學習到了所有的虛擬接口,至此我們的路由反射器配置成功。下面我們將通過查看路由表來追蹤這些路由信息。在這之前我們再次進入所有路由器的 BGP進程,輸入: no synchronization 來取消BGP與IGP的同步關系,使得IGP能學到BGP中的路由信息,再次 clearip bgp * 和 clear ip route * 稍等片刻,等待BGP鄰接關系再次建立后,我們在RB,RC,RD 分別用 sh iproute 就都能得到完整的路由信息了。以RC為例;
- RC#sh ip route
- Gateway of last resort is not set
- 1.0.0.0/24 is subnetted, 1 subnets
- B 1.1.1.0 [200/0] via 192.1.1.1, 02:08:19
- 2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
- O 2.2.2.2/32 [110/11] via 193.1.1.1, 02:08:58, Ethernet0
- B 2.2.2.0/24 [200/0] via 193.1.1.1, 02:08:43
- 3.0.0.0/24 is subnetted, 1 subnets
- C 3.3.3.0 is directly connected, Loopback0
- C 193.1.1.0/24 is directly connected, Ethernet0
- O 192.1.1.0/24 [110/74] via 193.1.1.1, 02:08:58, Ethernet0
- C 194.1.1.0/24 is directly connected, Serial0
到現在為止,所有路由器的BGP表都已經完整,RB,RC,RD的IP路由表也已經完整,現在我們來看RA的路由表。
- RA#sh ip route
- Gateway of last resort is not set
- 1.0.0.0/24 is subnetted, 1 subnets
- C 1.1.1.0 is directly connected, Loopback0
- 2.0.0.0/24 is subnetted, 1 subnets
- B 2.2.2.0 [20/0] via 192.1.1.2, 02:18:43
- 3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
- B 3.3.3.3/32 [20/11] via 192.1.1.2, 02:12:30
- B 3.3.3.0/24 [20/0] via 192.1.1.2, 02:18:43
- C 192.1.1.0/24 is directly connected, Serial0
我們可以看到在RA的路由表中并沒有193.1.1.0/24和194.1.1.0/24這兩個網段的路由,這是因為這兩條路由是在AS200中通過OSPF發布的,因此R1當然無法學到。我們需要在AS邊界路由器RB上將OSPF的路由信息重發布到BGP中;配置如下:
- RB(config)#router bgp 200
- RB(config)#redistribute ospf 1
再次來到RA中,
- RA#sh ip route
- Gateway of last resort is not set
- 1.0.0.0/24 is subnetted, 1 subnets
- C 1.1.1.0 is directly connected, Loopback0
- 2.0.0.0/24 is subnetted, 1 subnets
- B 2.2.2.0 [20/0] via 192.1.1.2, 02:26:51
- 3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
- B 3.3.3.3/32 [20/11] via 192.1.1.2, 02:20:39
- B 3.3.3.0/24 [20/0] via 192.1.1.2, 02:26:51
- B 193.1.1.0/24 [20/0] via 192.1.1.2, 02:20:38
- C 192.1.1.0/24 is directly connected, Serial0
- B 194.1.1.0/24 [20/74] via 192.1.1.2, 02:20:38
我們可以看到這兩條路由已經被RA學習到了。
BGP基本配置中路由反射器的配置就介紹完了,希望大家已經掌握。
【編輯推薦】