BGP综合实验
一、配置IP地址与环回
二、IGP协议(OSPF)
[R1]ospf 1 rou 1.1.1.1
[R1-ospf-1]a 0
[R1-ospf-1-area-0.0.0.0]net 1.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]net 12.0.0.2 0.0.0.0
[R1-ospf-1-area-0.0.0.0]net 13.0.0.2 0.0.0.0
[R1-ospf-1-area-0.0.0.0]net 192.168.100.1 0.0.0.0
[R2]ospf 1 rou 2.2.2.2
[R2-ospf-1]a 0
[R2-ospf-1-area-0.0.0.0]net 2.2.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]net 192.168.20.1 0.0.0.0
[R2-ospf-1-area-0.0.0.0]net 12.0.0.1 0.0.0.0
[R3]ospf 1 rou 3.3.3.3
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]net 3.3.3.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]net 192.168.30.1 0.0.0.0
[R3-ospf-1-area-0.0.0.0]net 13.0.0.1 0.0.0.0
三、更改环回接口类型为Broadcast
[R1]int l1
[R1-LoopBack1]ospf network-type broadcast
[R2]int l1
[R2-LoopBack1]ospf network-type broadcast
[R3]int l1
[R3-LoopBack1]ospf network-type broadcast
四、BGP
[R1]bgp 123
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 2.2.2.2 as 123
[R1-bgp]peer 2.2.2.2 con l0
[R1-bgp]peer 2.2.2.2 next-hop-local
[R1-bgp]peer 3.3.3.3 as 123
[R1-bgp]peer 3.3.3.3 con l0
[R1-bgp]peer 3.3.3.3 next-hop-local
[R1-bgp]peer 15.0.0.5 as 500
[R2]bgp 123
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 24.0.0.4 as 400
[R2-bgp]peer 1.1.1.1 as 123
[R2-bgp]peer 1.1.1.1 con l0
[R2-bgp]peer 1.1.1.1 next-hop-local
[R3]bgp 123
[R3-bgp]router-id 3.3.3.3
[R3-bgp]peer 34.0.0.4 as 400
[R3-bgp]peer 1.1.1.1 as 123
[R3-bgp]peer 1.1.1.1 con l0
[R3-bgp]peer 1.1.1.1 next-hop-local
[R4]bgp 400
[R4-bgp]router-id 4.4.4.4
[R4-bgp]peer 24.0.0.2 as 123
[R4-bgp]peer 34.0.0.3 as 123
[R5]bgp 500
[R5-bgp]router-id 5.5.5.5
[R5-bgp]peer 15.0.0.1 as 123
五、BGP宣告
[R4]bgp 400
[R4-bgp]net 192.168.1.0 24
[R4-bgp]net 192.168.2.0 24
[R4-bgp]net 192.168.3.0 24
[R2]bgp 123
[R2-bgp]net 192.168.20.0 24
[R3]bgp 123
[R3-bgp]net 192.168.30.0 24
[R1]bgp 123
[R1-bgp]net 192.168.100.0 24
[R5]bgp 500
[R5-bgp]net 192.168.10.0 24
[R5-bgp]net 192.168.11.0 24
[R5-bgp]net 192.168.12.0 24
六、使用策略,满足题目要求
1.使用PreVa1策略,确保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
Info: New Sequence of this List.
[r4-route-policy]if-match ip-prefix PV
[r4-route-policy]apply preferred-value 100
Info: New Sequence of this List.
[r4]bgp 400
[r4-bgp]peer 24.0.0.4 route-policy PV import
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 11 22 33 overwrite
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 MED permit node 20
4.使用Local Perference策略,确保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-preference 200
[r1]route-policy LP permit node 20
5.使用Local Perference策略,确保R1通过R3到达192.168.2.0/24
[r1]ip ip-prefix LP1 permit 192.168.2.0 24
[r1]route-policy LP1 permit node 10
[r1-route-policy]if-match ip-prefix LP1
[r1-route-policy]apply local-preference 200
[r1]route-policy LP1 permit node 20
6.配置负载均衡,确保R1通过R2和R3到达192.168.3.0/24
[r1-bgp]maximum load-balancing 2