« Back
in BGP 思科 read.

BGP auto-summary 实验

实验说明:

引Cisco® BGP-4 Command and Configuration Handbook (CCIE Professional Development) 原文

When auto-summary is enabled, routes injected into BGP via redistribution aresummarized on a classful boundary.
当auto-summary被启用,在有类边界通过重分布进入BGP的路由会被汇总.
 
static routes, connected routes, and routes learned via IGP are being redistributed into BGP
静态,直连,IGP路由被重分布进入BGP
 
auto-summary does not apply to routes injected into BGP via the network command or through IBGP or EBGP.
auto-summary不应用于通过 network 命令通告的路由 和 通过 IBGP或EBGP 学到的路由.
 

引用网上的总结:
auto-summary命令作用的对象:重分布进bgp的igp或直连或静态路由.如果这些路由是子网路由,在进bgp表时将被自动汇总成有类路由条目. 
 
auto-summary命令不作用的对象:network通告的路由,ibgp或ebgp邻居通告的路由.如果是此类产生的路由,在show ip bgp表中将是子网路由,这些路由再通过ibgp或ebgp通告给邻居时,根据此原则,无论邻居是否启用auto-summary,接收到的都将是子网路由条目. 
 
只要在show ip bgp表中存在的路由,都会不变地传给ibgp或ebgp的邻居,而不管邻居或自己是否启用auto-summary命令.

 

实验拓扑: 

R1-R2
 

实验基本配置:
R1  (BGP配置见实验步骤)
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
!
interface Loopback1
 ip address 11.1.1.1 255.255.255.255
!
interface Loopback2
 ip address 12.1.1.1 255.255.255.255
!     
interface Serial1/1
 ip address 10.1.12.1 255.255.255.0
 no sh
!
router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes
 network 1.1.1.1 0.0.0.0 area 0
 network 10.1.12.0 0.0.0.255 area 0
 network 11.1.1.1 0.0.0.0 area 0
 network 12.1.1.1 0.0.0.0 area 0
!        
 
R2:
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface Serial1/0
 ip address 10.1.12.2 255.255.255.0
!
router ospf 1
 router-id 2.2.2.2
 network 2.2.2.2 0.0.0.0 area 0
 network 10.1.12.0 0.0.0.255 area 0
!
router bgp 1
 no synchronization
 bgp router-id 2.2.2.2
 bgp log-neighbor-changes
 neighbor 1.1.1.1 remote-as 1
 neighbor 1.1.1.1 update-source Loopback0
 no auto-summary
!
 
1. no auto-summary 情况
R1  BGP配置
router bgp 1
 no synchronization
 bgp router-id 1.1.1.1
 bgp log-neighbor-changes
 network 1.1.1.1 mask 255.255.255.255
 network 11.0.0.0
 neighbor 2.2.2.2 remote-as 1
 neighbor 2.2.2.2 update-source Loopback0
 no auto-summary
!
 
实验现象:
R1#sh ip bgp
BGP table version is 2, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
 
   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.1/32       0.0.0.0                  0         32768 i
 
R2#sh ip bgp  (打开或关闭 auto-summary ,结果一致)
BGP table version is 40, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
 
   Network          Next Hop            Metric LocPrf Weight Path
*>i1.1.1.1/32       1.1.1.1                  0    100      0 i
 
实验结论:
在R1配置no auto-summary 命令下,1.1.1.1/32 存在show ip bgp 表里 ,而路由表里无11.0.0.0/8 ,因此bgp network时,不能在show ip bgp里出现.
在R2打开或关闭 auto-summary ,结果一致,show ip bgp表里都是 1.1.1.1/32.
 
 
2. auto-summary 情况
R1  BGP配置
router bgp 1
 no synchronization
 bgp router-id 1.1.1.1
 bgp log-neighbor-changes
 bgp scan-time 5
 network 1.1.1.1 mask 255.255.255.255
 network 3.0.0.0
 network 11.0.0.0
 redistribute connected route-map lo2
 neighbor 2.2.2.2 remote-as 1
 neighbor 2.2.2.2 update-source Loopback0
!        
ip route 3.3.3.3 255.255.255.255 Serial1/1
!        
route-map lo2 permit 10
 match interface Loopback2
!         
 
实验现象:
R1#sh ip bgp
BGP table version is 5, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
 
   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.1/32       0.0.0.0                  0         32768 i
*> 3.0.0.0          0.0.0.0                  0         32768 i
*> 11.0.0.0         0.0.0.0                  0         32768 i
*> 12.0.0.0         0.0.0.0                  0         32768 ?
 
R2#sh ip bgp
BGP table version is 23, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
 
   Network          Next Hop            Metric LocPrf Weight Path
*>i1.1.1.1/32       1.1.1.1                  0    100      0 i
*>i3.0.0.0          1.1.1.1                  0    100      0 i
*>i11.0.0.0         1.1.1.1                  0    100      0 i
*>i12.0.0.0         1.1.1.1                  0    100      0 ?
 
实验结论:
R1  auto-summary 启用时
a.  对于network 1.1.1.1/32 , 路由没有被汇总,即对 network 的路由不应用, 同实验说明.
b.  对于redistribute 直连路由,路由被汇总 12.0.0.0/8 ,即对 重分布的路由生效(重分布静态路由及IGP路由同理), 同实验说明.
 
Network主类路由 + auto-summary
c.  BGP配置 network 11.0.0.0 和 network 3.0.0.0 ,11.1.1.1/32为直连路由,3.3.3.3/32为静态路由,在no auto-summary的情况下,show ip bgp 表里并没有11.0.0.0/8以及3.0.0.0/8 , network路由表里无此汇总路由;在auto-summary的情况下,show ip bgp 表里出现11.0.0.0/8 和3.0.0.0/32 的路由,推论auto-summary在此起到了汇总路由的作用,通过network 命令显示并通告出去。
d.  同理,通过IGP学到的路由,在BGP中network 其主类路由,也为上述结果.
 
总结:
BGP  Auto-summary 命令
A.  重分布时,路由会自动汇总并通告.
B.  在子网路由存在的情况下,Network 主类路由,BGP表里出现并通告.