取消
显示结果 
搜索替代 
您的意思是: 
cancel
1754
查看次数
20
有帮助
1
评论
碧云天
Spotlight
Spotlight
本帖最后由 碧云天 于 2020-3-8 16:09 编辑
一.测试拓扑
160855ma00a9yu0aba0xuh.png
测试总结:
1.BGP自动汇总新的IOS默认是关闭的,也不建议开启
2.BGP手工汇总一般会加上summary-only,让只传汇总路由,不传明细路由
3.BGP手工汇总如果在接收方做,需要加上as-set参数,否则上下游路由器都会接收该汇总路由,加上参数后,只有下游路由才会接收
4.BGP手工汇总在接收方做,对本地路由表没有影响
二.基本配置
1.R2路由器

hostname R2
interface Loopback0
ip address 2.2.2.2 255.255.255.0
interface Loopback8
ip address 192.168.8.2 255.255.255.0
interface Loopback9
ip address 192.168.9.2 255.255.255.0
interface Loopback10
ip address 192.168.10.2 255.255.255.0
interface Loopback11
ip address 192.168.11.2 255.255.255.0
interface Loopback12
ip address 192.168.12.2 255.255.252.0
interface Loopback128
ip address 192.168.128.129 255.255.255.128
interface FastEthernet1/0
ip address 12.1.1.2 255.255.255.0
no shutdown
2.R1路由器
hostname R1
interface Loopback0
ip address 1.1.1.1 255.255.255.0
interface Loopback172
ip address 172.16.1.1 255.255.255.0
interface FastEthernet0/0
ip address 134.1.1.1 255.255.255.0
no shutdown
interface FastEthernet1/0
ip address 12.1.1.1 255.255.255.0
no shutdown
router rip
version 2
network 1.0.0.0
network 134.1.0.0
no auto-summary
3.R3路由器
hostname R3
interface Loopback0
ip address 3.3.3.3 255.255.255.0
interface Loopback172
ip address 172.16.3.3 255.255.255.0
interface FastEthernet0/0
ip address 134.1.1.3 255.255.255.0
no shutdown
router rip
version 2
network 3.0.0.0
network 134.1.0.0
no auto-summary
4.R4路由器
hostname R4
interface Loopback0
ip address 4.4.4.4 255.255.255.0
interface Loopback172
ip address 172.16.4.4 255.255.255.0
interface FastEthernet0/0
ip address 134.1.1.4 255.255.255.0
no shutdown
三.BGP配置
1.R2路由器

hostname R2
router bgp 65002
bgp router-id 2.2.2.2
neighbor 12.1.1.1 remote-as 65001
2.R1路由器
router bgp 65001
bgp router-id 1.1.1.1
neighbor 3.3.3.3 remote-as 65001
neighbor 3.3.3.3 update-source Loopback0
neighbor 12.1.1.2 remote-as 65002
3.R3路由器
router bgp 65001
bgp router-id 3.3.3.3
neighbor 1.1.1.1 remote-as 65001
neighbor 1.1.1.1 update-source Loopback0
neighbor 134.1.1.4 remote-as 65004
4.R4路由器
router bgp 65004
bgp router-id 4.4.4.4
neighbor 134.1.1.3 remote-as 65001
四.BGP自动汇总测试
1.BGP自动汇总默认是关闭的

