BGP ——路由过滤+路由聚合(讲解+配置)
作者:互联网
目录
注:所有案列拓扑图一致
一、路由聚合:
aggregate-address 192.168.0.0 255.255.248.0 suppress-map aaa summary-only as-set
聚合过程中过滤,ACL的permit做聚合,deny不做聚合,放行明细,即使加上summary-only也会放行192.168.1.0
案列:
————————————————————————————————————————————————————————
二、路由过滤 :
(1)ACL过滤
r2(config)#access-list 1 per 192.168.1.0 0.0.0.255
r2(config)#route-map aaa per 10
r2(config-route-map)#match ip add 1
r2(config)#router bgp 100
r2(config-router)#nei 1.1.1.1 route-map aaa in //从1.1.1.1只接收192.168.1.0的路由
(2)Prefix-list过滤(常用):
ip prefix-list aaa seq 1 deny 192.168.1.0/24 匹配192.168.1.0/24的BGP路由,执行拒绝
ip prefix-list aaa seq 2 permit 0.0.0.0/0 le 32 匹配剩余的0大于等于32掩码的BGP路由执行放行
定义策略路由,名字为bbb,在策略路由bbb里面调用上面的前缀列表aaa
route-map bbb permit 10
match ip address prefix-list aaa
router bgp 200
neighbor 23.1.1.2 route-map bbb in // 从23.1.1.2接收BGP路由的时候执行过滤,怎么过滤,通过route-map BBB里面的策略过滤
案列:
(3)distribute路由过滤:
access-list 1 permit 192.168.1.0 0.0.0.255
router bgp 200
distribute-list 1 in
实现功能:只允许192.168.1.0的路由进来,进程里面使用
———————————————————————————————————————————————————————
access-list 1 permit 192.168.1.0 0.0.0.255
router bgp 200
nei 4.4.4.4 distribute-list 1 in//neighbor
实现功能:只允许从4.4.4.4收满足ACL的permit流量路由,后面使用
——————————————————————————————————————————————————————
三、路由聚合+路由过滤:
access-list 1 deny 192.168.1.0 0.0.0.255
access-list 1 permit any
route-map aaa permit 10
match ip address 1
router bgp 200
aggregate-address 192.168.0.0 255.255.248.0 suppress-map aaa summary-only as-set
聚合过程中过滤,ACL的permit做聚合,deny不做聚合,放行明细,即使加上summary-only也会放行192.168.1.0
ip prefix-list aaa seq 1 deny 192.168.1.0/24
ip prefix-list aaa seq 2 permit 0.0.0.0/0 le 32
router bgp 200
aggregate-address 192.168.0.0 255.255.248.0 as-set summary-only suppress-map aaa
————————————————————————————————————————————————————————
四、把本地抑制路由传给邻居:
access-list 1 permit 192.168.1.0 0.0.0.255
route-map aaa permit 10
match ip address 1
router bgp 200
aggregate-address 192.168.0.0 255.255.248.0 summary-only
neighbor 4.4.4.4 unsuppress-map aaa
把我本地抑制的路由传给4.4.4.4邻居,且是active
——————————————————————————————————————————————————————————
五、路由聚合过程中修改属性:
route-map aaa permit 10
set local-preference 120//修改本地优先级
router bgp 200
aggregate-address 192.168.0.0 255.255.248.0 summary-only as-set attribute-map aaa
注意:
聚合中修改汇总路由属性,注意尽量不和ACL连用
***不支持修改AS-PATH!!
聚合时候route-map 和att…map是同一个意思
——————————————————————————————————————————————————————————
六、路由过滤中修改属性 :
ip prefix-list aaa seq 1 deny 100.1.1.0/24
ip prefix-list aaa seq 5 permit 0.0.0.0/0 le 32
route-map bbb permit 10
match ip address prefix-list aaa
set metric 8
exit
router bgp 300
neighbor 67.1.1.6 route-map bbb in
exit
实现功能: 不给67.1.1.6发送100.1.1.0,其他路由修改MED为8
——————————————————————————————————————————————————
七、过滤优先级
出方向:route-map过滤-----filter-list----------prefix-list
进方向:prefix-list -------filte-list -------route-map
标签:map,aaa,0.0,list,192.168,BGP,讲解,路由 来源: https://blog.csdn.net/qq_62311779/article/details/123115728