概要

OSPFのネットワークタイプについて、設定ミスの切り分けと修正を行います。一見、バーチャルリンクの設定ミスのように見えますが、バーチャルリンク自体の設定ミスではありません。

ネットワーク構成

下記のネットワーク構成でOSPFを利用したダイナミックルーティングを行っています。

図 設定ミスの切り分けと修正 Part4 ネットワーク構成

設定概要

各ルータのOSPFに関する設定の抜粋は次の通りです。これらの設定には、一部設定ミスがあります。

R1

interface Loopback0
 ip address 192.168.0.1 255.255.255.255
!
interface Ethernet0/0
 ip address 192.168.1.1 255.255.255.0
!
interface Ethernet0/1
 ip address 192.168.12.1 255.255.255.0
!
router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes
 network 192.168.0.0 0.0.255.255 area 0

R2

interface Loopback0
 ip address 192.168.0.2 255.255.255.255
!
interface Ethernet0/0
 ip address 192.168.12.2 255.255.255.0
!
interface Ethernet0/1
 ip address 192.168.23.2 255.255.255.0
!
router ospf 1
 router-id 2.2.2.2
 log-adjacency-changes
 area 1 virtual-link 4.4.4.4
 network 192.168.0.0 0.0.0.255 area 0
 network 192.168.12.0 0.0.0.255 area 0
 network 192.168.23.0 0.0.0.255 area 1

R3

interface Loopback0
 ip address 192.168.0.3 255.255.255.255
!
interface Ethernet0/0
 ip address 192.168.23.3 255.255.255.0
!
interface Ethernet0/1
 ip address 192.168.34.3 255.255.255.0
 ip ospf network point-to-point
!
router ospf 1
 router-id 3.3.3.3
 log-adjacency-changes
 network 192.168.0.0 0.0.255.255 area 1

R4

interface Loopback0
 ip address 192.168.0.4 255.255.255.255
!
interface Ethernet0/0
 ip address 192.168.34.4 255.255.255.0
!
interface Ethernet0/1
 ip address 192.168.45.4 255.255.255.0
!
router ospf 1
 router-id 4.4.4.4
 log-adjacency-changes
 area 1 virtual-link 2.2.2.2
 network 192.168.0.0 0.0.0.255 area 1
 network 192.168.34.0 0.0.0.255 area 1
 network 192.168.45.0 0.0.0.255 area 2

R5

interface Loopback0
 ip address 192.168.0.5 255.255.255.255
!
interface Ethernet0/0
 ip address 192.168.45.5 255.255.255.0
!
interface Ethernet0/1
 ip address 192.168.5.5 255.255.255.0
!
router ospf 1
 router-id 5.5.5.5
 log-adjacency-changes
 network 192.168.0.0 0.0.255.255 area 2

トラブルの症状

エリア2がエリア0と物理的に接続されていないので、R2-R4間でバーチャルリンクを設定しています。しかし、R2-R4間のバーチャルリンクが正常に動作していません。

R2 show ip ospf virtual-links

R2#show ip ospf virtual-links 
Virtual Link OSPF_VL0 to router 4.4.4.4 is down
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 1, Cost of using 65535
  Transmit Delay is 1 sec, State DOWN,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

R4 show ip ospf virtual-links

R4#show ip ospf virtual-links 
Virtual Link OSPF_VL0 to router 2.2.2.2 is down
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 1, Cost of using 65535
  Transmit Delay is 1 sec, State DOWN,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

R2-R4間のバーチャルリンクが正常に確立できていないので、R5からR1への通信ができません。また、R4からもR1への通信ができない状態です。

R4 show ip route

R4#show ip route 
~省略~

Gateway of last resort is not set

C    192.168.45.0/24 is directly connected, Ethernet0/1
O    192.168.5.0/24 [110/20] via 192.168.45.5, 00:19:12, Ethernet0/1
C    192.168.34.0/24 is directly connected, Ethernet0/0
     192.168.0.0/32 is subnetted, 2 subnets
C       192.168.0.4 is directly connected, Loopback0
O       192.168.0.5 [110/11] via 192.168.45.5, 00:19:12, Ethernet0/1

