要求:
1、使用preval策略,确保R4通过R2到达192.168.10.0/24
2、使用AS Path策略,确保R4通过R3到达192.168.11.0/24
3、配置MED策略,确保R4通过R3到达192.168.12.0/24
4、使用Local Preference策略,确保R1通过R2到达192.168.1.0/24
5、使用Local Preference策略,确保R1通过R3到达192.168.2.0/24
6、配置负载均衡,确保R1通过R2和R3到达192.168.3.0/24
7、使用As策略,AS 500不接受任何始发于AS 123的路由
8、使用自定义Community策略,确保192.168.3.0/24路由不会被发布到AS 500
9、IBGP使用环回接口建邻,EBGP使用物理接口建邻
10、修改AS 123中的用户网段为Broadcast,方便后续在BGP中宣告
11、BGP宣告路由时,仅宣告24网段的用户路由
配置IP和环回地址
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip ad 12.0.0.1 24
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip ad 13.0.0.1 24
[R1-GigabitEthernet0/0/1]int g0/0/2
[R1-GigabitEthernet0/0/2]ip ad 15.0.0.1 24
[R1-GigabitEthernet0/0/2]int l 0
[R1-LoopBack0]ip ad 1.1.1.1 32
[R1-LoopBack0]int l 1
[R1-LoopBack1]ip ad 192.168.100.1 24
[R1-LoopBack1]ospf network-type broadcast
配置ospf,搭建IGP、
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 12.0.0.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 13.0.0.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 192.168.100.1 0.0.0.0
配置BGP
[R1]bgp 123
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 15.0.0.5 as-number 500
[R1-bgp]peer 2.2.2.2 as-number 123
[R1-bgp]peer 2.2.2.2 connect-interface l0
[R1-bgp]peer 2.2.2.2 next-hop-local
[R1-bgp]peer 3.3.3.3 as-number 123
[R1-bgp]peer 3.3.3.3 connect-interface l0
[R1-bgp]peer 3.3.3.3 next-hop-local
使用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 100
[R4-route-policy]q
[R4]route-policy PV permit node 20
[R4-route-policy]q
[R4]bgp 400
[R4-bgp]peer 24.0.0.2 route-policy PV import
配置MED策略
R2
[R2]ip ip-prefix MED permit 192.168.12.0 24
[R2]route-policy MED permit node 10
[R2-route-policy]if-match ip-prefix MED
[R2-route-policy]apply cost 200
[R2-route-policy]q
[R2]route-policy MED permit node 20
[R2]bgp 123
[R2-bgp]peer 24.0.0.4 route-policy MED export
使用Local Preference策略,确保R1通过R3到达192.168.2.0/24
[R1]ip ip-prefix LP2 permit 192.168.2.0 24
[R1]route-policy LP2 permit node 10
[R1-route-policy]if-match ip-prefix LP2
[R1-route-policy]apply local-preference 200
[R1-route-policy]q
[R1]route-policy LP2 permit node 20
[R1]bgp 123
[R1-bgp]peer 3.3.3.3 route-policy LP2 import
[R1]ip community-filter 1 permit 400:500
[R1]route-policy com deny node 10
[R1-route-policy]if-match community-filter 1
[R1-route-policy]q
[R1]route-policy com permit node 20
[R1]bgp 123
[R1]peer 15.0.0.5 route-policy com export