bgp community属性.note

noteId: WEBf3a14e4b257cc09c61dd287b9f96bf8b · 原始路径:/ALL/网络 - C模块/1-路由协议合集、路由控制、策略路由/BGP (TCP-179)/bgp community属性.note · 图片:2 · 附件待处理:0

 
 
1、为路由添加 community属性:
# ACL/前缀列表匹配路由:
access-list 1 permit 100.1.3.0 /24
access-list 1 permit 100.1.4.0 /24
access-list 1 permit 100.2.3.0 /24
access-list 1 permit 100.2.4.0 /24
 
# 定义route-map:
route-map BGP_1 permit 10
 match ip address 1
 set community 65001:100    //community建议格式:[AS号]:[标签](最后会自动转换,这里转换为了:4259905636)
route-map BGP_2 permit 20
 exit
 
# 配置BGP:
router bgp 65001
 neighbor 5.5.5.5 send-community    //允许向邻居发送community(不打开无法发送community)
 neighbor 5.5.5.5 route-map BGP_2 out
 
·设置 community属性:
internet    //(收到这条路由的路由器)允许通告给所有BGP邻居
local-AS    //(收到这条路由的路由器)不发出本地AS(不发给eBGP邻居)(正常情况下与no-export一样),用于bgp联邦环境,只会在bgp联邦中的其中一个AS中传递,不会传递给联邦其他AS
no-advertise    //(收到这条路由的路由器)不发将这条送给任何邻居(iBGP/eBGP)
no-export    //(收到这条路由的路由器)可以发给iBGP邻居,不能发给eBGP邻居
gshut    //告诉其他路由器,这条路由正在维护,可以配合路由策略降低这条路由的优先级
none    //删除路由的特殊属性,只保留community
 
# 如何设置并匹配 gshut 维护属性:
route-map test
 set community gshut additive    //additive参数表示附加,设置了这个参数后,不会覆盖原本的community值和属性
 
匹配:
ip community-list 1 permit gshut 
 
# 查看拥有community的路由:
show ip bgp community
show ip bgp community 4259905636
show ip bgp 100.1.3.0/24    //只有指定前缀查看才能够看到community的值
 
 
2、community有路由过滤的作用: