码迷,mamicode.com
首页 > 其他好文 > 详细

BGP路由聚合

时间:2018-04-11 21:52:28      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:BGP路由聚合

技术分享图片
如图,R1在AS1中,R2,R3,R4在一个大AS100中(R2,R3在AS23中,R4在AS4中),5在AS5中。
BGP路由汇总
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0 ?
advertise-map Set condition to advertise attribute
as-confed-set Generate AS confed set path information
as-set Generate AS set path information
attribute-map Set attributes of aggregate
route-map Set parameters of aggregate
summary-only Filter more specific routes from updates
suppress-map Conditionally filter more specific routes from updates
<cr>
直接回车<cr>----默认汇总和默认一起发送
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0
R1#show ip bgp
BGP table version is 33, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
> 1.1.1.1/32 0.0.0.0 0 32768 i
> 5.5.5.5/32 12.1.1.2 0 100 5 i
> 200.1.0.0/22 0.0.0.0 32768 i
> 200.1.1.0 0.0.0.0 0 32768 i
> 200.1.2.0 0.0.0.0 0 32768 i
> 200.1.3.0 0.0.0.0 0 32768 i
R2#show ip bgp
BGP table version is 7, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history,
valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
> 1.1.1.1/32 12.1.1.1 0 0 1 i
>i 5.5.5.5/32 3.3.3.3 0 100 0 (4) 5 i
*** > 200.1.0.0/22 12.1.1.1 0 0 1 i

200.1.1.0 12.1.1.1 0 0 1 i
200.1.2.0 12.1.1.1 0 0 1 i
200.1.3.0 12.1.1.1 0 0 1 i
只发送汇总路由 summary-only
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0 summary-only
R2#show ip bgp
BGP table version is 10, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history,
valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 12.1.1.1 0 0 1 i
>i 5.5.5.5/32 3.3.3.3 0 100 0 (4) 5 i
* > 200.1.0.0/22 12.1.1.1 0 0 1 i
抑制列表suppress-map--处于抑制列表的路由不允许发送
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0 (yidingyaoxie)
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0 suppress-map ccie
R1#show run | s 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 200.1.1.0
network 200.1.2.0
network 200.1.3.0
aggregate-address 200.1.0.0 255.255.252.0 suppress-map ccie
neighbor 12.1.1.2 remote-as 100
no auto-summary
R1#show run | s rout-map
R1#show rou
R1#show route-map
route-map ccie, permit, sequence 10
Match clauses:
ip address (access-lists): 1
Set clauses:
Policy routing matches: 0 packets, 0 bytes
Standard IP access list 1
抓取200.1.1.0 200.1.3.0 的路由,通配符为0.0.2.0 是因为0固定位,1是可变位,只有第23位改变。
10 permit 200.1.1.0, wildcard bits 0.0.2.0 (4 matches)*
R2#show ip bgp
BGP table version is 21, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history,
valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
> 1.1.1.1/32 12.1.1.1 0 0 1 i
>i 5.5.5.5/32 3.3.3.3 0 100 0 (4) 5 i
> 200.1.0.0/22 12.1.1.1 0 0 1 i
> 200.1.2.0 12.1.1.1 0 0 1 i
条件列表 advertise-map--处于条件列表中的路由一旦消失,汇总路由就会立即消失
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0 advertise-map c1
R1(config)#access-list 2 permit 200.1.2.0
R1(config)#route-map c1 permit 10
R1(config-route-map)#mat
R1(config-route-map)#match ip ad
R1(config-route-map)#match ip address 2
R1(config-route-map)#exit
R1(config)#exit
R1(config)#inter lo 1
R1(config-if)#shutdown
R2#show ip bgp
BGP table version is 26, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 12.1.1.1 0 0 1 i
>i 5.5.5.5/32 3.3.3.3 0 100 0 (4) 5 i
> 200.1.0.0/22 12.1.1.1 0 0 1 i
> 200.1.2.0 12.1.1.1 0 0 1 i
> 200.1.3.0 12.1.1.1 0 0 1 i
R1#show ip inter b
Interface IP-Address OK? Method Status Protocol
Serial0/0 unassigned YES NVRAM administratively down down
Serial0/1 unassigned YES NVRAM administratively down down
Serial0/2 unassigned YES NVRAM administratively down down
Serial0/3 unassigned YES NVRAM administratively down down
Serial1/0 unassigned YES NVRAM administratively down down
Serial1/1 12.1.1.1 YES NVRAM up up
Serial1/2 unassigned YES NVRAM administratively down down
Serial1/3 unassigned YES NVRAM administratively down down
Loopback0 1.1.1.1 YES NVRAM up up
Loopback1 200.1.1.1 YES manual up up
Loopback2 200.1.2.1 YES manual administratively down down
Loopback3 200.1.3.1 YES manual up up
R2#show ip bgp
BGP table version is 29, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history,
valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 12.1.1.1 0 0 1 i
>i 5.5.5.5/32 3.3.3.3 0 100 0 (4) 5 i
** > 200.1.1.0 12.1.1.1 0 0 1 i

