LANプロトコルトレーニング > OSPF > stub(スタブ)エリアについて

stub(スタブ)エリアについて

はじめに

前回は、マルチエリア構成でエリアごとにルート集約することで、エリア内部ルータのルーティングテーブルサイズが小さくなることを勉強しました。しかし、外部ルートに関しては何も気にしていませんでした。

ここでは、外部ルートが多い環境でルータの負荷を軽減する一つの方法としてStub(スタブ)エリアを勉強しましょう。外部ルート数を減らすための手段としては、外部ルートをASBRで集約することもできますますので、これもあわせて勉強します。

構成

下図の構成は、全ての外部ルートがエリア0で発生していることを前提としています。下図の環境でエリア1がノーマルエリアの場合、ルーティングテーブルがどうなるか確認してみましょう。

まずは設定

OSPFに関する部分だけ設定を以下に書きます。

R1#sh run | b router ospf
router ospf 1
 router-id 172.18.1.1
 log-adjacency-changes
 area 0 range 172.16.12.0 255.255.252.0
 area 1 range 172.17.12.0 255.255.252.0
 network 172.16.0.0 0.0.255.255 area 0
 network 172.17.0.0 0.0.255.255 area 1
 network 172.18.0.0 0.0.255.255 area 1
R2#sh run | b router ospf
router ospf 1
 router-id 172.18.1.2
 log-adjacency-changes
 redistribute connected
 network 172.0.0.0 0.255.255.255 area 0
R3#sh run | b router ospf
router ospf 1
 router-id 172.18.1.3
 log-adjacency-changes
 network 172.0.0.0 0.255.255.255 area 1

ルーティングテーブル

R1#sh ip ro
O E2 192.168.31.0/24 [110/20] via 172.16.12.2, 00:00:39, FastEthernet0/0
O E2 192.168.8.0/24 [110/20] via 172.16.12.2, 00:00:39, FastEthernet0/0
O E2 192.168.9.0/24 [110/20] via 172.16.12.2, 00:00:39, FastEthernet0/0
O E2 192.168.10.0/24 [110/20] via 172.16.12.2, 00:00:39, FastEthernet0/0
     172.17.0.0/16 is variably subnetted, 5 subnets, 2 masks
C       172.17.13.0/24 is directly connected, FastEthernet0/1
O       172.17.12.0/24 [110/2] via 172.17.13.3, 00:01:30, FastEthernet0/1
O       172.17.12.0/22 is a summary, 00:01:31, Null0
O       172.17.15.0/24 [110/2] via 172.17.13.3, 00:01:31, FastEthernet0/1
O       172.17.14.0/24 [110/2] via 172.17.13.3, 00:01:31, FastEthernet0/1
     172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
C       172.16.12.0/24 is directly connected, FastEthernet0/0
O       172.16.12.0/22 is a summary, 00:00:40, Null0
O       172.16.13.0/24 [110/11] via 172.16.12.2, 00:00:40, FastEthernet0/0
O       172.16.14.0/24 [110/11] via 172.16.12.2, 00:00:40, FastEthernet0/0
O       172.16.15.0/24 [110/11] via 172.16.12.2, 00:00:40, FastEthernet0/0
     172.18.0.0/32 is subnetted, 3 subnets
O       172.18.1.3 [110/2] via 172.17.13.3, 00:01:32, FastEthernet0/1
O       172.18.1.2 [110/11] via 172.16.12.2, 00:00:40, FastEthernet0/0
C       172.18.1.1 is directly connected, Loopback0
O E2 192.168.11.0/24 [110/20] via 172.16.12.2, 00:00:40, FastEthernet0/0
O E2 192.168.41.0/24 [110/20] via 172.16.12.2, 00:00:40, FastEthernet0/0
O E2 192.168.21.0/24 [110/20] via 172.16.12.2, 00:00:40, FastEthernet0/0
R2#sh ip ro
C    192.168.31.0/24 is directly connected, Loopback31
C    192.168.8.0/24 is directly connected, Loopback8
C    192.168.9.0/24 is directly connected, Loopback9
C    192.168.10.0/24 is directly connected, Loopback10
     172.17.0.0/22 is subnetted, 1 subnets
