as-path功能很强大

 

 
来看一个简单的实验
R1
bgp 100 
 network 100.1.1.1 255.255.255.255 
 network 150.1.1.1 255.255.255.255 
 network 200.1.1.1 255.255.255.255 
 undo synchronization
 peer 1.1.1.2 as-number 200 
 
 
R2
#
bgp 200
 undo synchronization
 peer 1.1.1.1 as-number 100
 peer 1.1.1.1 as-path-acl 1 import
#
 ip as-path 1 deny _100$
 ip as-path 1 permit .*
 
 
 
未在BGP视图下加入as-path-acl 时的路由表
[R2-bgp]dis ip ro
Routing Tables: Public
        Destinations : 8        Routes : 8
 
Destination/Mask    Proto  Pre  Cost         NextHop         Interface
 
1.1.1.0/30          Direct 0    0            1.1.1.2         S0/6/0
1.1.1.1/32          Direct 0    0            1.1.1.1         S0/6/0
1.1.1.2/32          Direct 0    0            127.0.0.1       InLoop0
100.1.1.1/32        BGP    255  0            1.1.1.1         S0/6/0
127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0
127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0
150.1.1.1/32        BGP    255  0            1.1.1.1         S0/6/0
200.1.1.1/32        BGP    255  0            1.1.1.1         S0/6/0
 
 
 
加入后的路由表
[R2-bgp]  DIS IP RO
Routing Tables: Public
        Destinations : 5        Routes : 5
 
Destination/Mask    Proto  Pre  Cost         NextHop         Interface
 
1.1.1.0/30          Direct 0    0            1.1.1.2         S0/6/0
1.1.1.1/32          Direct 0    0            1.1.1.1         S0/6/0
1.1.1.2/32          Direct 0    0            127.0.0.1       InLoop0
127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0
127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0
 
将AS100的全部始发的路由去掉了,与acl prefix 等不同,AS-path属性不是针对网段的路由,而是针对一个区域的路由,或者经过了哪些区域的路由,比较灵活。
 
相关的命令还有peer as-path-acl      if-mathch as-path    applly as-path 
 
正则表达式略
参考文章章 http://www.h3c.com.cn/MiniSite/Technology_Circle/Net_Reptile/The_Tthree/Home/Catalog/201010/696833_97665_0.htm
 
 
 

你可能感兴趣的:(功能,AS-PATH)