一、思路 ;
1.增加不优选路开销解决选路不佳问题
2.用增加开销的方式使R1 不将ASBR传的R7传给另一台ASBR解决R1、R2、R3、R4pingR7环回环路
二、操作
------IP地址配置如图
1.ospf及rip的宣告
rip:
[r1]rip 1
[r1-rip-1]version 2
[r1-rip-1]network 1.0.0.0
[r1-rip-1]network 12.0.0.0
[r1-rip-1]network 13.0.0.0
[r2]rip 1
[r2-rip-1]version 2
[r2-rip-1]network 12.0.0.0
[r2-rip-1]network 2.0.0.0
[r3]rip 1
[r3-rip-1]vers
[r3-rip-1]version 2
[r3-rip-1]net
[r3-rip-1]network 13.0.0.0
OSPF:
[r3]ospf 1
[r3-ospf-1]a 0
[r3-ospf-1-area-0.0.0.0]network 34.1.1.2 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[r4]ospf 1
[r4-ospf-1]a 0
[r4-ospf-1-area-0.0.0.0]network 24.1.1.2 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 34.1.1.1 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 45.1.1.1 0.0.0.0
[r5]ospf 1
[r5-ospf-1]a 0
[r5-ospf-1-area-0.0.0.0]network 45.1.1.2 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 56.1.1.1 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[r6]ospf 1
[r6-ospf-1]a 0
[r6-ospf-1-area-0.0.0.0]network 56.1.1.2 0.0.0.0
[r6-ospf-1-area-0.0.0.0]network 67.1.1.1 0.0.0.0
[r6-ospf-1-area-0.0.0.0]network 6.6.6.6 0.0.0.0
[r7]ospf 1
[r7-ospf-1]a 0
[r7-ospf-1-area-0.0.0.0]network 7.7.7.7 0.0.0.0
[r7-ospf-1-area-0.0.0.0]network 67.1.1.2 0.0.0.0
2.重发布
R7:
[r7]ospf 1
[r7-ospf-1]import-route direct
R2、R3双向重发布:
[r2-ospf-1]import-route rip 1
[r2-ospf-1]rip 1
[r2-rip-1]import-route ospf 1
[r2-rip-1]
[r3]ospf 1
[r3-ospf-1]import-route rip 1
[r3-ospf-1]rip 1
[r3-rip-1]import-route ospf 1
3.解决环路
[r2] ip ip-prefix a permit 7.7.7.0 24
[r2]route-policy huawei permit node 10
[r2-route-policy]if-match ip-prefix a
[r2-route-policy]apply cost 14
[r2-route-policy]q
[r3] ip ip-prefix a permit 7.7.7.0 24
[r3]route-policy huawei permit node 10
[r3-route-policy]if-match ip-prefix a
[r3-route-policy]apply cost 14
[r3-route-policy]q
[r2]ospf 1
[r2-ospf-1]import-route rip 1 route-policy huawei
[r3]ospf 1
[r3-ospf-1]import-route rip 1 route-policy huawei
4.解决选路不佳
R1
[r1]ip ip-prefix aa permit 24.1.1.0 24
[r1]ip ip-prefix bb permit 34.1.1.0 24
[r1]ip ip-prefix bb permit 3.3.3.3 32
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]rip metricin ip-prefix aa 2
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]rip metricin ip-prefix bb 2
[r1-GigabitEthernet0/0/1]
R4
[r3] ip ip-prefix b permit 12.1.1.0 24
[r3] ip ip-prefix b permit 2.2.2.024
[r2] ip ip-prefix b permit 13.1.1.0 24
[r2]route-policy hua permit node 10
[r2-route-policy]if-match ip-prefix b
[r2-route-policy]apply cost 7
[r2-route-policy]q
[r2]route-policy huawei permit node 30
[r3]route-policy huawei permit node 30
[r3]route-policy hua permit node 10
[r3-route-policy]if-match ip-prefix b
[r3-route-policy]apply cost 7
[r3-route-policy]q
[r3]route-policy huawei permit node 30
[r2]rip 1
[r2-rip-1]import-route ospf 1 route-policy hua
[r3]rip 1
[r3-rip-1]import-route ospf 1 route-policy hua
三、检验查看R1、R4路由表