一、实验拓扑
![华为路由器OSPF+RIP+静态路由配置实例_第1张图片](http://img.e-com-net.com/image/info8/edfd26b79c924bb7964448b11fadc1f9.jpg)
二、路由器配置
AR1配置:
#
interface GigabitEthernet0/0/0
ip address 192.168.1.1 255.255.255.0
ospf enable 1 area 0.0.0.1
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
ospf 1 router-id 1.1.1.1
import-route direct
area 0.0.0.1
#
AR2配置:
#
interface GigabitEthernet0/0/0
ip address 192.168.2.1 255.255.255.0
ospf enable 1 area 0.0.0.1
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
#
ospf 1 router-id 2.2.2.2
import-route direct
area 0.0.0.1
#
AR3配置:
#
interface GigabitEthernet0/0/0
ip address 192.168.1.2 255.255.255.0
ospf enable 1 area 0.0.0.1
#
interface GigabitEthernet0/0/1
ip address 192.168.2.2 255.255.255.0
ospf enable 1 area 0.0.0.1
#
interface GigabitEthernet0/0/2
ip address 192.168.3.1 255.255.255.0
ospf enable 1 area 0.0.0.0
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
#
ospf 1 router-id 3.3.3.3
import-route direct
area 0.0.0.0
area 0.0.0.1
#
AR4配置:
#
interface GigabitEthernet0/0/0
ip address 192.168.3.2 255.255.255.0
ospf enable 1 area 0.0.0.0
#
interface GigabitEthernet0/0/1
ip address 192.168.4.1 255.255.255.0
ospf enable 1 area 0.0.0.2
#
interface LoopBack0
ip address 4.4.4.4 255.255.255.255
#
ospf 1 router-id 4.4.4.4
import-route direct
area 0.0.0.0
area 0.0.0.2
#
AR5配置:
#
interface GigabitEthernet0/0/0
ip address 192.168.4.2 255.255.255.0
ospf enable 1 area 0.0.0.2
#
interface GigabitEthernet0/0/1
ip address 192.168.5.1 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 192.168.8.2 255.255.255.0
#
interface LoopBack0
ip address 5.5.5.5 255.255.255.255
#
ospf 1 router-id 5.5.5.5
import-route direct ###引入直连路由
import-route static ###引入静态路由
import-route rip 1 ###引入RIP路由
area 0.0.0.2
#
rip 1
undo summary
version 2
network 192.168.4.0
network 192.168.5.0
network 192.168.8.0
import-route ospf 1 ###引入OSPF路由
#
ip route-static 7.7.7.7 255.255.255.255 192.168.5.2
ip route-static 192.168.6.0 255.255.255.0 192.168.5.2
#
AR6配置:
#
interface GigabitEthernet0/0/0
ip address 192.168.5.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.6.1 255.255.255.0
#
ip route-static 0.0.0.0 0.0.0.0 192.168.5.1
ip route-static 7.7.7.7 255.255.255.255 192.168.6.2
#
AR7配置:
#
interface GigabitEthernet0/0/0
ip address 192.168.6.2 255.255.255.0
#
interface LoopBack0
ip address 7.7.7.7 255.255.255.255
#
ip route-static 0.0.0.0 0.0.0.0 192.168.6.1
#
AR8配置:
#
interface GigabitEthernet0/0/0
ip address 192.168.8.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.9.2 255.255.255.0
#
rip 1
undo summary
version 2
network 192.168.8.0
network 192.168.9.0
#
AR9配置:
#
interface GigabitEthernet0/0/0
ip address 192.168.9.1 255.255.255.0
#
rip 1
undo summary
version 2
network 192.168.9.0
#
三、测试
![华为路由器OSPF+RIP+静态路由配置实例_第2张图片](http://img.e-com-net.com/image/info8/41b27d216d304f1f9e62c7729fa478cd.jpg)