![图片[1]-6.3用Community filter 控制路由-大赛人网](https://www.dsrw.com/wp-content/uploads/2023/03/图片27-10-1024x276.png)
1.R1配置BGP
[R1]bgp 100
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 12.1.1.2 as-number 200
2.R2配置BGP
[R2]bgp 200
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 12.1.1.1 as-number 100
[R2-bgp]peer 23.1.1.3 as-number 300
3.R3配置BGP
[R3]bgp 300
[R3-bgp]router-id 3.3.3.3
[R3-bgp]peer 23.1.1.2 as-number 200
4.R1宣告两条带community值路由
[R1]interface LoopBack 1
[R1-LoopBack1]ip address 1.1.2.1 32
[R1-LoopBack1]quit
[R1]interface LoopBack 2
[R1-LoopBack2]ip address 1.1.3.1 32
[R1-LoopBack2]quit
[R1]route-policy 100:1 permit node 10
[R1-route-policy]apply community 100:1
[R1]route-policy 100:2 permit node 10
[R1-route-policy]apply community 100:2
[R1]bgp 100
[R1-bgp]network 1.1.2.1 32 route-policy 100:1
[R1-bgp]network 1.1.3.1 32 route-policy 100:2
5.R1查看BGP路由
[R1]display bgp routing-table community
*> 1.1.2.1/32 0.0.0.0 0 0 <100:1>
*> 1.1.3.1/32 0.0.0.0 0 0 <100:2>
6.R1配置通告community参数命令,R2查看带community属性BGP路由(否则看不到community属性)
<R2>display bgp routing-table community
Total Number of Routes: 0
[R1]bgp 100
[R1-bgp]peer 12.1.1.2 advertise-community
<R2>refresh bgp all import
<R2>display bgp routing-table community
*> 1.1.2.1/32 12.1.1.1 0 0 <100:1>
*> 1.1.3.1/32 12.1.1.1 0 0 <100:2>
7.查看带community属性值路由
<R2>display bgp routing-table community 100:2
*> 1.1.3.1/32 12.1.1.1 0 0 <100:2>
8.R2通过策略控制路由
[R2]ip community-filter 1 permit 100:1
[R2]route-policy COMM permit node 10
[R2-route-policy]if-match community-filter 1
[R2]bgp 200
[R2-bgp]peer 12.1.1.1 route-policy COMM import
[R2-bgp]quit
[R2]quit
<R2>refresh bgp all import
<R2>display bgp routing-table
*> 1.1.2.1/32 12.1.1.1 0 0 100i
8.R2策略路由打上新的团体属性
[R2]route-policy COMM permit node 10
[R2-route-policy]apply community 200:1 additive
[R2-route-policy]quit
[R2]quit
<R2>refresh bgp all import
<R2>display bgp routing-table community
*> 1.1.2.1/32 12.1.1.1 0 0 <100:1>, <200:1>
9.R2把新的团体属性传递给R3,R3查看BGP路由community属性
[R2]bgp 200
[R2-bgp]peer 23.1.1.3 advertise-community
<R3>refresh bgp all import
<R3>display bgp routing-table community
*> 1.1.2.1/32 23.1.1.2 0 <100:1>, <200:1>
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
请登录后查看评论内容