思路:合理划分IP地址,配置IP地址及环回,测试直连可通。修改AS 123中的用户网段为Broadcast,启动OSPF。启动BGP。测试全网可达然后进行拓展配置。
1.配置IP地址及环回
启动OSPF时注意R2不能宣告10.24.0.0/24的网段,R3不能宣告10.34.0.0/24,R1不能宣告10.15.0.0/24的网段。
2.修改AS 123的环回用户网段为Brodcast
3.启动bgp
启动完后设所有设备需要检查对等体是否建立完成
宣告BGP路由
路由学习情况
4.配置拓展配置
即实现相关要求
1.使用PreVal策略,确保R4通过R2到达192.168.10.0/24
[r4]ip ip-prefix PV permit 192.168.10.0 24
[r4]route-policy PV permit node 10
[r4-route-policy]if-match ip-prefix PV
[r4-route-policy]apply preferred-value 400
[r4-route-policy]q
[r4]route-policy PV permit node 100
Info: New Sequence of this List.
[r4-route-policy]q
[r4]bgp 400
[r4-bgp]peer 10.24.0.2 route-policy PV im
[r4-bgp]peer 10.24.0.2 route-policy PV import
[r4-bgp]dis bgp rou
[r4-bgp]dis bgp routing-table 192.168.10.0
2.使用AS_Path策略,确保R4通过R3到达192.168.11.0/24
[r4]ip ip-prefix AS permit 192.168.11.0 24
[r4]route-policy AS permit node 10
[r4-route-policy]if-match ip-prefix AS
[r4-route-policy]apply as-path 400 overwrite
Warning: The AS-Path lists of routes to which this route-policy is applied will
be overwritten. Continue? [Y/N]y
[r4-route-policy]q
[r4]bgp 400
[r4-bgp]peer 10.34.0.3 route-policy AS import
3.配置MED策略,确保R4通过R3到达192.168.12.0/24
[r4]ip ip-prefix MED permit 192.168.12.0 24
[r4]route-policy MED permit node 10
[r4-route-policy]if-match ip-prefix MED
[r4-route-policy]apply cost 20
[r4-route-policy]q
[r4]bgp 400
[r4-bgp]peer 10.24.0.2 route-policy MED import
4.使用Local Preference策略,确保R1通过R2到达192.168.1.0/24
[r1]ip ip-prefix LP permit 192.168.1.0 24
[r1]route-policy LP permit node 10
[r1-route-policy]if-match ip-prefix LP
[r1-route-policy]apply local-preferenc 200
[r1-route-policy]q
[r1]bgp 123
[r1-bgp]peer 2.2.2.2 route-policy LP import
5.使用Local Preference策略,确保R1通过R2到达192.168.2.0/24
[r1]ip ip-prefix LP permit 192.168.2.0 24
[r1]route-policy LP permit node 20
[r1-route-policy]if-match ip-prefix LP
[r1-route-policy]apply local-preference 200
[r1-route-policy]q
[r1]bgp 123
[r1-bgp]peer 2.2.2.2 route-policy LP import
6.配置负载均衡,确保R1通过R2和R3到达192.168.3.0/24
[r1]bgp 123
[r1-bgp]maximum load-balancing 2
7.使用AS策略,AS 500不接受任何始发于AS 123的路由
[r5]ip as-path-filter 1 deny ^123$
[r5]route-policy aa permit node 10
[r5-route-policy]if-match as-path-filter 1
[r5]route-policy aa permit node 100
[r5]bgp 500
[r5-bgp]peer 10.15.0.1 route-policy aa export