O IA    172.17.12.0 [110/11] via 172.16.12.1, 00:06:21, FastEthernet0/0
     172.16.0.0/24 is subnetted, 4 subnets
C       172.16.12.0 is directly connected, FastEthernet0/0
C       172.16.13.0 is directly connected, Loopback13
C       172.16.14.0 is directly connected, Loopback14
C       172.16.15.0 is directly connected, Loopback15
     172.18.0.0/32 is subnetted, 3 subnets
O IA    172.18.1.3 [110/12] via 172.16.12.1, 00:06:22, FastEthernet0/0
C       172.18.1.2 is directly connected, Loopback0
O IA    172.18.1.1 [110/11] via 172.16.12.1, 00:06:22, FastEthernet0/0
C    192.168.11.0/24 is directly connected, Loopback11
C    192.168.41.0/24 is directly connected, Loopback41
C    192.168.21.0/24 is directly connected, Loopback21
R3#sh ip ro
O E2 192.168.31.0/24 [110/20] via 172.17.13.1, 00:07:01, FastEthernet0/1
O E2 192.168.8.0/24 [110/20] via 172.17.13.1, 00:07:01, FastEthernet0/1
O E2 192.168.9.0/24 [110/20] via 172.17.13.1, 00:07:01, FastEthernet0/1
O E2 192.168.10.0/24 [110/20] via 172.17.13.1, 00:07:01, FastEthernet0/1
     172.17.0.0/24 is subnetted, 4 subnets
C       172.17.13.0 is directly connected, FastEthernet0/1
C       172.17.12.0 is directly connected, Loopback12
C       172.17.15.0 is directly connected, Loopback15
C       172.17.14.0 is directly connected, Loopback14
     172.16.0.0/22 is subnetted, 1 subnets
O IA    172.16.12.0 [110/11] via 172.17.13.1, 00:07:58, FastEthernet0/1
     172.18.0.0/32 is subnetted, 3 subnets
C       172.18.1.3 is directly connected, Loopback0
O IA    172.18.1.2 [110/12] via 172.17.13.1, 00:07:07, FastEthernet0/1
O       172.18.1.1 [110/2] via 172.17.13.1, 00:07:58, FastEthernet0/1
O E2 192.168.11.0/24 [110/20] via 172.17.13.1, 00:07:02, FastEthernet0/1
O E2 192.168.41.0/24 [110/20] via 172.17.13.1, 00:07:02, FastEthernet0/1
O E2 192.168.21.0/24 [110/20] via 172.17.13.1, 00:07:02, FastEthernet0/1

ASBR(R2)で外部ルートを集約

図からわかるように、R2で発生している外部ルートの中で、以下のルートを192.168.8.0/22に集約できます。

Lo 8 : 192.168. 8.0/24
Lo 9 : 192.168. 9.0/24
Lo10 : 192.168.10.0/24
Lo11 : 192.168.11.0/24

集約に必要となる設定は、以下の通りです。

R2#sh run | b router ospf
router ospf 1
 router-id 172.18.1.2
 log-adjacency-changes
 summary-address 192.168.8.0 255.255.252.0
 redistribute connected
 network 172.0.0.0 0.255.255.255 area 0

各ルータのルーティングテーブルを確認しましょう。(OSPFのみを確認します。)

■R1■

O E2 192.168.8.0/22が見えるようになり、このルートに含まれるこまかなルートは見えなくなりました。このことで、ルーティングテーブルのサイズが少し小さくなりました。

R1#sh ip ro ospf
O E2 192.168.31.0/24 [110/20] via 172.16.12.2, 00:25:13, FastEthernet0/0
     172.17.0.0/16 is variably subnetted, 5 subnets, 2 masks
