OSPF FAQ 考察




このページは、下記ciscoサイトの OSPF FAQ について不明な点を考察したものです。
http://www.cisco.com/cisco/web/support/JP/100/1006/1006421_9-j.html


Q. なぜ OSPF ではループバックが /32 ホスト ルートとしてアドバタイズされるのですか。


「OSPF ではループバックはホスト ルートと見なされ、/32 でアドバタイズされます。」とあるので、
実際下記の設定でみてみます。

トポロジ
R1 s1/0 -------- s1/1 R2


R1
interface s1/0
ip add 12.12.12.1 255.255.255.0

interface lo0
ip add 1.1.1.1 255.255.255.0

router ospf 1
net 1.1.1.1 0.0.0.0 area 0
net 12.12.12.0 0.0.0.255 area 0

R2
interface s1/0
ip add 12.12.12.2 255.255.255.0

router ospf 1
net 12.12.12.0 0.0.0.255 area 0


これでR2 にて ip route を見ると、R1 の lo0 は 1.0.0.0/32 としてアドバタイズされています。

R2#sh ip route
Gateway of last resort is not set

     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/65] via 12.12.12.1, 00:00:44, Serial1/0
     23.0.0.0/24 is subnetted, 1 subnets
C       23.23.23.0 is directly connected, Serial1/1
     12.0.0.0/24 is subnetted, 1 subnets
C       12.12.12.0 is directly connected, Serial1/0

「ループバックで ip ospf network point-to-point コマンドが設定されていると、
OSPF によりループバック サブネットが、ループバック上に設定された実際のサブネットとしてアドバタイズされます。」

とありますので、

R1
interface lo0
ip ospf network point-to-point

に変えて見ると、1.0.0.0/24 でアドバタイズされるようになりました。


R1#sh ip route
Gateway of last resort is not set

     1.0.0.0/24 is subnetted, 1 subnets
O       1.1.1.0 [110/65] via 12.12.12.1, 00:00:01, Serial1/0
     23.0.0.0/24 is subnetted, 1 subnets
C       23.23.23.0 is directly connected, Serial1/1
     12.0.0.0/24 is subnetted, 1 subnets
C       12.12.12.0 is directly connected, Serial1/0


Q. リンクステート再送信間隔とは何ですか。また、それはどのコマンドで設定するのですか。

参照:
lab19-2-1.html

Q. OSPF では、ルートのフィルタリングに distribute-list in/out コマンドを使用できますか。


「distribute-list in コマンドでは、ルーティング テーブルへのルートの入力のみがフィルタリングされます。
このコマンドによってリンクステート パケットの伝搬が阻止されることはありません。」
とあります。実際に検証してみたいと思います。

トポロジ

R1 s1/0 -----------s1/0 R2 s1/1 -------------- s1/1 R3

R1 に lo0: 1.1.1.1/24 lo1: 2.2.2.2/24 をセットして、R2 s1/0 で distribute-list 1 in をセットします。

R2
access-list 1 permit 1.1.1.0

router ospf 1
distribute-list 1 in s1/0


R2#sh ip route
Gateway of last resort is not set

     1.0.0.0/24 is subnetted, 1 subnets
O       1.1.1.0 [110/65] via 12.12.12.1, 00:00:08, Serial1/0
     23.0.0.0/24 is subnetted, 1 subnets
C       23.23.23.0 is directly connected, Serial1/1
     12.0.0.0/24 is subnetted, 1 subnets
C       12.12.12.0 is directly connected, Serial1/0

R2 上の sh ip route では、2.2.2.0 のネットワークが消えましたが、、、


R3#sh ip route
Gateway of last resort is not set

     1.0.0.0/24 is subnetted, 1 subnets
O       1.1.1.0 [110/129] via 23.23.23.2, 00:00:47, Serial1/1
     2.0.0.0/24 is subnetted, 1 subnets
O       2.2.2.0 [110/129] via 23.23.23.2, 00:00:47, Serial1/1
     23.0.0.0/24 is subnetted, 1 subnets
C       23.23.23.0 is directly connected, Serial1/1
     12.0.0.0/24 is subnetted, 1 subnets
O       12.12.12.0 [110/128] via 23.23.23.2, 00:00:47, Serial1/1

R3上の sh ip route では 2.2.2.0 がいますので、「リンクステート パケットの伝搬が阻止されることはありません。」
の想定どおりの動作となったことがわかります。

OSPFで distribute-list in は使っちゃダメってことですね。これは覚えておこう。

