30. Understand BGP Auto-Summary

1、理解BGP的自动汇总特性。
 
网络图:

image.png


配置各路由器IP地址,测试互连可达。

 

配置各路由器的邻居关系,并确认邻居关系的状态:

R1(config)#router bgp 64512
R1(config-router)#neighbor 172.16.255.2 remote-as 64512
R1(config-router)#exit

 

R2(config)#router bgp 64512
R2(config-router)#neighbor 172.16.255.1 remote-as 64512
R2(config-router)#neighbor 10.1.155.2 remote-as 64513
R2(config-router)#exit

 

R3(config)#router bgp 64513
R3(config-router)#neighbor 10.1.255.1 remote-as 64512
R3(config-router)#exit

 

在R2查看邻居关系状态:

R2(config)#do show ip bgp summary
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   4      4      1    0    0 00:00:11    0
172.16.255.1  4 64512    17     15      1    0    0 00:00:27   0

 

查看R1的BGP协议属性:

R1#show ip protocol
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  ----->在新版的IOS中默认禁用同步
  Automatic route summarization is disabled 
 ----->在新版的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(config)#router bgp 64512
R1(config-router)#network 172.16.0.0  ---->宣告一个B类网络的主类网络路由
R1(config-router)#end

 

在R2上查看路由表和汇总信息和summary信息:

R2#clear ip bgp * soft  ---->加快收敛速度
R2#show ip route
Gateway of last resort is not set

     172.16.0.0/30 is subnetted, 1 subnets
C       172.16.255.0 is directly connected, Serial0/0
     10.0.0.0/30 is subnetted, 1 subnets
C       10.1.255.0 is directly connected, Serial0/1

R2#show ip bgp summary
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     14    15      1    0    0 00:10:15    0
172.16.255.1   4 64512    27     26     1    0    0 00:10:31   
0   

---->没学到任何路由

 

原因:

BGP 协议在将某路由通告给自己的邻居对等体时,会检查路由是否同步和本地路由表中是否已经存在此条路由。 本实验中R2没有学习到R1的路由的主要问题并不是同步,而是R1的路由表中没有关于172.16.0.0/16(16位)子网的路由

 

在R1上查看BGP对172.16.0.0/16网络的路由描述:

R1#show ip bgp 172.16.0.0
% Network not in table  
---->没有此路由

 

在R1上开启自动汇总:

R1(config)#router bgp 64512
R1(config-router)#auto-summary
R1(config-router)#exit

 

再次查看R2的路由表:

R2#show ip route      
Gateway of last resort is not set

     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C       172.16.255.0/30 is directly connected, Serial0/0
B       172.16.0.0/16 [200/0] via 172.16.255.1, 00:00:41   

----->此时已经可以学习到一条汇总路由
     10.0.0.0/30 is subnetted, 1 subnets
C       10.1.255.0 is directly connected, Serial0/1


R2#show 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    22    24      2    0    0 00:18:44     0
172.16.255.1  4 64512    37    35      2    0    0 00:19:00     
 

--->表明学习一条路由

 

查看R3上的路由表:

R3#show ip route
Gateway of last resort is not set

B    172.16.0.0/16 [20/0] via 10.1.255.1, 00:03:05  
     10.0.0.0/30 is subnetted, 1 subnets
C       10.1.255.0 is directly connected, Serial0/0
C    192.168.0.0/24 is directly connected, Loopback0
C    192.168.1.0/24 is directly connected, Loopback1
C    192.168.2.0/24 is directly connected, Loopback2
C    192.168.3.0/24 is directly connected, Loopback3

 

总结:

BGP的自动总结特性,并不是像普通距离矢量协议一样,在主类的边界进行汇总。

BGP的自动汇总, 其主要是将本地多个相同主类网络下的无类路由向主类网络进行汇总,并且向邻居路由器通告此条路由。而不管其本身是否处于主类边界。


发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

桂ICP备19000498号-3