配置完成后会出现选路不佳的情况,需要进行改进
``
R1
sysname r1
#
interface GigabitEthernet0/0/0
ip address 12.1.1.1 255.255.255.0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 12.1.1.0 0.0.0.255
R2
sysname r2
#
interface GigabitEthernet0/0/0
ip address 12.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 23.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 25.1.1.1 255.255.255.0
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.0
#
ospf 1 router-id 2.2.2.2
preference ase 80
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 12.1.1.0 0.0.0.255
network 23.1.1.0 0.0.0.255
network 25.1.1.0 0.0.0.255
R3
sysname r3
#
interface GigabitEthernet0/0/0
ip address 23.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 34.1.1.1 255.255.255.0
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.0
#
ospf 1 router-id 3.3.3.3
import-route rip 1
preference ase 80
area 0.0.0.0
network 23.1.1.0 0.0.0.255
#
rip 1
undo summary
version 2
network 34.0.0.0
network 3.0.0.0
import-route ospf 1 route-policy r3
#
route-policy r3 permit node 10
if-match ip-prefix r3
apply cost 3
#
route-policy r3 permit node 20
#
ip ip-prefix r3 index 1 permit 4.4.4.0 24
ip ip-prefix r3 index 2 permit 34.1.1.0 24
ip ip-prefix r3 index 3 permit 45.1.1.0 24
R4
sysname r4
#
interface GigabitEthernet0/0/0
ip address 34.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 45.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface LoopBack0
ip address 4.4.4.4 255.255.255.0
#
rip 1
undo summary
version 2
network 4.0.0.0
network 34.0.0.0
network 45.0.0.0
R5
sysname r5
#
interface GigabitEthernet0/0/0
ip address 45.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 25.1.1.2 255.255.255.0
#
interface LoopBack0
ip address 5.5.5.5 255.255.255.0
#
ospf 1 router-id 5.5.5.5
import-route rip 1
preference ase 80
area 0.0.0.0
network 25.1.1.0 0.0.0.255
#
rip 1
undo summary
version 2
network 45.0.0.0
network 5.0.0.0
import-route ospf 1
#
route-policy r5 permit node 10
if-match ip-prefix R5
apply cost 3
#
route-policy r55 permit node 20
#
ip ip-prefix R5 index 5 permit 4.4.4.4 32
ip ip-prefix R5 index 1 permit 34.1.1.0 24
ip ip-prefix R5 index 2 permit 45.1.1.0 24
#