天天看點

bgp 的自動彙總

、拓撲圖:

二、配置及詳細說明:

1、配置各路由器的IP位址保證直連鍊路的直通性,然後運作bgp路由協定,我在這三台路由器上指定BGP的鄰居,暫不把直連網絡通告進BGP程序,首先看一下各路由器的bgp鄰居指定配置:

R1(config-if)#router bgp 64512

R1(config-router)#nei 172.16.255.2 remote 64512

R2(config-if)#router bgp 64512

R2(config-router)#nei 172.16.255.1 remote-as 64512

R2(config-router)#nei 10.1.255.2 remote 64513

R3(config-if)#router bgp 64513

R3(config-router)#nei 10.1.255.1 remote 64512

2、在R2上檢視一下簡單的彙總資訊,發現已經有鄰居了,但是沒有通過BGP鄰居學到别的路由,是以都顯示為0,原因也就是我們沒有network釋出:

R2#sh ip bgp sum

BGP router identifier 172.16.255.2, local AS number 64512

BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd

10.1.255.2      4 64513      28      28        1    0    0 00:24:13        0

172.16.255.1    4 64512      29      29        1    0    0 00:26:14        0

3、我們現在在R1上把直連網絡通告進BGP的程序中去,因為R1本身的直連口都是屬于172.16.0.0的網絡内,那麼我們直接用彙總的位址去network,不加子網釋出,看一下R2能不能通過R1學到looback這些網段的路由:

R1(config)#router bgp 64512

R1(config-router)#net 172.16.0.0  (直接通告彙總的位址)

4、在R2上軟涮新bgp路由資訊,加快收斂過程:

R2#clear ip bgp *  soft

5、再次在R2上檢視bgp的簡單彙總資訊和路由表:

10.1.255.2      4 64513      42      43        1    0    0 00:38:00        0

172.16.255.1    4 64512      43      44        1    0    0 00:40:02        0  (同樣是0)

R2#sh ip route bgp

R2#        (發現一條也沒有學到)                      

6、那到底是什麼原因,造成R2學不到R1的looback哪些網絡,先來看一下概念:BGP協定在将某路由通告給自己的鄰居對等體時,會檢查路由是否同步和本地路由表中是否已經存在此條路由條目。也就是說當R1将172.16.0.0/16通告給R2時它會檢查本地路由器是否同步或者是本地路由表中存不存在172.16.0.0/16 這條路由,如果不存在,那它将不會通告出去。我們在R1上查一下同步情況和R1路由表中有沒有172.16.0.0/16這條路由條目的存在:

R1#show ip protocols

Routing Protocol is "bgp 64512"

  Outgoing update filter list for all interfaces is not set

  Incoming update filter list for all interfaces is not set

  IGP synchronization is disabled  (12.3以上的版本IOS同步預設關閉)

  Automatic route summarization is disabled(12.2以上的版本IOS,自動路由彙總關閉)

  Neighbor(s):

    Address          FiltIn FiltOut DistIn DistOut Weight RouteMap

    172.16.255.2                                        

  Maximum path: 1

  Routing Information Sources:

    Gateway         Distance      Last Update

  Distance: external 20 internal 200 local 200

R1#

R1#sho ip bgp 172.16.0.0

% Network not in table        (發現并不存在172.16.0.0這條bgp路由條目)

7、通過上述情況,我們了解到R1上沒有開啟同步,同時也沒有宣告的bgp路由條目的存在,那麼我們試一下在R1上開啟同步,看能否在R2上學到R1那邊的bgp路由:

R1(config-router)#synchronization  (開啟同步)

R1(config-router)#do sh ip pro  (同時檢視了一下同步資訊)

  IGP synchronization is enabled (同步已經開啟了)

  Automatic route summarization is disabled

8、在R2上檢視一下有沒有學到 R1那邊的bgp路由表目:

10.1.255.2      4 64513      62      63        1    0    0 00:58:55        0

172.16.255.1    4 64512      63      64        1    0    0 01:00:56        0

R2#

9、看來在這裡不是因為同步的關系,是因為R1上沒有172.16.0.0這條路由條目了。這裡是IBGP區域。是因為自動路由彙總關閉了,然後R1上就不存在了172.16.0.0這條路由條目了。那下面來證明一下,看我們分析的正不正确。先在R1上開啟自動彙總:

R1(config-router)#auto-summary

10、現在再來看一下R2能不能學到R1這邊的loopback路由:

R2#sh ip bgp summary

BGP table version is 2, main routing table version 2

1 network entries using 117 bytes of memory

1 path entries using 52 bytes of memory

2/1 BGP path/bestpath attribute entries using 248 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 using 417 total bytes of memory

BGP activity 1/0 prefixes, 1/0 paths, scan interval 60 secs

10.1.255.2      4 64513      74      76        2    0    0 01:10:25        0

172.16.255.1    4 64512      76      76        2    0    0 01:12:27        1  (學到了一條彙總路由條目了)

     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks

B       172.16.0.0/16 [200/0] via 172.16.255.1, 00:02:16  (學到了R1那邊的彙總路由)

三、看來BGP的自動路由彙總特性,并不是像RIP這些普通距離矢量協定或EIGRP進階距離矢量協定一樣,在主類的邊界進行彙總,而是預設為關閉狀态。

本文轉自wxs-163 51CTO部落格,原文連結:http://blog.51cto.com/supercisco/267182