一、配置路由器的接口及环回的IP地址,注意在配置r1,r2,r3的环回接口时要满足要求10
二、配置AS 123的IGP,使用OSPF
三、配置BGP,注意要满足要求9
四、前三个步骤不是本次实验的重点,故不再赘述。根据要求看实验配置
要求1:
[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]bgp 400
[r4-bgp]peer 24.0.0.2 route-policy PV import
--精细化修改---只能r4配置(入方向),因为修改的是PV属性,该属性仅具有本地意义,不会传递----默认0,越大越优
要求2:
[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 123 123 additive
[r4-route-policy]q
[r4]route-policy AS permit node 20
[r4-route-policy]q
[r4]bgp 400
[r4-bgp]peer 24.0.0.2 route-policy AS import
AS-Path 默认值0,越短越优。要想走r3,就得让r2的AS_Path数值长一点
MED数值越小越优。在EBGP对等体的入方向或出方向修改
要求3:
[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]route-policy MED permit node 20
[r4-route-policy]q
[r4]bgp 400
[r4-bgp]peer 24.0.0.2 route-policy MED import
要想通过r3,就得让r2的med改大/或者将r3的med改小
要求4:
精细化修改,r2/r3的出方向或r1的入方向。这里我们选择r1的入方向
[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]q
[r1]route-policy LP permit node 20
[r1]bgp 123
[r1-bgp]peer 2.2.2.2 route-policy LP import
要求5:
精细化修改,r2/r3的出方向或r1的入方向。这里我们选择r1的入方向
[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 300
[r1-route-policy]q
[r1]route-policy LP2 permit node 20
[r1-route-policy]q
[r1]bgp 123
[r1-bgp]peer 3.3.3.3 route-policy LP2 import