OSPF不同区域间通信:
拓扑图如下:
![](/uploads/allimg/120520/1-12052000342D92.png)
配置如下:
R1:interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface Serial1/0
ip address 12.1.1.1 255.255.255.0
serial restart-delay 0
!
router ospf 1
log-adjacency-changes
network 1.1.1.0 0.0.0.255 area 0
network 12.1.1.0 0.0.0.255 area 0
R2:
interface Serial1/0
ip address 12.1.1.2 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
ip address 23.1.1.1 255.255.255.0
serial restart-delay 0
!
router ospf 1
log-adjacency-changes
area 1 virtual-link 2.2.2.2
network 12.1.1.0 0.0.0.255 area 0
network 23.1.1.0 0.0.0.255 area 1
R3:interface Loopback0
ip address 2.2.2.2 255.255.255.0
ip ospf network point-to-point
!
interface Serial1/0
ip address 23.1.1.2 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
ip address 34.1.1.1 255.255.255.0
serial restart-delay 0
!
router ospf 1
log-adjacency-changes
area 1 virtual-link 23.1.1.1
network 2.2.2.0 0.0.0.255 area 1
network 23.1.1.0 0.0.0.255 area 1
network 34.1.1.0 0.0.0.255 area 2
!
R4:interface Loopback0
ip address 4.4.4.4 255.255.255.0
ip ospf network point-to-point
!
interface Serial1/0
ip address 34.1.1.2 255.255.255.0
serial restart-delay 0
!
router ospf 1
log-adjacency-changes
network 4.4.4.0 0.0.0.255 area 2
network 34.1.1.0 0.0.0.255 area 2
!
不同区域间通信:
骨干区域与非骨干区域(图中的区域0和区域1)之间的通信,这个的不同区域间通信就不需要配置虚链路。如果区域不直接连接到骨干区域就要配置虚链路。 虚链路的配置:area 本地区域ID virtual-link 对方路由器的router ID,虚链路只配置在区域边界路由器上面。相连的两个路由器都需要配置虚链路。