R2(config-router)#do show run | sec router
router bgp 65002
bgp router-id 2.2.2.2
bgp log-neighbor-changes
network 172.16.2.0 mask 255.255.255.0
neighbor 12.1.1.1 remote-as 65001
R2(config-router)#
R2(config-router)#do show run all | sec router bgp
router bgp 65002
no synchronization
bgp router-id 2.2.2.2
bgp fast-external-fallover
bgp route-map-cache
no bgp asnotation dot
no bgp consistency-checker
bgp client-to-client reflection
bgp transport path-mtu-discovery
bgp enforce-first-as
bgp log-neighbor-changes
bgp dynamic-med-interval 600
bgp listen limit 100
bgp update-delay 120
bgp refresh stalepath-time 0
bgp refresh max-eor-time 0
bgp regexp deterministic
bgp default ipv4-unicast
bgp default ipv6-nexthop
bgp default local-preference 100
bgp default route-target filter
bgp aggregate-timer 30
bgp nexthop trigger enable
bgp nexthop trigger delay 5
bgp scan-time 60
network 172.16.2.0 mask 255.255.255.0
timers bgp 60 180
neighbor 12.1.1.1 remote-as 65001
distance bgp 20 200 200
distance mbgp 20 200 200
no auto-summary
R2(config-router)#
2.开启自动汇总,带掩码宣告时没有影响
R2#show running-config | sec router bgp
router bgp 65002
bgp router-id 2.2.2.2
bgp log-neighbor-changes
network 2.2.2.0 mask 255.255.255.0
neighbor 12.1.1.1 remote-as 65001
auto-summary
R2#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 2.2.2.0/24 0.0.0.0 0 32768 i
R2#
3.主类网络宣告即使带掩码也不会显示
R2(config)#router bgp 65002
R2(config-router)#auto-summary
R2(config-router)#network 2.0.0.0 mask 255.0.0.0
R2(config-router)#do show run | sec router bgp
router bgp 65002
bgp router-id 2.2.2.2
bgp log-neighbor-changes
network 2.0.0.0
neighbor 12.1.1.1 remote-as 65001
auto-summary
R2(config-router)#end
R2#clear ip bgp * soft
R2#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 2.0.0.0 0.0.0.0 0 32768 i
R2#
备注:如果没有开启自动汇总,本地不是主类网络,不会被成功宣告
4.开启自动汇总,重分发时,只会重分发主类网络
R2(config-if)#router bgp 65002
R2(config-router)#auto-summary
R2(config-router)#redistribute connected
R2#show ip bgp | begin Network
R2#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 2.0.0.0 0.0.0.0 0 32768 ?
*> 12.0.0.0 0.0.0.0 0 32768 ?
*> 192.168.8.0 0.0.0.0 0 32768 ?
*> 192.168.9.0 0.0.0.0 0 32768 ?
*> 192.168.10.0 0.0.0.0 0 32768 ?
*> 192.168.11.0 0.0.0.0 0 32768 ?
*> 192.168.12.0/22 0.0.0.0 0 32768 ?
*> 192.168.128.0 0.0.0.0 0 32768 ?
R2#
备注:可以看到超网还是能正常宣告
四.BGP手工汇总测试
1.R2先取消主类网络宣告,自动汇总和重分发

router bgp 65002
no network 2.0.0.0
no auto-summary
no redistribute connected
2.R2手工汇总192.168.8.0~11.0给R1
①先明细宣告