O       172.17.12.0/24 [110/2] via 172.17.13.3, 00:26:05, FastEthernet0/1
O       172.17.12.0/22 is a summary, 00:26:05, Null0
O       172.17.15.0/24 [110/2] via 172.17.13.3, 00:26:05, FastEthernet0/1
O       172.17.14.0/24 [110/2] via 172.17.13.3, 00:26:05, FastEthernet0/1
     172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
O       172.16.12.0/22 is a summary, 00:25:13, Null0
O       172.16.13.0/24 [110/11] via 172.16.12.2, 00:25:13, FastEthernet0/0
O       172.16.14.0/24 [110/11] via 172.16.12.2, 00:25:13, FastEthernet0/0
O       172.16.15.0/24 [110/11] via 172.16.12.2, 00:25:13, FastEthernet0/0
     172.18.0.0/32 is subnetted, 3 subnets
O       172.18.1.3 [110/2] via 172.17.13.3, 00:26:05, FastEthernet0/1
O       172.18.1.2 [110/11] via 172.16.12.2, 00:25:13, FastEthernet0/0
O E2 192.168.41.0/24 [110/20] via 172.16.12.2, 00:25:13, FastEthernet0/0
O E2 192.168.21.0/24 [110/20] via 172.16.12.2, 00:25:14, FastEthernet0/0
O E2 192.168.8.0/22 [110/20] via 172.16.12.2, 00:03:58, FastEthernet0/0

R2では、外部ルートの集約ルート(192.168.8.0/22)がNull0に向かってできています。

R2#sh ip ro ospf
     172.17.0.0/22 is subnetted, 1 subnets
O IA    172.17.12.0 [110/11] via 172.16.12.1, 00:26:14, FastEthernet0/0
     172.18.0.0/32 is subnetted, 3 subnets
O IA    172.18.1.3 [110/12] via 172.16.12.1, 00:26:14, FastEthernet0/0
O IA    172.18.1.1 [110/11] via 172.16.12.1, 00:26:14, FastEthernet0/0
O    192.168.8.0/22 is a summary, 00:04:58, Null0

R3にもO E2 192.168.8.0/22が現れ、このルートに含まれる細かなルートが消えたため、ルーティングテーブルサイズが少し小さくなりました。

R3#sh ip ro ospf
O E2 192.168.31.0/24 [110/20] via 172.17.13.1, 00:26:39, FastEthernet0/1
     172.16.0.0/22 is subnetted, 1 subnets
O IA    172.16.12.0 [110/11] via 172.17.13.1, 00:27:35, FastEthernet0/1
     172.18.0.0/32 is subnetted, 3 subnets
O IA    172.18.1.2 [110/12] via 172.17.13.1, 00:26:44, FastEthernet0/1
O       172.18.1.1 [110/2] via 172.17.13.1, 00:27:35, FastEthernet0/1
O E2 192.168.41.0/24 [110/20] via 172.17.13.1, 00:26:39, FastEthernet0/1
O E2 192.168.21.0/24 [110/20] via 172.17.13.1, 00:26:39, FastEthernet0/1
O E2 192.168.8.0/22 [110/20] via 172.17.13.1, 00:05:28, FastEthernet0/1

しかし、集約できない外部ルート(192.168.21.2/24、192.168.31.2/24、192.168.41.2/24)がまだ残っています。これを何とかする方法を勉強しましょう。

Stubエリア

ここで、エリア1をstubにしてみましょう。

構成

設定

R1#sh run
router ospf 1
 router-id 172.18.1.1
 log-adjacency-changes
 area 0 range 172.16.12.0 255.255.252.0
 area 1 stub
 area 1 range 172.17.12.0 255.255.252.0
 network 172.16.0.0 0.0.255.255 area 0
 network 172.17.0.0 0.0.255.255 area 1
 network 172.18.0.0 0.0.255.255 area 1