R5 show ip route

R5#show ip route 
~省略~

Gateway of last resort is not set

C    192.168.45.0/24 is directly connected, Ethernet0/0
C    192.168.5.0/24 is directly connected, Ethernet0/1
     192.168.0.0/32 is subnetted, 1 subnets
C       192.168.0.5 is directly connected, Loopback0

R1~R3は問題なく通信できています。

エリア0に接続していないエリア2内のR5だけでなく、R4からも正常に通信ができないことから、R3-R4間に何か問題があるのではないかと推測できます。問題を特定するために、R3、R4で次のshowコマンドを実行しました。

R3
show ip ospf neighbor
show ip ospf interface e0/1
show ip ospf database
show ip ospf database router 3.3.3.3

R4
show ip ospf neighbor
show ip ospf interface e0/0
show ip ospf database
show ip ospf database router 4.4.4.4

R3 showコマンドの結果

R3#show ip ospf neighbor
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
4.4.4.4           0   FULL/  -        00:00:35    192.168.34.4    Ethernet0/1
2.2.2.2           1   FULL/BDR        00:00:30    192.168.23.2    Ethernet0/0
R3#show ip ospf interface e0/1
Ethernet0/1 is up, line protocol is up 
  Internet Address 192.168.34.3/24, Area 1 
  Process ID 1, Router ID 3.3.3.3, Network Type POINT_TO_POINT, Cost: 10
  Transmit Delay is 1 sec, State POINT_TO_POINT
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:09
  Supports Link-local Signaling (LLS)
  Index 2/2, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 2, maximum is 2
  Last flood scan time is 0 msec, maximum is 4 msec
  Neighbor Count is 1, Adjacent neighbor count is 1 
    Adjacent with neighbor 4.4.4.4
  Suppress hello for 0 neighbor(s)
R3#show ip ospf database
 
            OSPF Router with ID (3.3.3.3) (Process ID 1)
 
                Router Link States (Area 1)
 
Link ID         ADV Router      Age         Seq#       Checksum Link count
2.2.2.2         2.2.2.2         1377        0x80000002 0x00E72A 1
3.3.3.3         3.3.3.3         1376        0x80000003 0x00D955 4
4.4.4.4         4.4.4.4         1385        0x80000002 0x007BEF 2
 
                Net Link States (Area 1)
 
Link ID         ADV Router      Age         Seq#       Checksum
192.168.23.3    3.3.3.3         1376        0x80000001 0x004254
192.168.34.4    4.4.4.4         1385        0x80000001 0x00F489
 
                Summary Net Link States (Area 1)
 
Link ID         ADV Router      Age         Seq#       Checksum
192.168.0.1     2.2.2.2         1377        0x80000001 0x00FFBF
192.168.0.2     2.2.2.2         1417        0x80000001 0x009137
192.168.1.0     2.2.2.2         1377        0x80000001 0x00595D
192.168.12.0    2.2.2.2         1417        0x80000001 0x007B3A
R3#show ip ospf database router 3.3.3.3
 
            OSPF Router with ID (3.3.3.3) (Process ID 1)
 
                Router Link States (Area 1)
 
  Adv Router is not-reachable
  LS age: 1426
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 3.3.3.3
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000003
  Checksum: 0xD955
  Length: 72
  Number of Links: 4
 
    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 192.168.0.3
     (Link Data) Network Mask: 255.255.255.255
      Number of TOS metrics: 0
       TOS 0 Metrics: 1
 
    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 4.4.4.4
     (Link Data) Router Interface address: 192.168.34.3
      Number of TOS metrics: 0
       TOS 0 Metrics: 10
 
    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 192.168.34.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 10
 
    Link connected to: a Transit Network
     (Link ID) Designated Router address: 192.168.23.3
     (Link Data) Router Interface address: 192.168.23.3
      Number of TOS metrics: 0
       TOS 0 Metrics: 10

R4 showコマンドの結果

R4#show ip ospf neighbor
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           1   FULL/BDR        00:00:31    192.168.34.3    Ethernet0/0
5.5.5.5           1   FULL/DR         00:00:30    192.168.45.5    Ethernet0/1
R4#show ip ospf interface e0/0
Ethernet0/0 is up, line protocol is up 
  Internet Address 192.168.34.4/24, Area 1 
  Process ID 1, Router ID 4.4.4.4, Network Type BROADCAST, Cost: 10
  Transmit Delay is 1 sec, State DR, Priority 1 
  Designated Router (ID) 4.4.4.4, Interface address 192.168.34.4
  Backup Designated router (ID) 3.3.3.3, Interface address 192.168.34.3
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:06
  Supports Link-local Signaling (LLS)
  Index 3/4, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 1, maximum is 2
  Last flood scan time is 0 msec, maximum is 0 msec
  Neighbor Count is 1, Adjacent neighbor count is 1 
    Adjacent with neighbor 3.3.3.3  (Backup Designated Router)
  Suppress hello for 0 neighbor(s)
R4#show ip ospf database
 
            OSPF Router with ID (4.4.4.4) (Process ID 1)
 
                Router Link States (Area 1)
 
Link ID         ADV Router      Age         Seq#       Checksum Link count
2.2.2.2         2.2.2.2         1426        0x80000002 0x00E72A 1
3.3.3.3         3.3.3.3         1426        0x80000003 0x00D955 4
4.4.4.4         4.4.4.4         1432        0x80000002 0x007BEF 2
 
                Net Link States (Area 1)
 
Link ID         ADV Router      Age         Seq#       Checksum
192.168.23.3    3.3.3.3         1425        0x80000001 0x004254
192.168.34.4    4.4.4.4         1432        0x80000001 0x00F489
 
                Summary Net Link States (Area 1)
 
Link ID         ADV Router      Age         Seq#       Checksum
192.168.0.1     2.2.2.2         1427        0x80000001 0x00FFBF
192.168.0.2     2.2.2.2         1466        0x80000001 0x009137
192.168.1.0     2.2.2.2         1427        0x80000001 0x00595D
192.168.12.0    2.2.2.2         1466        0x80000001 0x007B3A
 
                Router Link States (Area 2)
 
Link ID         ADV Router      Age         Seq#       Checksum Link count
4.4.4.4         4.4.4.4         1431        0x80000002 0x006270 1
5.5.5.5         5.5.5.5         1432        0x80000002 0x000EB3 3
 
                Net Link States (Area 2)
 
Link ID         ADV Router      Age         Seq#       Checksum
192.168.45.5    5.5.5.5         1432        0x80000001 0x00A7BE
R4#show ip ospf database router 4.4.4.4
 
            OSPF Router with ID (4.4.4.4) (Process ID 1)
 
                Router Link States (Area 1)
 
  Adv Router is not-reachable
  LS age: 1385
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 4.4.4.4
  Advertising Router: 4.4.4.4
  LS Seq Number: 80000002
  Checksum: 0x7BEF
  Length: 48
  Number of Links: 2
 
    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 192.168.0.4
     (Link Data) Network Mask: 255.255.255.255
      Number of TOS metrics: 0
       TOS 0 Metrics: 1
 
    Link connected to: a Transit Network
     (Link ID) Designated Router address: 192.168.34.4
     (Link Data) Router Interface address: 192.168.34.4
      Number of TOS metrics: 0
       TOS 0 Metrics: 10

問題

  • なぜR2-R4間のバーチャルリンクが正常に動作していないのですか。
  • R2-R4間のバーチャルリンクが正常に動作して、R1~R5のすべてのルータで正しく通信できるようにするためには、どのように設定を修正すればよいですか。

解答

なぜR2-R4間のバーチャルリンクが正常に動作していないのですか。

R3-R4間でネットワークタイプが合っていない。R3ではPOINT_TO_POINT、R4ではBROADCASTのネットワークタイプになっている。ネイバーの条件を満たすことができているのでネイバーを確立しているが、ネットワークタイプが異なっているため、LSDBでR3-R4間のリンクの整合性がとれなくて、正しくルーティングできない。

バーチャルリンクを確立するトランジットエリア内のルーティングが正常にできていないので、バーチャルリンクが動作していない。

R2-R4間のバーチャルリンクが正常に動作して、R1~R5のすべてのルータで正しく通信できるようにするためには、どのように設定を修正すればよいですか。

