R1----------R2--------R3 1 2 3 1.1.1.0/24 1.1.2.0/24
R1 EBGP PEER R2 R1 EBGP PEER R3 R2 EBGP PEER R3
R2 上做汇总
BGP COMMUNITY
1:what bgp community?
BGP 团体属性是一个标记,给一组需要相同路由策略的路由条目进行FLAG,然后再由其他路由器对拥有特定标记的PREFIX 进行路由策略的设置,或者直接根据标记进行处理.
Show ip bgp 是查看不到团体属性。
通常我们都把团体属性理解为一个比较特殊的路由属性。 2.1
公认的BGP 团体属性 No export
如果被接受的路由前缀,带有该属性,那么该路由前缀,将不被当前路由器发送给任何的EBGP PEER,但是依旧会发送给IBGP PEER。
No advertise
如果被接受的路由前缀,带有该BGP 公认团体属性,那么该路由前缀,将不被当做路由更新发送给任何BGP PEER
如果ROUTE-MAP 应用在IN 的方向去给接收的路由打上community flag,那么是不需要敲入NEI XX send-community
在IN 的方向如果接收的路由本地设置了NO-EXPORT 那么该路由是不会发送给EBGP PEER。 Local-as
Internet
该前缀正常进行传递,无任何特殊策略
公认是说各个厂商都理解的BGP 团体属性,并且会根据这些属性,进行路由策略的执行
2.2 自定义BGP 团体属性 Ip bgp community new-format
这些BGP 团体属性,是由管理员根据需求自行定义,所以说就是所谓自定义团体属性。都属于任选可传递路由属性 3:NO EXPORT
如果一个被接受路由拥有该属性,那么该路由将不被接受者发送给任何的EBGP PEER. Step 1 :ACL
Access-list 1 permit x.x.x.x
Prefix-list <------external acl 去模拟PREFIX-LIST Step2: define route-map
Route-map noexport permit 10 Match ip address xx
Set community no-export
Route-map noexport permit 20 Step3:apply this policy Router bgp xx
Neighbor x.x.x.x route-map NOEXPORT out/IN Neighbor x.x.x.x send-community Show ip bgp community
4:NO advertise
如果一个被接受的路由拥有改属性,那么该路由是不公告给ANY BGP PEER.
5:LOACL-AS
但是它适用于confederation .
6:自定义团体属性.
用户可以自定义团体属性,简化网络的配置 ip community-list
团体属性值的两种格式:
十进制 十六进制( 缺省 )
AA:NN (ip bgp-community new-format)
R1
10 1:10 172 1:172 R2
1:10 med 10 1:172 med 172 R1
R1(config)#access-list 1 per 10.1.1.0 0.0.0.255 R1(config)#access-list 1 per 10.1.2.0 0.0.0.255 R1(config)#
R1(config)#access-list 2 per 172.16.1.0 0.0.0.255 R1(config)#access-list 2 per 172.16.2.0 0.0.0.255 !
ip bgp-community new-format 让BGP 进程能够支持AA:NN 的BGP 团体属性值的格式 !
route-map SC permit 10 match ip address 1 set community 1:10 !
route-map SC permit 20 match ip address 2 set community 1:172 !
R1(config)#router bgp 1
R1(config-router)#nei 12.12.12.2 send-community !
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
R2#show ip bgp community 1:10
BGP table version is 11, local router ID is 23.23.23.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path *> 10.1.1.0/24 12.12.12.1 0 0 1 i *> 10.1.2.0/24 12.12.12.1 0 0 1 i R2#
R2#show ip bgp community 1:172
BGP table version is 11, local router ID is 23.23.23.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path *> 172.16.1.0/24 12.12.12.1 0 0 1 i *> 172.16.2.0/24 12.12.12.1 0 0 1 i R2#
ip bgp-community new-format
R2(config)#ip community-list 1 permit 1:10 R2(config)#ip community-list 2 permit 1:172 route-map SMED permit 10 match community 1 set metric 10 !
route-map SMED permit 20 match community 2 set metric 172
neighbor 23.23.23.2 route-map SMED out
如果设置多BGP 团体属性的话,一定要在set community xx 后面使用additive 参数,不然永远是最后一个被附加的属性覆盖前一个团体属性,使用该参数后,多团体属性才被携带,而不是覆盖关系
BGP 路由过滤
1:distribute-list 分发列表
1.1 ACL/prefix-list
利用ACL 匹配出需要被过滤或放行的网络,然后根据permit deny 的设置,来最终决定被匹配的网络是被过滤,还是被放行。 可以用prefix-list 来代替ACL。
1.2 distribute-list Router bgp xx
Distribute-list xx in/out
Distribute-list prefix xx in/out
R1#sh ip prefix-list detail
Prefix-list with the last deletion/insertion: RF ip prefix-list RF:
count: 1, range entries: 0, sequences: 5 - 5, refcount: 3 seq 5 permit 11.11.11.0/24 (hit count: 1, refcount: 1)
2:prefix-list
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库BGP的基础知识以及特性讲解(8)在线全文阅读。
相关推荐: