、拓扑图:
二、配置及详细说明:
1、配置各路由器的IP地址保证直连链路的直通性,然后运行bgp路由协议,我在这三台路由器上指定BGP的邻居,暂不把直连网络通告进BGP进程,首先看一下各路由器的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的简单汇总信息和路由表:
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 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 bgp 64512
R1(config-router)#synchronization (开启同步)
R1(config-router)#do sh ip pro (同时查看了一下同步信息)
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 enabled (同步已经开启了)
Automatic route summarization is disabled
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
|
8
、在R2上查看一下有没有学到 R1那边的bgp路由表目:
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 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#sh ip route bgp
R2#
|
9
、看来在这里不是因为同步的关系,是因为R1上没有172.16.0.0这条路由条目了。这里是IBGP区域。是因为自动路由汇总关闭了,然后R1上就不存在了172.16.0.0这条路由条目了。那下面来证实一下,看我们分析的正不正确。先在R1上开启自动汇总:
R1(config)#router bgp 64512
R1(config-router)#auto-summary
|
10
、现在再来看一下R2能不能学到R1这边的loopback路由:
R2#sh ip bgp summary
BGP router identifier 172.16.255.2, local AS number 64512
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
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
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 (学到了一条汇总路由条目了)
R2#sh ip route bgp
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