R3

interface Ethernet0/1
 no ip ospf network

ワンポイント

  • ネットワークタイプが異なっていてもネイバー条件を満たしていればネイバーを確立できる
  • DR/BDRの要/不要が異なるネットワークタイプになってしまうと、正しくルートの計算ができなくなる

解説

OSPFのネットワークタイプについての理解が必要な問題です。OSPFのネットワークタイプは、OSPFインタフェースの特徴を表していて、ネットワークタイプによってネイバーの発見やHello/Deadインターバルのデフォルト値が決まります。普通は、ネイバー同士でネットワークタイプは同じになるはずです。そのため、単純なOSPFの設定では、ネットワークタイプを意識しなくても大丈夫です。でも、今回の問題はOSPFネットワークタイプについてしっかりと理解しておかないと解決できないでしょう。

上記のように、ネットワークタイプが違っていてもネイバーにはなれます。Hello/Deadインターバルやエリア、ネットワークマスク、スタブフラグ、認証の一致といったネイバー確立の条件を満足していればOKです。ただし、ネットワークタイプが異なると、ネイバーになれてもLSDBの同期をうまくとれなくなったり、LSDBに不整合があって、ルートの計算が正しくできなくなってしまいます。ネットワークタイプは違っていてもいいんですが、DR/BDRの要/不要の認識を合わせておく必要があります。OSPFネットワークタイプで、DR/BDRの要/不要に注目すると、次のようになります。

DR/BDRが必要

  • BROADCAST
  • NON_BROADCAST

DR/BDRが不要

  • POINT_TO_POINT
  • POINT_TO_MULTIPOINT

つまり、

  • BROADCAST-NON_BROADCAST
  • POINT_TO_POINT-POINT_TO_MULTIPOINT

という組み合わせなら、DR/BDRの認識が一致するので、ネイバーになれてきちんとLSDBの同期を取りルートの計算ができます。

今回の問題は、R3-R4間のネットワークタイプのミスマッチがトラブルの原因です。R3/R4のネットワークタイプとネイバーの情報を確認します。

R3

R3#show ip ospf neighbor
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
4.4.4.4           0   FULL/  -        00:00:35    192.168.34.4    Ethernet0/1
2.2.2.2           1   FULL/BDR        00:00:30    192.168.23.2    Ethernet0/0
R3#show ip ospf interface e0/1
Ethernet0/1 is up, line protocol is up 
  Internet Address 192.168.34.3/24, Area 1 
  Process ID 1, Router ID 3.3.3.3, Network Type POINT_TO_POINT, Cost: 10
  Transmit Delay is 1 sec, State POINT_TO_POINT
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:09
  Supports Link-local Signaling (LLS)
  Index 2/2, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 2, maximum is 2
  Last flood scan time is 0 msec, maximum is 4 msec
  Neighbor Count is 1, Adjacent neighbor count is 1 
    Adjacent with neighbor 4.4.4.4
  Suppress hello for 0 neighbor(s)

R4

R4#show ip ospf neighbor
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           1   FULL/BDR        00:00:31    192.168.34.3    Ethernet0/0
5.5.5.5           1   FULL/DR         00:00:30    192.168.45.5    Ethernet0/1
R4#show ip ospf interface e0/0
Ethernet0/0 is up, line protocol is up 
  Internet Address 192.168.34.4/24, Area 1 
  Process ID 1, Router ID 4.4.4.4, Network Type BROADCAST, Cost: 10
  Transmit Delay is 1 sec, State DR, Priority 1 
  Designated Router (ID) 4.4.4.4, Interface address 192.168.34.4
  Backup Designated router (ID) 3.3.3.3, Interface address 192.168.34.3
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:06
  Supports Link-local Signaling (LLS)
  Index 3/4, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 1, maximum is 2
  Last flood scan time is 0 msec, maximum is 0 msec
  Neighbor Count is 1, Adjacent neighbor count is 1 
    Adjacent with neighbor 3.3.3.3  (Backup Designated Router)
  Suppress hello for 0 neighbor(s)

この出力から、R3/R4のネットワークタイプは以下のようになっていることがわかります。

