实验要求:
拓扑网搭建:
IP配置与环回接口配置:
R1
R2
R3
R4
R5
R6
R7
RIP与OSPF宣告:
4.6的邻居图如下:
3的通过RIP学到的路由如下
将R7的环回与rip,ospf进行重发布
[R7]ospf 1
[R7-ospf-1]import-route direct
[R7-ospf-1]q
[R7]
[R2]ospf 1
[R2-ospf-1]import-route rip
[R2-ospf-1]q
[R2]rip 1
[R2-rip-1]import-route ospf
[R2-rip-1]
[R3]rip 1
[R3-rip-1]import-route ospf
[R3-rip-1]
[R3-rip-1]q
[R3]ospf 1
[R3-ospf-1]import-route rip
[R3-ospf-1]
由于R7的环回重发布进OSPF后优先级会变成150,R4将R7环回给R2。R2重发布给R1此时R7的环回优先级在RIP中变为100,R1给R3,R3收到R1与R4给的到R7环回的路由,由于R4优先级为150,R1为100,故R3会选择优先级为100的R1的路由。又由于R4与R3是邻居,所以R3会将R1给的到R7的环回路由给R4,R4收到后比较优先级后发现相同,再次比较跳数(度量),发现到R3的度量小故选择R3给的路由,由此形成路由黑洞。
解决办法:
需将R3给R4到R7环回的路由优先级改大(比150大即可)或者将R4给R3到R7的路由优先级改小(比100小即可)
防止R2出现与R3相同的路由黑洞,需在R2配置相同的路由策略。
[R3]ip ip-prefix 34 permit 7.7.7.0 24
[R3]route-policy aa permit node 10
Info: New Sequence of this List.
[R3-route-policy]if-match ip-prefix 34
[R3-route-policy]apply preference 151
[R3-route-policy]q
[R3]rip 1
[R3-rip-1]preference route-policy aa
[R3-rip-1]q
[R2]ip ip-prefix b permit 7.7.7.0 24
[R2]route-policy dd permit node 10
Info: New Sequence of this List.
[R2-route-policy]if-match ip-prefix b
[R2-route-policy]apply preference 151
[R2-route-policy]q
[R2]rip 1
[R2-rip-1]preference route-policy dd
[R2-rip-1]q
路径选择最优:
修改度量,使R1到R4的路径选择最优
[R2]ip ip-prefix qq permit 3.3.3.3 24
[R2]ip ip-prefix qq permit 34.1.1.0 24
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]rip metricout ip-prefix qq 2
[R2-GigabitEthernet0/0/0]q
[R2]
[R3]ip ip-prefix ww permit 24.1.1.0 24
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]rip metricout ip-prefix ww 2
[R3-GigabitEthernet0/0/1]q
修改类型,使R4到R1的路径最佳
[R2]ip ip-prefix ee permit 2.2.2.0 24
[R2]ip ip-prefix ee permit 12.1.1.0 24
[R2]route-policy rr permit node 10
Info: New Sequence of this List.
[R2-route-policy]if-match ip-prefix ee
[R2-route-policy]apply cost-type type-1
[R2-route-policy]q
[R2]route-policy rr permit node 20
Info: New Sequence of this List.
[R2-route-policy]q
[R2]ospf 1
[R2-ospf-1]import-route rip route-policy rr
[R2-ospf-1]
[R3]ip ip-prefix tt permit 13.1.1.0 24
[R3]route-policy yy permit node 10
Info: New Sequence of this List.
[R3-route-policy]apply cost-type type-1
[R3-route-policy]q
[R3]route-policy yy permit node 20
Info: New Sequence of this List.
[R3-route-policy]q
[R3]ospf 1
[R3-ospf-1]import-route rip route-policy yy
[R3-ospf-1]q
[R3