实验需求: R1 R2 R3用环回口建立IBGP对等体(使用对等体组),AS号为100
R4 R5 R6用环回口建立IBGP对等体(使用对等体组),AS号为200
R2-R4、R3-R5用物理口建立EBGP对等体
通过修改 BGP路由 本地优先级和AS-PATH 属性完成一下要求
(1)
要求192.168.10.1->192.168.100.1 选路为R1->R2->R4->R6
要求192.168.100.1->192.168.10.1 选路为R6->R4->R2->R1
当R6--R4之间的链路down时,192.168.10.1<->192.168.100.1来回走R6<->R5<->R4<->R2<->R1
(2)
要求192.168.20.1->192.168.100.200 选路为R1->R3->R5->R6
要求192.168.200.1->192.168.100.20 选路为R6->R5->R3->R1
当R6--R5之间的链路down时,192.168.20.1<->192.168.100.200来回走R6<->R4<->R5<->R3<->R1
步骤:
1、 完成基本的配置
2、 完成AS 100和AS 200的OSPF的配置
[RT1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[RT1-ospf-1-area-0.0.0.0]network 192.168.1.5 0.0.0.0
[RT1-ospf-1-area-0.0.0.0]network 192.168.1.1 0.0.0.0
[RT2-ospf-1-area-0.0.0.0]network 192.168.1.2 0.0.0.0
[RT2-ospf-1-area-0.0.0.0]network 192.168.1.9 0.0.0.0
[RT2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[RT3-ospf-1-area-0.0.0.0]network 192.168.1.6 0.0.0.0
[RT3-ospf-1-area-0.0.0.0]network 192.168.1.10 0.0.0.0
[RT3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[RT4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[RT4-ospf-1-area-0.0.0.0]network 192.168.1.21 0.0.0.0
[RT4-ospf-1-area-0.0.0.0]network 192.168.1.25 0.0.0.0
[RT5-ospf-1-area-0.0.0.0]network 192.168.1.18 0.0.0.0
[RT5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[RT5-ospf-1-area-0.0.0.0]network 192.168.1.22 0.0.0.0
[RT6-ospf-1-area-0.0.0.0]network 192.168.1.26 0.0.0.0
[RT6-ospf-1-area-0.0.0.0]network 192.168.1.30 0.0.0.0
3、 完成BGP对等体的配置
[RT1-bgp]peer 2.2.2.2 as 100
[RT1-bgp]peer 3.3.3.3 as 100
[RT1-bgp]peer 2.2.2.2 co loo 1
[RT1-bgp]peer 3.3.3.3 co loo 1
[RT2-bgp]peer 192.168.1.14 as 200
[RT3-bgp]peer 192.168.1.18 as 200
[RT5-bgp]peer 192.168.1.17 as 100
[RT5-bgp]peer 4.4.4.4 as 200
[RT5-bgp]peer 6.6.6.6 as 200
[RT5-bgp]peer 4.4.4.4 con lo 1
[RT5-bgp]peer 6.6.6.6 con lo 1
[RT4-bgp]peer 6.6.6.6 as 200
[RT4-bgp]peer 5.5.5.5 as 200
[RT4-bgp]peer 6.6.6.6 con lo 1
[RT4-bgp]peer 5.5.5.5 con lo 1
[RT6-bgp]peer 5.5.5.5 as 200
[RT6-bgp]peer 4.4.4.4 as 200
[RT6-bgp]peer 5.5.5.5 con loo 1
4、 注入业务流
[RT6-bgp]network 192.168.100.1 32
[RT6-bgp]network 192.168.200.1 32
[RT2-bgp]peer 1.1.1.1 next-hop-local
[RT3-bgp]peer 1.1.1.1 next-hop-local
[RT1-bgp]network 192.168.20.1 32
[RT4-bgp]peer 6.6.6.6 next-hop-local
[RT5-bgp]peer 6.6.6.6 next-hop-local
5、 创建route-policy并调用
[RT6-Serial0/1/0]ospf cost 1
[RT6]ip ip-prefix filter_a permit 192.168.10.1 32
[RT6]route-policy filter_a permit node 10
[RT6-route-policy]if-match ip-prefix filter_a
[RT6-route-policy]apply as-path 300 400
[RT6]route-policy filter_a permit node 20
[RT6-bgp]peer 5.5.5.5 route-policy filter_a import
[RT6-acl-basic-2000]rule permit source 192.168.20.1 0
[RT6-acl-basic-2000]rule permit
[RT6]route-policy filter_b permit node 10
[RT6-route-policy]if-match acl 2000
[RT6-route-policy]apply local-preference 400
[RT6]route-policy filter_b permit node 20
[RT6-bgp]peer 5.5.5.5 route-policy filter_b import
[RT1-acl-basic-2000]rule permit source 192.68.200.1 0
[RT1-acl-basic-2000]rule permit
[RT1]route-policy filter_b permit node 10
[RT1-route-policy]if-match acl 2000
[RT1-route-policy]apply local-preference 400
[RT1]route-policy filter_b permit node 20
[RT1-bgp]peer 3.3.3.3 route-policy filter_b import
[RT4-bgp]peer 192.168.1.13 route-policy filter_a import
[RT4]route-policy filter_a permit node 10
[RT4-route-policy]if-match acl 2002
[RT4-bgp]peer 192.168.1.13 route-policy filter_a import
6、 结果测试
要求192.168.10.1->192.168.100.1 选路为R1->R2->R4->R6
要求192.168.100.1->192.168.10.1 选路为R6->R4->R2->R1
当R6--R4之间的链路down时,192.168.10.1<->192.168.100.1来回走R6<->R5<->R4<->R2<->R1
要求192.168.20.1->192.168.100.200 选路为R1->R3->R5->R6
要求192.168.200.1->192.168.100.20 选路为R6->R5->R3->R1
当R6--R5之间的链路down时,192.168.20.1<->192.168.200.1来回走R6<->R4<->R5<->R3<->R1