要求
R1的环回并没有宣告进OSPF网络,需要通过重发布导入到OSPF网络。
保证全网可达,且没有路由回馈以及选路不佳。
配置
R1
[R1] interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0] ip address 192.168.12.1 24
[R1] interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1] ip address 192.168.13.1 24
[R1] interface loopback0
[R1-LoopBack0] ip address 1.1.1.1 24[R1] ospf 1 router-id 1.1.1.1
[R1-ospf-1] import-route direct
[R1-ospf-1] area 0
[R1-ospf-1-area-0.0.0.0] network 192.168.12.0 0.0.0.0
[R1-ospf-1-area-0.0.0.0] network 192.168.13.0 0.0.0.0
R2
[R2] interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0] ip address 192.168.12.2 24
[R2] interface GigabitEthernet 0/0/1
[R2-GigabitEthernet0/0/1] ip address 192.168.24.2 24
[R2] ospf 1 router-id 2.2.2.2
[R2-ospf-1] area 0
[R2-ospf-1-area-0.0.0.0] network 192.168.12.0 0.0.0.0
[R2-ospf-1-area-0.0.0.0] quit
[R2] rip
[R2-rip-1] version 2
[R2-rip-1] network 192.168.24.0
R3
[R3] interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0] ip address 192.168.13.3 24
[R3] interface GigabitEthernet 0/0/1
[R3-GigabitEthernet0/0/1] ip address 192.168.34.3 24
[R3] ospf 1 router-id 3.3.3.3
[R3-ospf-1] area 0
[R3-ospf-1-area-0.0.0.0] network 192.168.13.0 0.0.0.0
[R3-ospf-1-area-0.0.0.0] quit
[R3] rip
[R3-rip-1] version 2
[R3-rip-1] network 192.168.34.0
R4
[R4] interface GigabitEthernet 0/0/0
[R4-GigabitEthernet0/0/0] ip address 192.168.24.4 24
[R4] interface GigabitEthernet 0/0/1
[R4-GigabitEthernet0/0/1] ip address 192.168.34.4 24
[R4] rip
[R4-rip-1] version 2
[R4-rip-1] network 192.168.24.0[R4-rip-1] network 192.168.34.0
在R2及R3上执行双向路由重发布
[R2] ospf 1
[R2-ospf-1] import-route rip
[R2] rip
[R2-rip-1] import-route ospf 1
[R3] ospf 1
[R3-ospf-1] import-route rip
[R3] rip
[R3-rip-1] import-route ospf 1
路径优化
[R2]ip ip-prefix aa permit 1.1.1.0 24
[R2]route-policy aa permit node 10
[R2-route-policy]if-match ip-prefix aa
[R2-route-policy]apply preference 90
[R2-route-policy]q
[R2]ospf 1
[R2-ospf-1]preference ase route-policy aa
[R3]ip ip-prefix aa permit 1.1.1.0 24
[R3]route-policy aa permit node 10
[R3-route-policy]if-match ip-prefix aa
[R3-route-policy]apply preference 90
[R3-route-policy]q
[R3]ospf 1
[R3-ospf-1]preference ase route-policy aa