R2#sh run
router ospf 1
 router-id 172.18.1.2
 log-adjacency-changes
 summary-address 192.168.8.0 255.255.252.0
 redistribute connected
 network 172.0.0.0 0.255.255.255 area 0
R3#sh run
router ospf 1
 router-id 172.18.1.3
 log-adjacency-changes
 area 1 stub
 network 172.0.0.0 0.255.255.255 area 1

ルーティングテーブルの確認

R1#sh ip route ospf
O E2 192.168.31.0/24 [110/20] via 172.16.12.2, 00:33:40, FastEthernet0/0
     172.17.0.0/16 is variably subnetted, 5 subnets, 2 masks
O       172.17.12.0/24 [110/2] via 172.17.13.3, 00:33:40, FastEthernet0/1
O       172.17.12.0/22 is a summary, 00:33:40, Null0
O       172.17.15.0/24 [110/2] via 172.17.13.3, 00:33:40, FastEthernet0/1
O       172.17.14.0/24 [110/2] via 172.17.13.3, 00:33:40, FastEthernet0/1
     172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
O       172.16.12.0/22 is a summary, 00:34:17, Null0
O       172.16.13.0/24 [110/11] via 172.16.12.2, 00:34:17, FastEthernet0/0
O       172.16.14.0/24 [110/11] via 172.16.12.2, 00:34:17, FastEthernet0/0
O       172.16.15.0/24 [110/11] via 172.16.12.2, 00:34:17, FastEthernet0/0
     172.18.0.0/32 is subnetted, 3 subnets
O       172.18.1.3 [110/2] via 172.17.13.3, 00:33:40, FastEthernet0/1
O       172.18.1.2 [110/11] via 172.16.12.2, 00:34:17, FastEthernet0/0
O E2 192.168.41.0/24 [110/20] via 172.16.12.2, 00:33:40, FastEthernet0/0
O E2 192.168.21.0/24 [110/20] via 172.16.12.2, 00:33:41, FastEthernet0/0
O E2 192.168.8.0/22 [110/20] via 172.16.12.2, 00:33:41, FastEthernet0/0
R2#sh ip route ospf
     172.17.0.0/22 is subnetted, 1 subnets
O IA    172.17.12.0 [110/11] via 172.16.12.1, 00:34:02, FastEthernet0/0
     172.18.0.0/32 is subnetted, 3 subnets
O IA    172.18.1.3 [110/12] via 172.16.12.1, 00:34:02, FastEthernet0/0
O IA    172.18.1.1 [110/11] via 172.16.12.1, 00:37:58, FastEthernet0/0
O    192.168.8.0/22 is a summary, 00:39:33, Null0
R3#sh ip route ospf
     172.16.0.0/22 is subnetted, 1 subnets
O IA    172.16.12.0 [110/11] via 172.17.13.1, 00:34:16, FastEthernet0/1
     172.18.0.0/32 is subnetted, 3 subnets
O IA    172.18.1.2 [110/12] via 172.17.13.1, 00:34:16, FastEthernet0/1
O       172.18.1.1 [110/2] via 172.17.13.1, 00:34:16, FastEthernet0/1
O*IA 0.0.0.0/0 [110/2] via 172.17.13.1, 00:34:16, FastEthernet0/1

R3のルーティングテーブルからは、外部ルートが無くなり、そのかわりデフォルトルートがABRから流れてきました。内部ルートについては、エリア1がノーマルエリアのときと同じように流れ続けています。

R3(stubエリア内部ルータ)は、内部ルートについては知っているのですが、外部ルートについては一切わからなくなりました。これはR1(ABR)がStubエリアに外部ルートを通知しなくなったためです。そのかわり、R1はエリア間ルート(O IA)としてデフォルトルートをstubエリアに向けて通知するようになりました。

