OSPFの全設定(juniperのケース)


以下では Juniper(Junos)におけるOSPF設定を “すべて網羅” した形で、概念 → 基本設定 → ルーティングインスタンス → エリア設計 → 各種オプション → トラブルシュートコマンド の順で完全整理します。


Contents

Juniper OSPF の完全ガイド(全設定網羅版)


1. OSPF の基本概念(Juniper の特徴)

Juniper(Junos)は Cisco IOS とは次の点が異なります。

protocols ospf 内に OSPF 設定を書く

Cisco のように「interface の中で OSPF 有効化」ではなく
Junos では interface 設定は全て protocols ospf 側に書く

area の中に interface x.x を割り当てる

protocols {
    ospf {
        area 0.0.0.0 {
            interface ge-0/0/0.0;
        }
    }
}

✔ ループバックは passive が基本

passive;

2. OSPF 基本設定(最小構成)

(1) router-id 設定

set routing-options router-id 1.1.1.1

(2) OSPF 有効化(Area0 に interface を追加)

set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0

(3) Loopback を passive にする

set protocols ospf area 0.0.0.0 interface lo0.0 passive

3. OSPF の interface 設定オプション(完全網羅)

Juniper の OSPF interface は Cisco と違い
protocols ospf area X interface xx.xx の下にまとめて書く

✔ Network Type

set protocols ospf area 0 interface ge-0/0/0.0 interface-type p2p
set protocols ospf area 0 interface ge-0/0/1.0 interface-type broadcast

✔ Hello / Dead タイマー

set protocols ospf area 0 interface ge-0/0/0.0 hello-interval 10
set protocols ospf area 0 interface ge-0/0/0.0 dead-interval 40

✔ Metric(コスト)

set protocols ospf area 0 interface ge-0/0/0.0 metric 10

✔ Metric 調整(metric プロポーショナル変更)

set protocols ospf area 0 interface ge-0/0/0.0 metric 5

✔ Passive interface

set protocols ospf area 0 interface ge-0/0/2.0 passive

✔ Authentication(MD5/HMAC)

set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 authentication md5 1 key "test123"

✔ BFD(高速死活監視)

set protocols ospf area 0 interface ge-0/0/0.0 bfd-liveness-detection minimum-interval 300

4. OSPF のエリア設計(完全網羅)

Juniper のエリア設定は Cisco と同じ概念。


(1) バックボーンエリア Area 0

set protocols ospf area 0.0.0.0 interface ge-0/0/0.0

(2) スタブエリア

set protocols ospf area 1.1.1.1 stub

(3) Totally Stubby Area(Juniper では NSSA no-summary が相当)

set protocols ospf area 1.1.1.1 stub no-summaries

(4) NSSA(Not-So-Stubby Area)

set protocols ospf area 1.1.1.1 nssa

Totally NSSA

set protocols ospf area 1.1.1.1 nssa no-summaries

(5) Virtual Link(仮想リンク)

Area 0 が分断したときに使用。

set protocols ospf area 1.1.1.1 virtual-link neighbor-id 2.2.2.2 transit-area 1.1.1.1

5. LSA 制御(フィルタ / リファレンス・バンド幅・リディストリ)


(1) リファレンス・バンド幅

set protocols ospf reference-bandwidth 10000   ## 10Gbps

(2) ルートリディストリビューション

static → ospf

set protocols ospf export static-to-ospf
set policy-options policy-statement static-to-ospf term 1 from protocol static
set policy-options policy-statement static-to-ospf term 1 then accept

connected → ospf

set protocols ospf export connected-to-ospf

(3) LSA throttle

(LSA の再送を抑える・大規模ネットワークで便利)

set protocols ospf lsa-generation-interval 10

6. マルチエリア OSPF(複数エリア)

set protocols ospf area 0 interface ge-0/0/0.0
set protocols ospf area 1 interface ge-0/0/1.0

7. OSPF + VRF(routing-instances)

MPLS L3VPN / VRF 内で使う場合:

set routing-instances CUST1 instance-type vrf
set routing-instances CUST1 interface ge-0/0/2.0
set routing-instances CUST1 protocols ospf area 0 interface ge-0/0/2.0
set routing-instances CUST1 vrf-target target:65000:100

8. OSPF トラブルシュート(全コマンド)


(1) ネイバー確認

show ospf neighbor
show ospf neighbor detail

(2) インターフェース情報

show ospf interface
show ospf interface detail

(3) LSDB

show ospf database
show ospf database router
show ospf database summary
show ospf database external

(4) 経路確認

show route protocol ospf

(5) OSPF 経路の origin 確認

show route detail | match OSPF

(6) OSPF 通信ログ

monitor traffic interface ge-0/0/0 no-resolve

9. Junos OSPF 設定テンプレート(総合例)

set routing-options router-id 1.1.1.1

set protocols ospf reference-bandwidth 10000

set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0

set protocols ospf area 0.0.0.0 interface lo0.0 passive

set protocols ospf area 1.1.1.1 stub
set protocols ospf area 1.1.1.1 interface ge-0/0/2.0

set protocols ospf export connected-to-ospf
set protocols ospf export static-to-ospf

set policy-options policy-statement static-to-ospf term 1 from protocol static
set policy-options policy-statement static-to-ospf term 1 then accept

まとめ

本ガイドでは Juniper OSPF の以下を 完全網羅 しました:

  • router-id / interface / passive
  • ネットワークタイプ / 認証 / BFD / cost
  • stub / totally stub / nssa / totally nssa
  • virtual link
  • redistribute(policy)
  • reference bandwidth
  • VRF 内 OSPF
  • 全トラブルシュートコマンド