ospf 不同区域间通信

  拓扑图如下:

配置如下:

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   

  虚链路只配置在区域边界路由器上面。相连的两个路由器都需要配置虚链路

环回口默认的网络类型。                                                                                              R1#show interfaces loo0
Loopback0 is up, line protocol is up
  Hardware is Loopback
  Internet address is 1.1.1.1/24
  MTU 1514 bytes, BW 8000000 Kbit, DLY 5000 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation LOOPBACK, loopback not set
  Last input never, output never, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/0 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     0 packets input, 0 bytes, 0 no buffer
     Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     0 packets output, 0 bytes, 0 underruns
     0 output errors, 0 collisions, 0 interface resets
     0 output buffer failures, 0 output buffers swapped out