实验指南:BGP路由汇聚(下)

实验指南
 
 
4,attribute-map/route-map
初始配置见实验指南: BGP路由汇聚(上)3
 
在Rainier上做BGP路由汇聚
aggregate-address 194.69.12.0 255.255.252.0
Vemon上BGP表状态
Vemon#sh ip bgp 
BGP table version is 16, local router ID is 85.122.8.9
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
*> 194.69.12.0      85.122.8.10              0             0 852 i
*> 194.69.12.0/22   85.122.8.10              0             0 852 i
*> 194.69.13.0      85.122.8.10              0             0 852 i
*> 194.69.14.0      85.122.8.10              0             0 852 i
*> 194.69.15.0      85.122.8.10              0             0 852 i

在Path后面的“i”表示路由条目是通过network命令发布的,如果是“?”则表明路由条目是通过redistribute命令再分发的。当想要改变汇聚路由条目的属性时,要使用attribute-map/route-map参数

Rainier
route-map ATT permit 10
set origin incomplete
router bgp 852
aggregate-address 194.69.12.0 255.255.252.0 attribute-map ATT
 
在Vemon上观察BGP表的状态

Vemon#sh ip bgp
BGP table version is 17, local router ID is 85.122.8.9
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
*> 194.69.12.0      85.122.8.10              0             0 852 i
*> 194.69.12.0/22   85.122.8.10              0             0 852 ?
*> 194.69.13.0      85.122.8.10              0             0 852 i
*> 194.69.14.0      85.122.8.10              0             0 852 i
*> 194.69.15.0      85.122.8.10              0             0 852 i
使用route-map参数和attribute-map效果相同
 
 
5,advertise-map
 
 
 
初始配置
R1
conf t
int s2/0
ip ad 85.122.8.5 255.255.255.248
encap f
no arp f
no frame inver
frame map ip 85.122.8.6 102 b
no shut
router bgp 7519
no au
no sy
nei 85.122.8.6 remote 852
end

R2
conf t
int s2/0
ip ad 85.122.8.6 255.255.255.248
encap f
no arp f
no frame inver
frame map ip 85.122.8.5 201 b
no shut
int s2/1
ip ad 85.122.8.10 255.255.255.248
encap f
no arp f
no frame inver
frame map ip 85.122.8.9 213 b
no shut
router bgp 852
no au
no sy
nei 85.122.8.5 remote 7519
nei 85.122.8.9 remote 7518
end
 
R3
conf t
int l 0
ip ad 194.69.12.1 255.255.255.0
int l 1
ip ad 194.69.13.1 255.255.255.0
int l 2
ip ad 194.69.14.1 255.255.255.0
int l 3
ip ad 194.69.15.1 255.255.255.0
int s 2/1
ip ad 85.122.8.9 255.255.255.248
encap f
no arp f
no frame inver
frame map ip 85.122.8.10 312 b
no shut
router bgp 7518
no au
no sy
nei 85.122.8.10 remote 852
net 194.69.12.0 mask 255.255.255.0
net 194.69.13.0 mask 255.255.255.0
net 194.69.14.0 mask 255.255.255.0
net 194.69.15.0 mask 255.255.255.0
end
 
 
当具体的路由条目中有团体属性时,汇聚路由条目会结成继承该团体属性,这样
有时会不能达到预期的目的,当想要使得汇聚路由放弃继承具体路由条目的团体
属性时,要用到advertise-map参数

先在R3上的194.69.13.0/24条目上配置BGP团体属性no-expert,
R2
access-list 100 permit ip host 194.69.13.0 host 255.255.255.0
route-map ADV permit 10
match ip ad 100
set community no-export
route-map ADV permit 20
router bgp 852
nei 85.122.8.5 route-map ADV out
nei 85.122.8.5 send-community
 
在R1上BGP表的状态
R1#sh ip bgp
BGP table version is 18, local router ID is 85.122.8.5
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
*> 194.69.12.0      85.122.8.6                             0 852 7518 i
*> 194.69.14.0      85.122.8.6                             0 852 7518 i
*> 194.69.15.0      85.122.8.6                             0 852 7518 i
因为194.69.13.0被加入了no-export属性,所以不会发送到R1上,
 
 
在R2上做路由汇聚
router bgp 852
aggregate-address 194.69.12.0 255.255.252.0 summary-only as-set
这时R1的BGP表状态
R1#sh ip bgp
 
R1#
由于汇聚路由继承了具体路由条目的no-export团体属性,所以在R1上的BGP表是空的,
 
R2(config-router)#do sh ip bgp community no-export
BGP table version is 57, local router ID is 85.122.8.10
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
*> 194.69.12.0/22   0.0.0.0                       100  32768 7518 i
s> 194.69.13.0      85.122.8.9               0             0 7518 i
 
怎么样使得R1得到R2发出的汇聚路由呢?在R2上使用advertise-map参数,使得R2在做路由汇聚时不考虑194.69.13.0的团体属性

R2
access-list 1 deny 194.69.13.0
access-list 1 permit any
route-map to_R1 permit 10
match ip ad 1
router bgp 852
aggregate-address 194.69.12.0 255.255.252.0 summary-only as-set advertise-map to_R1

这时在R1上观察BGP表的状态
R1#sh ip bgp      
BGP table version is 34, local router ID is 85.122.8.5
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
*> 194.69.12.0/22   85.122.8.6               0             0 852 7518 i
R1收到R2发送的汇聚路由。
R2(config-router)#do sh ip bgp communi no-export
BGP table version is 47, local router ID is 85.122.8.10
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
s> 194.69.13.0      85.122.8.9               0             0 7518 i
R2上具有no-export团体属性的条目只有194.69.13.0
 
 
 
 

本文出自 “穿过地狱去看海” 博客,谢绝转载!

你可能感兴趣的:(职场,休闲,BGP,实验指南)