R3 E0/1-POINT_TO_POINT
R4 E0/0-BROADCAST

Hello/Deadインターバルなどのネイバー条件を満足しているのでネイバーとなっています。また、R3-R4間には他のルータがいないので、R3-R4間でLSDBの同期も取れています。ただ、R3-R4間でDR/BDRの認識が違っているので、LSDBに不整合があります。その結果、OSPFルートが正常に計算できず、R4のルーティングテーブルにはエリア1のルートが存在しません。

R4 show ip route ospf

R4#show ip route ospf 
O    192.168.5.0/24 [110/20] via 192.168.45.5, 00:13:22, Ethernet0/1
     192.168.0.0/32 is subnetted, 2 subnets
O       192.168.0.5 [110/11] via 192.168.45.5, 00:13:22, Ethernet0/1

図 図 R3-R4間のネットワークタイプのミスマッチ
図 図 R3-R4間のネットワークタイプのミスマッチ

トランジットエリア内のルーティングができていないので、R2-R4間のバーチャルリンクがDOWNしています。

R2 show ip ospf virtual-links

R2#show ip ospf virtual-links 
Virtual Link OSPF_VL0 to router 4.4.4.4 is down
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 1, Cost of using 65535
  Transmit Delay is 1 sec, State DOWN,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

R4 show ip ospf virtual-links

R4#show ip ospf virtual-links 
Virtual Link OSPF_VL0 to router 2.2.2.2 is down
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 1, Cost of using 65535
  Transmit Delay is 1 sec, State DOWN,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

バーチャルリンクを正常に動作させるためには、トランジットエリア内のルーティングをできるようにします。そのために、R3-R4間のネットワークタイプの不一致を解消します。

R3

interface Ethernet0/1
 no ip ospf network

R3 E0/1のネットワークタイプをR4 E0/0と合わせて、デフォルトのBROADCASTにすればトランジットエリア内のルーティングが正常にできるようになります。そして、R2-R4間のバーチャルリンクが動作します。

R2 show ip ospf virtual-links

R2#show ip ospf virtual-links 
Virtual Link OSPF_VL0 to router 4.4.4.4 is up
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 1, via interface Ethernet0/1, Cost of using 20
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:05
    Adjacency State FULL (Hello suppressed)
    Index 2/3, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec

R4 show ip ospf virtual-links

R4#show ip ospf virtual-links 
Virtual Link OSPF_VL0 to router 2.2.2.2 is up
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 1, via interface Ethernet0/0, Cost of using 20
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:03
    Adjacency State FULL (Hello suppressed)
    Index 1/3, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec

R2-R4間のバーチャルリンクが正常に動作すれば、孤立していたエリア2がエリア0に接続されて、OSPFドメイン全体でのルーティングが可能になります。R5のルーティングテーブルとR1への通信が次のようになります。

R5 show ip route/ping

R5#show ip route 
~省略~

Gateway of last resort is not set

O IA 192.168.12.0/24 [110/40] via 192.168.45.4, 00:02:21, Ethernet0/0
C    192.168.45.0/24 is directly connected, Ethernet0/0
C    192.168.5.0/24 is directly connected, Ethernet0/1
O IA 192.168.23.0/24 [110/30] via 192.168.45.4, 00:02:30, Ethernet0/0
O IA 192.168.34.0/24 [110/20] via 192.168.45.4, 00:02:30, Ethernet0/0
     192.168.0.0/32 is subnetted, 5 subnets
O IA    192.168.0.1 [110/41] via 192.168.45.4, 00:02:21, Ethernet0/0
O IA    192.168.0.2 [110/31] via 192.168.45.4, 00:02:21, Ethernet0/0
O IA    192.168.0.3 [110/21] via 192.168.45.4, 00:02:30, Ethernet0/0
O IA    192.168.0.4 [110/11] via 192.168.45.4, 00:02:30, Ethernet0/0
C       192.168.0.5 is directly connected, Loopback0
O IA 192.168.1.0/24 [110/50] via 192.168.45.4, 00:02:21, Ethernet0/0
R5#ping 192.168.0.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/34/52 ms

OSPFの仕組み