Stubエリア内ルータは、OSPFの内部ルートとして知りえるルートについては細かなルートを知っているのでルーティングテーブルにしたがって、転送先を決めます。しかし、外部ルートは一切わからなくなったため、ABRが通知するデフォルトルートに向けて転送することになります。

このように、stubエリアを使うと、外部ルートが多いネットワークでもStubエリア内部ルータは、外部ルートをデフォルトルート一つに置き換えられるので、OSPFデータベースやルーティングテーブルが簡単になり、ルータの負荷が軽減されます。

stubエリアにABRが一つしかなければ、stubにするのは簡単なのですが、もし複数のABRがある場合はややこしくなりますので、また機会がありましたら勉強しましょう。(複数のABRからstubエリア内にデフォルトルートが通知されることになってしまいます。)

Stubエリア内にASBRがある場合

StubエリアのABRは、外部ルートをstubエリア内に流さないことがわかりました。では、stubエリア内にASBRがある場合、このASBRで生じた外部ルートはどうなるのでしょうか?

ではR3でConnectedをOSPFに再配信してみましょう。

R3(config)#int loop 4
R3(config-if)#ip add 192.168.4.3 255.255.255.0
R3(config-if)#router ospf 1
R3(config-router)#redistribute connected
% Only classful networks will be redistributed
Warning: Router is currently an ASBR while having only one area which is a stub area

Warning: Router is currently an ASBR while having only one area which is a stub area
上のメッセージは、「ASBRになろうとしているみたいだけど、stubエリアの内部ルータだよ!!」って言っています。 R1のルーティングテーブルを確認すると、以下の通り192.168.4.0/24は流れていませんね。

R1#sh ip ro ospf
O E2 192.168.31.0/24 [110/20] via 172.16.12.2, 00:13:06, FastEthernet0/0
     172.17.0.0/16 is variably subnetted, 5 subnets, 2 masks
O       172.17.12.0/24 [110/2] via 172.17.13.3, 00:13:06, FastEthernet0/1
O       172.17.12.0/22 is a summary, 00:13:06, Null0
O       172.17.15.0/24 [110/2] via 172.17.13.3, 00:13:06, FastEthernet0/1
O       172.17.14.0/24 [110/2] via 172.17.13.3, 00:13:06, FastEthernet0/1
     172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
O       172.16.12.0/22 is a summary, 00:13:06, Null0
O       172.16.13.0/24 [110/11] via 172.16.12.2, 00:13:06, FastEthernet0/0
O       172.16.14.0/24 [110/11] via 172.16.12.2, 00:13:06, FastEthernet0/0
O       172.16.15.0/24 [110/11] via 172.16.12.2, 00:13:06, FastEthernet0/0
     172.18.0.0/32 is subnetted, 3 subnets
O       172.18.1.3 [110/2] via 172.17.13.3, 00:13:06, FastEthernet0/1
O       172.18.1.2 [110/11] via 172.16.12.2, 00:13:06, FastEthernet0/0
O E2 192.168.41.0/24 [110/20] via 172.16.12.2, 00:13:06, FastEthernet0/0
O E2 192.168.21.0/24 [110/20] via 172.16.12.2, 00:13:07, FastEthernet0/0
O E2 192.168.8.0/22 [110/20] via 172.16.12.2, 00:13:07, FastEthernet0/0

このことから、stubエリアでは、外部ルートを流すことができないことがわかりましたね。

stubエリアについて簡単にまとめてみましょう

  1. ABRからの外部ルートは伝わらない。そのかわり、ABRからデフォルトルートが入ってくる。
  2. stub内にASBRは存在できない。

では、stubエリアにスタティックルートを持ったルータや別のダイナミックルーティングプロトコルをしゃべるルータが居て、そのルートをOSPFに再配信する必要があるとき、どうすればいいのでしょうか?

次回は、Not So Stub Area(NSSA ノットソースタブエリア)について勉強します。

次へ >>>

LANプロトコルトレーニング > OSPF > stub(スタブ)エリアについて
おすすめ