200.1.3.0 12.1.1.1 0 0 1 i**
attribute-map和route-map一样,改变路由聚合属性,并不需要抓取感兴趣流量。
R1#show ip bgp
BGP table version is 37, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history,
valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 0.0.0.0 0 32768 i
> 5.5.5.5/32 12.1.1.2 0 100 5 i
> 200.1.1.0 0.0.0.0 0 32768 i
R1#show run | s bgp
router bgp 1
bgp router-id 1.1.1.1
bgp log-neighbor-changes
network 1.1.1.1 mask 255.255.255.255
network 200.1.1.0
neighbor 12.1.1.2 remote-as 100
R1(config)#router bgp 1
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0 attribute-map c2
R1#show route-map c2
route-map c2, permit, sequence 10
Match clauses:
Set clauses:
metric 888
local-preference 9909
as-path prepend 1 1 no
weight 99
ip next-hop 12.1.1.2
Policy routing matches: 0 packets, 0 bytes
R1#show ip bgp
BGP table version is 39, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history,
valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 0.0.0.0 0 32768 i
> 5.5.5.5/32 12.1.1.2 0 100 5 i
* > 200.1.0.0/22 12.1.1.2 888 9909 99 i*
> 200.1.1.0 0.0.0.0 0 32768 i
R2#show ip bgp
BGP table version is 39, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 12.1.1.1 0 0 1 i
>i 5.5.5.5/32 3.3.3.3 0 100 0 (4) 5 i
> 200.1.0.0/22 12.1.1.1 888 0 1 i
> 200.1.1.0 12.1.1.1 0 0 1 i
Route-map改变路由聚合属性
R1(config)#router bgp 1
R1(config-router)#agg
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0 ro
R1(config-router)#aggregate-address 200.1.0.0 255.255.252.0 route-map c3
R1(config-router)#exit
R1(config)#ro
R1(config)#route-m
R1(config)#route-map c3 per
R1(config)#route-map c3 permit 10
R1(config-route-map)#set lo
R1(config-route-map)#set local-preference 120
R1(config-route-map)#exit
R1(config)#exit
R1#show ip bgp
BGP table version is 44, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 0.0.0.0 0 32768 i
> 5.5.5.5/32 12.1.1.2 0 100 5 i
* > 200.1.0.0/22 0.0.0.0 120 32768 i*
> 200.1.1.0 0.0.0.0 0 32768 i
> 200.1.2.0 0.0.0.0 0 32768 i
> 200.1.3.0 0.0.0.0 0 32768 i
R2#show ip bgp
BGP table version is 10, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 12.1.1.1 0 0 1 i
>i 5.5.5.5/32 3.3.3.3 0 100 0 (4) 5 i
> 200.1.0.0/22 0.0.0.0 32768 i
s> 200.1.1.0 12.1.1.1 0 0 1 i
s> 200.1.2.0 12.1.1.1 0 0 1 i
s> 200.1.3.0 12.1.1.1 0 0 1 i
R3#show ip bgp
BGP table version is 58, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history,
valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

>i 1.1.1.1/32 2.2.2.2 0 100 0 1 i
> 5.5.5.5/32 4.4.4.4 0 100 0 (4) 5 i
>i 200.1.0.0/22 2.2.2.2 0 100 0 i
R5#show ip bgp
BGP table version is 50, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history,
valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 45.1.1.4 0 100 1 i
> 5.5.5.5/32 0.0.0.0 0 32768 i
> 200.1.0.0/22 45.1.1.4 0 100 i
As-set携带聚合之前路由的属性
R2#show run | s bgp
router bgp 23
aggregate-address 200.1.0.0 255.255.252.0 as-set
R5#show ip bgp
BGP table version is 4, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history,
valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 45.1.1.4 0 100 1 i
> 5.5.5.5/32 0.0.0.0 0 32768 i
* > 200.1.0.0/22 45.1.1.4 0 100 i*
R5#show ip bgp
BGP table version is 11, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history,
valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop            Metric LocPrf Weight Path

> 1.1.1.1/32 45.1.1.4 0 100 1 i
> 5.5.5.5/32 0.0.0.0 0 32768 i
* > 200.1.0.0/22 45.1.1.4 0 100 1 i*
> 200.1.1.0 45.1.1.4 0 100 1 i
> 200.1.2.0 45.1.1.4 0 100 1 i
> 200.1.3.0 45.1.1.4 0 100 1 i

BGP路由聚合

标签:BGP路由聚合

原文地址:http://blog.51cto.com/13625527/2097137

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!