R1-R4依次类推
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[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 14.0.0.0
[r2]rip 1
[r2-rip-1]version 2
[r2-rip-1]network 2.0.0.0
[r2-rip-1]network 12.0.0.0
[r2-rip-1]q
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 23.1.1.2 0.0.0.0
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[r4]rip 1
[r4-rip-1]version 2
[r4-rip-1]network 14.0.0.0
[r4-rip-1]q
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]network 34.1.1.2 0.0.0.0
宣告完成后,我们会发现:R1和R3只有各区域的路由;R2和R4有全网的路由
R1
R3
R2
R4
[r2]rip
[r2-rip-1]import-route ospf 1
[r2-rip-1]q
[r2]ospf 1
[r2-ospf-1]import-route rip 1
[r4]rip 1
[r4-rip-1]import-route ospf 1
[r4-rip-1]q
[r4]ospf 1
[r4-ospf-1]import-route rip 1
做完双向重发布后我们会发现:R1和R3拥有了全网的路由,但是出现了选路不佳
R1
R3
要求:
[r4]ip ip-prefix aa permit 23.1.1.0 24
[r4]interface g0/0/1
[r4-GigabitEthernet0/0/1]rip metricout ip-prefix aa 2
[r2]ip ip-prefix bb permit 34.1.1.0 24
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]rip metricout ip-prefix bb 2
[r2]ip ip-prefix cc deny 4.4.4.0 24
[r2]ip ip-prefix cc permit 0.0.0.0 0 le
[r2]ip ip-prefix cc permit 0.0.0.0 0 less-equal 32
[r2]rip 1
[r2-rip-1]filter-policy ip-prefix cc export g0/0/0
[r1]ip ip-prefix dd deny 2.2.2.0 24
[r1]ip ip-prefix dd permit 0.0.0.0 0 less-equal 32
[r1]rip
[r1-rip-1]filter-policy ip-prefix dd import
[r4]ip ip-prefix ee permit 12.1.1.0 24
[r4]route-policy huazi deny node 10
Info: New Sequence of this List.
[r4-route-policy]if-match ip-prefix ee
[r4-route-policy]apply cost 3
[r4-route-policy]q
[r4]route-policy huazi permit node 20
Info: New Sequence of this List.
[r4-route-policy]q
[r4]ospf 1
[r4-ospf-1]import-route rip 1 route-policy huazi
[r2]ip ip-prefix ff permit 14.1.1.0 24
[r2]route-policy huazi deny node 10
Info: New Sequence of this List.
[r2-route-policy]if-match ip-prefix ff
[r2-route-policy]apply cost 3
[r2-route-policy]q
[r2]route-policy huazi permit node 20
Info: New Sequence of this List.
[r2-route-policy]q
[r2]ospf 1
[r2-ospf-1]import-route rip 1 route-policy huazi
干涉完选路之后,我们发现,R1和R3的路由表选路最佳
R1
R3