配置地址,AS123使用ospf保证通讯,修改接口类型保证ospf学习环回20.0,30.0,100.0 地址时,是以24位掩码学习,R1,R2,R3都处于BGP边界,各自都需要宣告三者的私网环回
1,
[R4]ip ip-prefix aa permit 192.168.10.0 24
[R4]route-policy aa permit node 10
[R4-route-policy]if-match ip-prefix aa
[R4-route-policy]apply preferred-value 100
[R4]route-policy aa permit node 20
[R4]bgp 400
[R4-bgp]peer 42.1.1.2 route-policy aa import
[R4-bgp]
2,
[R4]ip ip-prefix bb permit 192.168.11.0 24
[R4]route-policy aa permit node 15
[R4-route-policy]if-match ip-prefix bb
[R4-route-policy]apply as-path 123 123 500 overwrite ---使用已出现的AS号
Warning: The AS-Path lists of routes to which this route-policy is applied will
be overwritten. Continue? [Y/N]y
3,R2
[Huawei]ip ip-prefix aa permit 192.168.12.0 24
[Huawei]route-policy aa permit node 10
[Huawei-route-policy]if-match ip-prefix aa
[Huawei-route-policy]apply cost 200
[Huawei]route-policy aa permit node 20
[Huawei]bgp 123
[Huawei-bgp]peer 42.1.1.4 route-policy aa export
R3:
[Huawei]ip ip-prefix aa permit 192.168.12.0 24
[Huawei]route-policy aa permit node 10
[Huawei-route-policy]if-match ip-prefix aa
[Huawei-route-policy]apply cost 20
[Huawei]route-policy aa permit node 20
[Huawei]bgp 123
[Huawei-bgp]peer 43.1.1.4 route-policy aa export
4,5
[Huawei]ip ip-prefix aa permit 192.168.1.0 24
[Huawei]ip ip-prefix bb permit 192.168.2.0 24
[Huawei]route-policy aa permit node 10
[Huawei-route-policy]if-match ip-prefix aa
[Huawei-route-policy]apply local-preference 200
[Huawei]route-policy aa permit node 20
[Huawei]route-policy bb permit node 10
[Huawei-route-policy]if-match ip-prefix bb
[Huawei-route-policy]apply local-preference 200
[Huawei]route-policy bb permit node 20
[Huawei]bgp
[Huawei]bgp 123
[Huawei-bgp]peer 2.2.2.2 route-policy aa import
[Huawei-bgp]peer 3.3.3.3 route-policy bb import
[Huawei-bgp]
6,
[Huawei]bgp 123
[Huawei-bgp]maximum load-balancing 2
7,
[Huawei]ip as-path-filter 1 deny ^123$
[Huawei]ip as-path-filter 1 permit .*
[Huawei]bgp 500
[Huawei-bgp]peer 15.1.1.1 as-path-filter 1 import
8,
[Huawei]ip ip-prefix cc permit 192.168.3.0 24
[Huawei]route-policy aa permit node 15
[Huawei-route-policy]if-match ip-prefix cc
[Huawei-route-policy]apply community no-export
[Huawei]route-policy bb permit node 15
[Huawei-route-policy]if-match ip-prefix cc
[Huawei-route-policy]apply community no-export