实验拓扑如图:
配IP
先按要求起RIP及OSPF,并在R2,R4作双点双向重发布
双点双向重发布会导致选路不佳,我们需要用路由策略干涉选路
[r1]rip 1
[r1-rip-1]version 2
[r1-rip-1]un summary
[r1-rip-1]network 1.0.0.0
[r1-rip-1]network 12.0.0.0
[r1-rip-1]network 41.0.0.0
[r2]rip 1
[r2-rip-1]version 2
[r2-rip-1]un summary
[r2-rip-1]network 12.0.0.0
[r2-rip-1]network 2.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.1 0.0.0.0
[r3]ospf router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 23.1.1.2 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 34.1.1.1 0.0.0.0
[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
[r4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[r4-ospf-1]q
[r4]rip 1
[r4-rip-1]version 2
[r4-rip-1]un summary
[r4-rip-1]network 41.0.0.0
双点双向重发布
[r2]ospf 1
[r2-ospf-1]import-route rip 1
[r2-ospf-1]q
[r2]rip 1
[r2-rip-1]import-route ospf 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]ip ip-prefix pp permit 2.2.2.0 24
[r1]ip ip-prefix pp permit 23.1.1.0 24
[r1]ip ip-prefix pp permit 41.0.0.0 24
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]rip metricin ip-prefix pp 2
[r1]int g 0/0/1
[r1-GigabitEthernet0/0/1]rip metricin ip-prefix pp 2
[r2]ip ip-prefix pp permit 1.1.1.0 24
[r2]ip ip-prefix pp permit 23.0.0.0 24
[r2]ip ip-prefix pp permit 14.0.0.0 24
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]rip metricin ip-prefix pp 2
[r2-GigabitEthernet0/0/1]q
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]rip metricin ip-prefix pp 2
[r3]ip ip-prefix pp permit 2.2.2.0 24
[r3]ip ip-prefix pp permit 23.1.1.0 24
[r3]ip ip-prefix pp permit 34.1.1.0 24
[r3]int g0/0/1
[r3-GigabitEthernet0/0/1]rip metricin ip-prefix pp 2
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]rip metricin ip-prefix pp 2
[r4]ip ip-prefix yy permit 1.1.1.0 24
[r4]ip ip-prefix yy permit 41.0.0.0 24
[r4]ip ip-prefix yy permit 34.0.0.0 24
[r4]int g0/0/1
[r4-GigabitEthernet0/0/1]rip metricin ip-prefix yy 2
[r4]int g 0/0/0
[r4-GigabitEthernet0/0/0]rip metricin ip-prefix yy 2