router bgp 65002
network 192.168.8.0
network 192.168.9.0
network 192.168.10.0
network 192.168.11.0
②再使用aggregate-address,不带summary-only参数会将明细和汇总一同发送
router bgp 65002
aggregate-address 192.168.8.0 255.255.252.0
R2#show ip bgp neighbors 12.1.1.1 advertised-routes | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 192.168.8.0 0.0.0.0 0 32768 i
*> 192.168.8.0/22 0.0.0.0 32768 i
*> 192.168.9.0 0.0.0.0 0 32768 i
*> 192.168.10.0 0.0.0.0 0 32768 i
*> 192.168.11.0 0.0.0.0 0 32768 i
Total number of prefixes 5
R2#
③因此使用aggregate-address,需要带summary-only
router bgp 65002
aggregate-address 192.168.8.0 255.255.252.0 summary-only
R2#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
s> 192.168.8.0 0.0.0.0 0 32768 i
*> 192.168.8.0/22 0.0.0.0 32768 i
s> 192.168.9.0 0.0.0.0 0 32768 i
s> 192.168.10.0 0.0.0.0 0 32768 i
s> 192.168.11.0 0.0.0.0 0 32768 i
R2#show ip bgp neighbors 12.1.1.1 advertised-routes | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 192.168.8.0/22 0.0.0.0 32768 i
Total number of prefixes 1
R2#
R1#show ip route bgp | include 192.
B 192.168.8.0/22 [20/0] via 12.1.1.2, 00:13:18
R1#
④如果汇总时需要抑制192.168.8.0~9.0,让其不发送,可以使用suppress-map
ip prefix-list 10 seq 5 permit 192.168.8.0/23 ge 24 le 24
route-map suppress permit 10
match ip address prefix-list 10
router bgp 65002
aggregate-address 192.168.8.0 255.255.252.0 summary-only suppress-map suppress
R2#show ip bgp neighbors 12.1.1.1 advertised-routes | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 192.168.8.0/22 0.0.0.0 32768 i
*> 192.168.10.0 0.0.0.0 0 32768 i
*> 192.168.11.0 0.0.0.0 0 32768 i
Total number of prefixes 3
R2#
R1#show ip route bgp | include 192.
B 192.168.8.0/22 [20/0] via 12.1.1.2, 00:01:00
B 192.168.10.0/24 [20/0] via 12.1.1.2, 00:00:30
B 192.168.11.0/24 [20/0] via 12.1.1.2, 00:00:30
R1#
R4#show ip route bgp | in 192.
B 192.168.8.0/22 [20/0] via 134.1.1.1, 00:00:33
B 192.168.10.0/24 [20/0] via 134.1.1.1, 00:00:33
B 192.168.11.0/24 [20/0] via 134.1.1.1, 00:00:33
R4#
3.如果R2无法配置,也可以R1本地进行配置,但是需要带as-set参数,否则会回传给R2
①R2取消手工汇总

router bgp 65002
no aggregate-address 192.168.8.0 255.255.252.0 summary-only suppress-map suppress
②R1配置手工汇总,不带as-set
router bgp 65001
aggregate-address 192.168.8.0 255.255.252.0 summary-only
③此时R2,R3和R4都有该条汇总路由
R2#show ip route bgp | in 192
B 192.168.8.0/22 [20/0] via 12.1.1.1, 00:09:54
R2#
R3#show ip route bgp | in 192
B 192.168.8.0/22 [200/0] via 1.1.1.1, 00:09:12
R3#
R4#show ip route bgp | in 192
B 192.168.8.0/22 [20/0] via 134.1.1.1, 00:12:36
R4#
R2#show ip bgp begin Network
Network Next Hop Metric LocPrf Weight Path
*> 192.168.8.0 0.0.0.0 0 32768 i
*> 192.168.8.0/22 12.1.1.1 0 0 65001 i
*> 192.168.9.0 0.0.0.0 0 32768 i
*> 192.168.10.0 0.0.0.0 0 32768 i
*> 192.168.11.0 0.0.0.0
R2#
R1#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
s> 192.168.8.0 12.1.1.2 0 0 65002 i
*> 192.168.8.0/22 0.0.0.0 32768 i
s> 192.168.9.0 12.1.1.2 0 0 65002 i
s> 192.168.10.0 12.1.1.2 0 0 65002 i
s> 192.168.11.0 12.1.1.2 0 0 65002 i
R1#
④R1配置手工汇总,带as-set参数
router bgp 65001
no aggregate-address 192.168.8.0 255.255.252.0 summary-only
aggregate-address 192.168.8.0 255.255.252.0 summary-only as-set
R1#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
s> 192.168.8.0 12.1.1.2 0 0 65002 i
*> 192.168.8.0/22 0.0.0.0 100 32768 65002 i
s> 192.168.9.0 12.1.1.2 0 0 65002 i
s> 192.168.10.0 12.1.1.2 0 0 65002 i
s> 192.168.11.0 12.1.1.2 0 0 65002 i
备注:从上面可以看到,汇总路由带上了始发自治系统的信息,这样R2就不会接收该路由
评论
likuo
Spotlight
Spotlight
4个路由器分布很规范。
入门指南

使用上面的搜索栏输入关键字、短语或问题,搜索问题的答案。

我们希望您在这里的旅程尽可能顺利,因此这里有一些链接可以帮助您快速熟悉思科社区:









快捷链接