注意:所有的区域都必须与骨干区域(area0)相连 (也可以使用虚连接让非骨干区域与骨干区域建立一条逻辑上的连接通道)
目的:R1 ping通 R4
R1:
interface GigabitEthernet0/0
ip address 172.16.10.1 255.255.255.0
no shutdown #开启接口
exit
router ospf 10 #开启ospf 进程号为10
network 172.16.10.0 0.0.0.255 area 1 #宣告直连的网段;网段的反掩码;其直连的网段属于area1区域
R2:
interface GigabitEthernet0/0
ip address 172.16.10.2 255.255.255.0
no shu
interface GigabitEthernet0/1
ip address 172.16.20.1 255.255.255.0
no shu
exit
router ospf 10
network 172.16.10.0 0.0.0.255 area 1 #宣告直连,其直连的网段属于area1 区域
network 172.16.20.0 0.0.0.255 area 0 #area0是骨干区域
R3:
interface GigabitEthernet0/0
ip address 172.16.20.2 255.255.255.0
no shu
interface GigabitEthernet0/1
ip address 172.16.30.1 255.255.255.0
no shu
exit
router ospf 10
network 172.16.20.0 0.0.0.255 area 0
network 172.16.30.0 0.0.0.255 area 2
R4:
interface GigabitEthernet0/0
ip address 172.16.30.2 255.255.255.0
no shu
exit
router ospf 10
network 172.16.30.0 0.0.0.255 area 2
查看R1路由表
R1 ping R4