次に distribute-list out ですが、「ASBR によって OSPF に再配布されているルートについてのみ有効です。
これは外部タイプ 2 および外部タイプ 1 のルートには適用されますが、エリア内およびエリア間ルートには適用されません。」
とあります。
これも実証してみたいと思います。

トポロジ

R1 s1/0 -----------s1/0 R2 s1/1 -------------- s1/1 R3

R1 に lo0: 1.1.1.1/24 lo1: 2.2.2.2/24 をセットして、R1 を ASBR とします。
で、2.2.2.2/24 を redist connected で外部ルートとして、 1.1.1.1/24 は area 1 とします。

R1
access-list 1 permit 2.2.2.0 0.0.0.255

route-map REDIST permit 10
match ip add 1

router ospf 1
redistribute connected route-map REDIST subnets
net 1.1.1.0 0.0.0.255 area 1

R3で sh ip route を見ると下記にようになります。

R3#sh ip route
Gateway of last resort is not set

     1.0.0.0/24 is subnetted, 1 subnets
O IA    1.1.1.0 [110/129] via 23.23.23.2, 00:00:00, Serial1/1
     2.0.0.0/24 is subnetted, 1 subnets
O E2    2.2.2.0 [110/20] via 23.23.23.2, 00:00:00, Serial1/1
     23.0.0.0/24 is subnetted, 1 subnets
C       23.23.23.0 is directly connected, Serial1/1
     12.0.0.0/24 is subnetted, 1 subnets
O       12.12.12.0 [110/128] via 23.23.23.2, 00:00:00, Serial1/1


この状態で、R1 にて 1.1.1.0/24 と 2.2.2.0/24 を拒否する distribute-list を適用してみます。

R1
access-list 2 deny 1.1.1.0 0.0.0.255
access-list 2 deny 2.2.2.0 0.0.0.255

router ospf 1
distribute-list 2 out

これで、R3 にて sh ip route を見てみると 外部ルートである 2.2.2.0 は消えましたが、内部ルート の 1.1.1.0 がそのままであることがわかります。

Gateway of last resort is not set

     1.0.0.0/24 is subnetted, 1 subnets
O IA    1.1.1.0 [110/129] via 23.23.23.2, 00:06:14, Serial1/1
     23.0.0.0/24 is subnetted, 1 subnets
C       23.23.23.0 is directly connected, Serial1/1
     12.0.0.0/24 is subnetted, 1 subnets
O       12.12.12.0 [110/128] via 23.23.23.2, 00:06:14, Serial1/1

「エリア内およびエリア間ルートには適用されません。」の想定どおりの動作となったことがわかります。


ちなみに distribute-list out はインターフェース指定では適用できないみたいです。
↓こんなかんじで拒否られます。

R1(config-router)#distribute-list 2 out s1/0
% Interface not allowed with OUT for OSPF

また、R2にて同じ設定をしても R3 では 2.2.2.0 が表示されないようになるかと思いましたが、
ASBR で設定しないと有効にならないらしく R3 では 2.2.2.0 が表示される結果となりました。


Q. ルートが OSPF プロセス間を再配送されるときは、すべての最短パス優先アルゴリズム(SPF)メトリックが保持されるのですか。それともデフォルトのメトリック値が使用されるのですか。


「SPF メトリックが保持されます。OSPF プロセス間の再配送は、2 つの IP ルーティング プロセス間の再配送の場合と同様です。」
とあります。

EIGRP → OSPF とかだと、外部ネットワークは metric 20 で再配送されますね。
OSPF → OSPF だとどうなるのか。

トポロジ

R1 s1/0 -----------s1/0 R2 s1/1 -------------- s1/1 R3

R1 - R2 間を ospf 1、R2 - R3 間を ospf 2 とする。
R1 lo0 にて 1.1.1.1/24 もエリア 0 に割り当てる。

R2
router ospf 2
redistribute ospf 1 subnets

で、コスト値が引き継がれているかみたいので、わかりやすくするため R1 lo0 のコストを 200 とする。

R1
interface lo0
ip ospf cost 200

で、R3 で sh ip route を見てみます。


R3# sh ip route
Gateway of last resort is not set

     1.0.0.0/32 is subnetted, 1 subnets
O E2    1.1.1.1 [110/264] via 23.23.23.2, 00:11:57, Serial1/1
     23.0.0.0/24 is subnetted, 1 subnets
C       23.23.23.0 is directly connected, Serial1/1
     12.0.0.0/24 is subnetted, 1 subnets
