OSPFの設定 ~バーチャルリンク編~
今回の授業は、「OSPFのバーチャルリンク設定」について学んでもらおうと思います。少しOSPFの基礎を振り返りながら進めていきますが、以前の授業も一緒に読んでもらえると理解しやすいと思います。
OSPFの授業
Contents
OSPFの振り返り
OSPFには、ルーティングテーブルの肥大化を防ぐためにエリアという概念があります。そして、すべてのエリアがバックボーンエリア(エリア0)に直接接続させる必要があります。そのため、新規ネットワークを構築する際には、よく考えて設計することが重要となりますが、どうしても、構築後に変更が生じます。
そして、新しいネットワークがバックボーンエリアに直接接続できないことが起きます。そんな時に使えるのが『バーチャルリンク』という機能です。これにより直接バックボーンエリアに接続できないエリアを、仮想リンクを使ってバックボーンエリアに接続させることが可能になります。今回は、この機能について勉強していきたいと思います。
お勉強構成
今回のお勉強構成は、以下になります。4台のルータを使って学習していこうと思いますので、可能であれば用意して一緒に設定していきましょう。
事前設定
まずは、事前設定からいきましょう。今回は、インターフェイス設定とバックボーンエリアの設定、エリア1、エリア2を標準エリアに設定するまでをやっていこうと思います。
インターフェイス設定
それでは、まずは、インターフェイス設定をしていきます。構成図を見ながら設定していきましょうね。
【RT1】
RT1(config)#interface Loopback0
RT1(config-if)#ip address 10.1.1.1 255.255.255.255
RT1(config-if)#interface FastEthernet0
RT1(config-if)#ip address 10.10.1.1 255.255.255.0
【RT2】
RT2(config)#interface Loopback0
RT2(config-if)#ip address 10.1.1.2 255.255.255.255
RT2(config-if)#interface FastEthernet0
RT2(config-if)#ip address 10.10.1.2 255.255.255.0
RT2(config-if)#interface FastEthernet1
RT2(config-if)#ip address 10.10.2.2 255.255.255.0
【RT3】
RT3(config)#interface Loopback0
RT3(config-if)#ip address 10.1.1.3 255.255.255.255
RT3(config-if)#interface FastEthernet0/0
RT3(config-if)#ip address 10.10.2.3 255.255.255.0
RT3(config-if)#interface FastEthernet0/1
RT3(config-if)#ip address 10.10.3.3 255.255.255.0
【RT4】
RT4(config)#interface Loopback0
RT4(config-if)#ip address 10.1.1.4 255.255.255.255
RT4(config-if)#interface FastEthernet0/0
RT4(config-if)#ip address 10.10.3.4 255.255.255.0
まずは、インターフェイス設定を行いましたが、大丈夫でしたか?次に基本的なOSPF設定をしていきますよ。
OSPF 標準エリア設定
それではOSPFの基本的な設定をしていきます。
【RT1】
RT1(config)#router ospf 1
RT1(config-router)#router-id 10.1.1.1
RT1(config-router)#network 10.1.1.1 0.0.0.0 area 0
RT1(config-router)#network 10.10.1.0 0.0.0.255 area 0
【RT2】
RT2(config)#router ospf 1
RT2(config-router)#router-id 10.1.1.2
RT2(config-router)#network 10.1.1.2 0.0.0.0 area 1
RT2(config-router)#network 10.10.1.0 0.0.0.255 area 0
RT2(config-router)#network 10.10.2.0 0.0.0.255 area 1
【RT3】
RT3(config)#router ospf 1
RT3(config-router)#router-id 10.1.1.3
RT3(config-router)#network 10.1.1.3 0.0.0.0 area 2
RT3(config-router)#network 10.10.2.0 0.0.0.255 area 1
RT3(config-router)#network 10.10.3.0 0.0.0.255 area 2
【RT4】
RT4(config)#router ospf 1
RT4(config-router)#router-id 10.1.1.4
RT4(config-router)#network 10.1.1.4 0.0.0.0 area 2
RT4(config-router)#network 10.10.3.0 0.0.0.255 area 2
ステータス確認
それでは、一度ステータスを確認してみましょう。OSPFの使用されるエリアはすべてバックボーンエリアに接続していないといけないと言われますが、誤った設計(設定)をした場合、どのようになるのかを知っておくことがトラブルシュートにつながります。間違った設定の結果を確認しておきましょう。
OSPFネイバーの確認
まずは、OSPFのネイバーから確認していきます。以下のようなステータスになっていれば、想定通りのネイバー関係が確立できたと言えるでしょう。
【RT1】
RT1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.1.1.2 1 FULL/DR 00:00:30 10.10.1.2 FastEthernet0
【RT2】
RT2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.1.1.1 1 FULL/BDR 00:00:31 10.10.1.1 FastEthernet0
10.1.1.3 1 FULL/DR 00:00:34 10.10.2.3 FastEthernet1
【RT3】
RT3#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.1.1.2 255 FULL/BDR 00:00:33 10.10.2.2 FastEthernet0/0
10.1.1.4 1 FULL/DR 00:00:33 10.10.3.4 FastEthernet0/1
【RT4】
RT4#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.1.1.3 1 FULL/BDR 00:00:36 10.10.3.3 FastEthernet0/0
バックボーンエリアに接続していなくてもネイバー関係は、問題なく確立できていることが分かりますね。
ルーティングテーブルの確認
それでは、ルーティングテーブルを見てみましょう。どうなっているでしょうか?
【RT1】
RT1#show ip route
10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C 10.1.1.1/32 is directly connected, Loopback0
O IA 10.1.1.2/32 [110/2] via 10.10.1.2, 00:00:07, FastEthernet0
C 10.10.1.0/24 is directly connected, FastEthernet0
O IA 10.10.2.0/24 [110/2] via 10.10.1.2, 00:00:07, FastEthernet0
【RT2】
RT2#show ip route
10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C 10.10.1.0/24 is directly connected, FastEthernet0
C 10.10.2.0/24 is directly connected, FastEthernet1
C 10.1.1.2/32 is directly connected, Loopback0
O 10.1.1.1/32 [110/2] via 10.10.1.1, 00:15:48, FastEthernet0
【RT3】
RT3#show ip route
10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
O IA 10.10.1.0/24 [110/2] via 10.10.2.2, 00:14:21, FastEthernet0/0
C 10.10.2.0/24 is directly connected, FastEthernet0/0
C 10.10.3.0/24 is directly connected, FastEthernet0/1
O 10.1.1.2/32 [110/2] via 10.10.2.2, 00:15:20, FastEthernet0/0
C 10.1.1.3/32 is directly connected, Loopback0
O IA 10.1.1.1/32 [110/3] via 10.10.2.2, 00:14:16, FastEthernet0/0
O 10.1.1.4/32 [110/2] via 10.10.3.4, 00:16:30, FastEthernet0/1
【RT4】
RT4#show ip route
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C 10.10.3.0/24 is directly connected, FastEthernet0/0
O 10.1.1.3/32 [110/2] via 10.10.3.3, 00:15:05, FastEthernet0/0
C 10.1.1.4/32 is directly connected, Loopback0
ちゃんとOSPFのルーティングがもらえているように見えますが、実はそうでもないのです。エリア1とエリア2間でルート情報の交換が出来ていないことがわかりますでしょうか?そのため、ルータ1にエリア2のルート情報が載っていませんよね?これでは、ちゃんとできたとは言えません。それでは、バーチャルリンクの設定を追加していきたいと思います。
バーチャルリンクの設定
それでは、バーチャルリンクの設定をしていきますが、バーチャルリンクを使用すると以下のようなイメージになります。
ルータ2とルータ3間で仮想リンクが作られるわけですが、ここで重要なのがバーチャルリンクを使用するルータ同士でルータIDへの疎通が可能であることです。忘れずにOSPFのnetwork設定に含めているようにしましょう。それでは、設定していきます。
【RT2】
RT2(config)#router ospf 1
RT2(config-router)#area 1 virtual-link 10.1.1.3
【RT3】
RT3(config)#router ospf 1
RT3(config-router)#area 1 virtual-link 10.1.1.2
ステータス確認
それでは、再度ステータス確認をしていきます。
バーチャルリンクの確認
ここで初めて使用する確認コマンドが『show ip ospf virtual-link』です。どのように表示されるかをルータ2とルータ3で確認していきます。
【RT2】
RT2#show ip ospf virtual-links
Virtual Link OSPF_VL0 to router 10.1.1.3 is up
Run as demand circuit
DoNotAge LSA allowed.
Transit area 1, via interface FastEthernet1, Cost of using 1
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:09
Adjacency State FULL (Hello suppressed)
Index 2/3, retransmission queue length 0, number of retransmission 1
First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
Last retransmission scan length is 1, maximum is 1
Last retransmission scan time is 0 msec, maximum is 0 msec
【RT3】
RT3#show ip ospf virtual-links
Virtual Link OSPF_VL0 to router 10.1.1.2 is up
Run as demand circuit
DoNotAge LSA allowed.
Transit area 1, via interface FastEthernet0/0, Cost of using 1
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:02
Adjacency State FULL (Hello suppressed)
Index 1/3, retransmission queue length 0, number of retransmission 1
First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
Last retransmission scan length is 1, maximum is 1
Last retransmission scan time is 0 msec, maximum is 0 msec
ここで『Adjacency State Full(Hello suppressed)』と表示されていたらOKです。一応、ルーティングテーブルも確認しておきますが、今回、特に制限をかけていないので、すべてのルートがそれぞれに載ってきているはずです。
ルーティングテーブルの確認
それでは、先程の結果と比較しながら確認していきます。赤字で表示されているのが増えたルートになります。
【RT1】
RT1#show ip route
10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
C 10.1.1.1/32 is directly connected, Loopback0
O IA 10.1.1.2/32 [110/2] via 10.10.1.2, 00:44:31, FastEthernet0
O IA 10.1.1.3/32 [110/3] via 10.10.1.2, 00:24:19, FastEthernet0
O IA 10.1.1.4/32 [110/4] via 10.10.1.2, 00:24:19, FastEthernet0
C 10.10.1.0/24 is directly connected, FastEthernet0
O IA 10.10.2.0/24 [110/2] via 10.10.1.2, 00:44:32, FastEthernet0
O IA 10.10.3.0/24 [110/3] via 10.10.1.2, 00:24:20, FastEthernet0
【RT2】
RT2#show ip route
10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
C 10.10.1.0/24 is directly connected, FastEthernet0
C 10.10.2.0/24 is directly connected, FastEthernet1
O IA 10.10.3.0/24 [110/2] via 10.10.2.3, 00:20:44, FastEthernet1
C 10.1.1.2/32 is directly connected, Loopback0
O IA 10.1.1.3/32 [110/2] via 10.10.2.3, 00:20:44, FastEthernet1
O 10.1.1.1/32 [110/2] via 10.10.1.1, 00:20:44, FastEthernet0
O IA 10.1.1.4/32 [110/3] via 10.10.2.3, 00:20:44, FastEthernet1
【RT3】
RT3#show ip route
10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
O 10.10.1.0/24 [110/2] via 10.10.2.2, 00:06:15, FastEthernet0/0
C 10.10.2.0/24 is directly connected, FastEthernet0/0
C 10.10.3.0/24 is directly connected, FastEthernet0/1
O 10.1.1.2/32 [110/2] via 10.10.2.2, 00:06:25, FastEthernet0/0
C 10.1.1.3/32 is directly connected, Loopback0
O 10.1.1.1/32 [110/3] via 10.10.2.2, 00:06:15, FastEthernet0/0
O 10.1.1.4/32 [110/2] via 10.10.3.4, 00:06:35, FastEthernet0/1
【RT4】
RT4#show ip route
10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
O IA 10.10.1.0/24 [110/3] via 10.10.3.3, 00:04:48, FastEthernet0/0
O IA 10.10.2.0/24 [110/2] via 10.10.3.3, 00:05:08, FastEthernet0/0
C 10.10.3.0/24 is directly connected, FastEthernet0/0
O IA 10.1.1.2/32 [110/3] via 10.10.3.3, 00:05:08, FastEthernet0/0
O 10.1.1.3/32 [110/2] via 10.10.3.3, 00:05:08, FastEthernet0/0
O IA 10.1.1.1/32 [110/4] via 10.10.3.3, 00:04:48, FastEthernet0/0
C 10.1.1.4/32 is directly connected, Loopback0
上記で赤字になっているルートが、バーチャルリンク設定後に追加されたルートになります。このように、どうしてもバックボーンエリアに接続できないエリアが出来てしまった場合は、バックボーンエリアのABRを指定してバーチャルリンクを構築することでルート情報の交換が可能となります。
まとめ
今回の授業はここまでですが、いかがでしたか?ちゃんと理解できましたか?運用していくと、どうしても当初設計から外れてきてしまうことがあります。そんな時に使えるのが、バーチャルリンクとなりますが、闇雲に使ってしまうと設計が複雑になっていきますので、なるべく使わずに済むように拡張性も含めた設計にしておくことをおすすめします。他にもルーティングの授業を公開しておりますので、よかったら勉強してみてください。
ルーティングの授業
【ホームルーム(商品紹介)】
お世話になっております。
GNS3を使いこちらのカリキュラムを元に勉強をしております。
自分で構成を考えるのは難しく、大変参考にさせていただいております。
1点、ご確認をお願いいたします。
RT2のOSPFの設定ですが、
RT2(config-router)#network 10.1.1.2 0.0.0.0 area 0
↓
RT2(config-router)#network 10.1.1.2 0.0.0.0 area 1
が正かと思われますので、ご確認いただけますと幸いです。
よろしくお願いいたします。
べのおじさん
コメントありがとうございます!
ご指摘の通りです。ありがとうございます。
修正させていただきました。
引き続き、授業を受けていただけたらと思います!
ベル様
ご確認と修正ありがとうございました!