O E2    12.12.12.0 [110/64] via 23.23.23.2, 00:11:57, Serial1/1


ちゃんと R1 lo0(200) + R1 - R2(64) = 264 のコスト値で ospf 2 に引き継がれていることがわかりますね。
図はいらないか。へー引き継がれるんだ。考えられてますね。

Q. 同じ外部ネットワークに対するタイプ 5 リンクステート アドバタイズメント(LSA)が OSPF データベースに 2 つある場合、IP ルーティング テーブルにはどちらのパスを格納すべきですか。

自律システム境界ルータ(ASBR)への最短パスを持つ外部 LSA を優先して IP ルーティング テーブルに格納します。
とあります。

タイプ 5 の外部ネットワーク情報が2つ別経路できた場合、E2 であれば metric はどちらも 20 となりますね。
とするとどちらが優先されるがというと、自分から ASBR までのコストによると。

トポロジ


R1 にて sh ip route を打つと、4.0.0.0/24 へはロードバランスされていることがわかります。

R1#sh ip route
Gateway of last resort is not set

     34.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O E2    34.34.34.0/24 [110/20] via 13.13.13.3, 00:00:11, Serial1/1
O E2    34.0.0.0/8 [110/20] via 12.12.12.2, 00:00:11, Serial1/0
O E2 4.0.0.0/24 [110/20] via 13.13.13.3, 00:00:11, Serial1/1
               [110/20] via 12.12.12.2, 00:00:11, Serial1/0
     24.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O E2    24.24.24.0/24 [110/20] via 12.12.12.2, 00:00:11, Serial1/0
O E2    24.0.0.0/8 [110/20] via 13.13.13.3, 00:00:11, Serial1/1
     10.0.0.0/32 is subnetted, 1 subnets
C       10.10.10.10 is directly connected, Loopback0
     12.0.0.0/24 is subnetted, 1 subnets
C       12.12.12.0 is directly connected, Serial1/0
     13.0.0.0/24 is subnetted, 1 subnets


これは E2 ルートでどちらも metric 20 で学んでおり、show ip ospf border-routers を見ると
R2,R3 へのルートとも cost 64 となっているので差がないことからとなります。


R1#sh ip ospf border-routers

OSPF Process 1 internal Routing Table

Codes: i - Intra-area route, I - Inter-area route

i 34.34.34.3 [64] via 13.13.13.3, Serial1/1, ASBR, Area 0, SPF 8
i 24.24.24.2 [64] via 12.12.12.2, Serial1/0, ASBR, Area 0, SPF 8


ここで、ASBRまでのルートの cost の優先度を変えるため R1 の s1/0 の cost値を 1 に変更します。

R1
interface s1/0
ip ospf cost 1

で、もう一度見ると R2 への cost が 1 になっていることがわかります。

R1#sh ip ospf border-routers

OSPF Process 1 internal Routing Table

Codes: i - Intra-area route, I - Inter-area route

i 34.34.34.3 [64] via 13.13.13.3, Serial1/1, ASBR, Area 0, SPF 15
i 24.24.24.2 [1] via 12.12.12.2, Serial1/0, ASBR, Area 0, SPF 15


そして、sh ip route を見ると、見事にロードバランスがはずれ R2 経由の経路だけになったことが確認できました。

R1# sh ip route
Gateway of last resort is not set

     34.0.0.0/24 is subnetted, 1 subnets
O E2    34.34.34.0 [110/20] via 12.12.12.2, 00:01:36, Serial1/0
     4.0.0.0/24 is subnetted, 1 subnets
O E2    4.4.4.0 [110/20] via 12.12.12.2, 00:01:36, Serial1/0
     24.0.0.0/24 is subnetted, 1 subnets
O E2    24.24.24.0 [110/20] via 12.12.12.2, 00:01:36, Serial1/0
     10.0.0.0/32 is subnetted, 1 subnets
C       10.10.10.10 is directly connected, Loopback0
     12.0.0.0/24 is subnetted, 1 subnets
C       12.12.12.0 is directly connected, Serial1/0
     13.0.0.0/24 is subnetted, 1 subnets
C       13.13.13.0 is directly connected, Serial1/1


ちなみにどちらかのルートを E1 に変えると E1 側のルートの metric は 20 + 64 = 84 となり
E2 側の metric よりも大きくなりますが、OSPFのルールで E1 のほうが優先されることになります。

参考:
http://www.cisco.com/cisco/web/support/JP/100/1006/1006421_9-j.html#q13

更新日:2012年9月2日
TOPに戻る