IOS-XR – Routing – OSPF – 基本設定

動作確認

基本構文

router01
router ospf OSPF-1
 router-id 10.255.0.1
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
   cost 100
   network point-to-point
  !
  interface GigabitEthernet0/0/0/1
   cost 100
   network point-to-point
  !
 !
!
router02
router ospf OSPF-1
 router-id 10.255.0.2
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
   cost 100
   network point-to-point
  !
  interface GigabitEthernet0/0/0/1
   cost 100
   network point-to-point
  !
 !
 area 1
  interface GigabitEthernet0/0/0/2
   cost 100
   network point-to-point
  !
 !
!
router06
route-policy ALL_ROUTE
  pass
end-policy
!
router ospf OSPF-1
 router-id 10.255.0.6
 redistribute bgp 65000 metric-type 1 route-policy ALL_ROUTE
 area 2
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
   cost 100
  !
 !
!

状態確認

show ospf
RP/0/RP0/CPU0:router01#show ospf
Wed Dec 24 18:43:35.541 UTC

 Routing Process "ospf OSPF-1" with ID 10.255.0.1
 Role: Primary Active
 NSR (Non-stop routing) is Enabled
 Supports only single TOS(TOS0) routes
 Supports opaque LSA
 Maximum number of non self-generated LSA allowed 500000
    Current number of non self-generated LSA 10
    Threshold for warning message 75%
    Ignore-time 5 minutes, reset-time 10 minutes
    Ignore-count allowed 5, current ignore-count 0
 Maximum number of external prefixes per router 50000 (suppress-neighbor)
  Warning threshold 75%
 Maximum Exchange time 10 Hold time 5 Max Recovery count 300
 Router is not originating router-LSAs with maximum metric
 Initial SPF schedule delay 50 msecs
 Minimum hold time between two consecutive SPFs 200 msecs
 Maximum wait time between two consecutive SPFs 5000 msecs
 Initial LSA throttle delay 50 msecs
 Minimum hold time for LSA throttle 200 msecs
 Maximum wait time for LSA throttle 5000 msecs
 Minimum LSA interval 200 msecs. Minimum LSA arrival 100 msecs
 LSA refresh interval 1800 seconds
 Flood pacing interval 33 msecs. Retransmission pacing interval 66 msecs
 Adjacency stagger enabled; initial (per area): 2, maximum: 64
    Number of neighbors forming: 0, 2 full
 Maximum number of configured interfaces 1024
 Number of external LSA 1. Checksum Sum 0x0027a3
 Number of opaque AS LSA 0. Checksum Sum 00000000
 Number of DCbitless external and opaque AS LSA 0
 Number of DoNotAge external and opaque AS LSA 0
 Number of areas in this router is 1. 1 normal 0 stub 0 nssa
 External flood list length 0
 SNMP trap is enabled
 LSD not connected, revision 0
 Segment Routing Global Block default (16000-23999), not allocated
 Segment Routing Local Block, unknown
 Segment Routing prefix-sid-map, Advertise local: Disabled, Receive remote: Disabled
 Strict-SPF capability is enabled
    Area BACKBONE(0)
        Number of interfaces in this area is 3
        SPF algorithm executed 14 times
        Number of LSA 10.  Checksum Sum 0x04cc8a
        Number of opaque link LSA 0.  Checksum Sum 00000000
        Number of DCbitless LSA 0
        Number of indication LSA 0
        Number of DoNotAge LSA 0
        Flood list length 0
        Number of LFA enabled interfaces 0, LFA revision 0
        Number of Per Prefix LFA enabled interfaces 0
        Number of neighbors forming in staggered mode 0, 2 full
show ospf neighbor
RP/0/RP0/CPU0:router01#show ospf neighbor
Wed Dec 24 18:42:46.562 UTC

* Indicates MADJ interface
# Indicates Neighbor awaiting BFD session up

Neighbors for OSPF OSPF-1

Neighbor ID     Pri   State           Dead Time   Address         Interface
10.255.0.2      1     FULL/  -        00:00:33    10.254.1.2      GigabitEthernet0/0/0/0
    Neighbor is up for 05:08:27
10.255.0.3      1     FULL/  -        00:00:33    10.254.3.2      GigabitEthernet0/0/0/1
    Neighbor is up for 05:08:23

Total neighbor count: 2
show ospf interface brief
RP/0/RP0/CPU0:router01#show ospf interface brief
Wed Dec 24 18:44:09.327 UTC

* Indicates MADJ interface, (P) Indicates fast detect hold down state

Interfaces for OSPF OSPF-1

Interface          PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Lo0                OSPF-1 0               10.255.0.1/32      1     LOOP  0/0
Gi0/0/0/0          OSPF-1 0               10.254.1.1/24      100   P2P   1/1
Gi0/0/0/1          OSPF-1 0               10.254.3.1/24      100   P2P   1/1
show ospf database
RP/0/RP0/CPU0:router01#show ospf database
Wed Dec 24 18:46:23.888 UTC


            OSPF Router with ID (10.255.0.1) (Process ID OSPF-1)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
10.255.0.1      10.255.0.1      495         0x8000000f 0x00effd 5
10.255.0.2      10.255.0.2      445         0x8000000d 0x008a63 5
10.255.0.3      10.255.0.3      463         0x8000000f 0x00f8eb 5

                Summary Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
10.254.4.0      10.255.0.2      1449        0x8000000a 0x005a5c
10.254.5.0      10.255.0.3      1478        0x8000000a 0x00496b
10.255.0.4      10.255.0.2      445         0x80000007 0x006255
10.255.0.5      10.255.0.3      463         0x80000007 0x005263
10.255.0.6      10.255.0.3      463         0x80000007 0x00486c
192.168.1.0     10.255.0.2      1449        0x8000000a 0x004a0e

                Summary ASB Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
10.255.0.6      10.255.0.3      463         0x80000007 0x003084

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
192.168.2.0     10.255.0.6      257         0x80000007 0x00a327 65001

機能別検証

ProcessとRouter-ID

設定

router ospf OSPF-1
 router-id 10.255.0.1
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
   cost 100
   network point-to-point
  !
  interface GigabitEthernet0/0/0/1
   cost 100
   network point-to-point
  !
 !
!

確認コマンド

RP/0/RP0/CPU0:router01(config)#do show ospf
Wed Dec 24 19:00:39.514 UTC

 Routing Process "ospf OSPF-1" with ID 10.255.0.1
 Role: Primary Active
 NSR (Non-stop routing) is Enabled
 Supports only single TOS(TOS0) routes
 Supports opaque LSA
 Maximum number of non self-generated LSA allowed 500000
    Current number of non self-generated LSA 10
    Threshold for warning message 75%
    Ignore-time 5 minutes, reset-time 10 minutes
    Ignore-count allowed 5, current ignore-count 0
 Maximum number of external prefixes per router 50000 (suppress-neighbor)
  Warning threshold 75%
 Maximum Exchange time 10 Hold time 5 Max Recovery count 300
 Router is not originating router-LSAs with maximum metric
 Initial SPF schedule delay 50 msecs
 Minimum hold time between two consecutive SPFs 200 msecs
 Maximum wait time between two consecutive SPFs 5000 msecs
 Initial LSA throttle delay 50 msecs
 Minimum hold time for LSA throttle 200 msecs
 Maximum wait time for LSA throttle 5000 msecs
 Minimum LSA interval 200 msecs. Minimum LSA arrival 100 msecs
 LSA refresh interval 1800 seconds
 Flood pacing interval 33 msecs. Retransmission pacing interval 66 msecs
 Adjacency stagger enabled; initial (per area): 2, maximum: 64
    Number of neighbors forming: 0, 2 full
 Maximum number of configured interfaces 1024
 Number of external LSA 1. Checksum Sum 0x0027a3
 Number of opaque AS LSA 0. Checksum Sum 00000000
 Number of DCbitless external and opaque AS LSA 0
 Number of DoNotAge external and opaque AS LSA 0
 Number of areas in this router is 1. 1 normal 0 stub 0 nssa
 External flood list length 0
 SNMP trap is enabled
 LSD not connected, revision 0
 Segment Routing Global Block default (16000-23999), not allocated
 Segment Routing Local Block, unknown
 Segment Routing prefix-sid-map, Advertise local: Disabled, Receive remote: Disabled
 Strict-SPF capability is enabled
    Area BACKBONE(0)
        Number of interfaces in this area is 3
        SPF algorithm executed 18 times
        Number of LSA 10.  Checksum Sum 0x04c695
        Number of opaque link LSA 0.  Checksum Sum 00000000
        Number of DCbitless LSA 0
        Number of indication LSA 0
        Number of DoNotAge LSA 0
        Flood list length 0
        Number of LFA enabled interfaces 0, LFA revision 0
        Number of Per Prefix LFA enabled interfaces 0
        Number of neighbors forming in staggered mode 0, 2 full

IOS-XRでは複数のOSPFプロセスを動かすことが可能で複数のOSPFドメインに所属することができる。ただし、データベースはそれぞれで独立する。
router-idはドメインの中でユニークである必要がある。自動的に採番もされるが明示的にrouter-idで設定することが推奨されている。

AreaとNeighborの確立

設定

router ospf OSPF-1
 router-id 10.255.0.1
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
   cost 100
   network point-to-point
  !
  interface GigabitEthernet0/0/0/1
   cost 100
   network point-to-point
  !
 !
!

確認コマンド

RP/0/RP0/CPU0:router01(config)#do show ospf interface brief
Wed Dec 24 19:04:57.045 UTC

* Indicates MADJ interface, (P) Indicates fast detect hold down state

Interfaces for OSPF OSPF-1

Interface          PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Lo0                OSPF-1 0               10.255.0.1/32      1     LOOP  0/0
Gi0/0/0/0          OSPF-1 0               10.254.1.1/24      100   P2P   1/1
Gi0/0/0/1          OSPF-1 0               10.254.3.1/24      100   P2P   1/1

RP/0/RP0/CPU0:router01(config)#do show ospf neighbor
Wed Dec 24 19:05:01.663 UTC

* Indicates MADJ interface
# Indicates Neighbor awaiting BFD session up

Neighbors for OSPF OSPF-1

Neighbor ID     Pri   State           Dead Time   Address         Interface
10.255.0.2      1     FULL/  -        00:00:35    10.254.1.2      GigabitEthernet0/0/0/0
    Neighbor is up for 00:13:21
10.255.0.3      1     FULL/  -        00:00:34    10.254.3.2      GigabitEthernet0/0/0/1
    Neighbor is up for 00:13:16

Total neighbor count: 2

全員が共通して詳細なデータベースをもつドメインを決定するエリアの設定。
Neighborを確立するには同じドメインである必要がある。
IOS-XRはInterfaceではなくOSPFプロセスの中に有効にするインターフェースを記載する。

パラメータ

プロセス直下のパラメータ

分類コマンド内容 (AI)
基本設定address-familyIPv4/IPv6アドレスファミリを有効化し、トポロジ設定へ遷移
areaOSPFエリアIDを定義し、エリア設定モードへ遷移
router-idOSPFルータID(一意の識別子)を手動設定
vrf特定のVRFインスタンス毎の設定を行う
protocol shutdownOSPFプロセス自体をシャットダウン
ネイバー・隣接関係adjacency staggerエリアごとにNeighbor確立数を制限してCPU負荷を抑制
bfdBFDによる高速障害検知を有効化
capabilityLLS, Opaque LSA, type7などの機能を設定
demand-circuitLSUやHelloを抑制してダイアルアップ回線においてトラフィックを抑制する
mtu-ignoreネイバー確立時のDBDパケットにおけるMTU不一致チェックを無視
networkネットワークタイプ(Broadcast, P2P, NBMA等)のデフォルト設定
passiveインターフェースをパッシブ(Hello送信停止)に設定
メトリック・パス制御apply-weightUCMPをする際に利用するweight/bandwidthの設定
auto-cost帯域幅に基づくコスト自動計算時の「基準帯域幅」を設定
costインターフェースのOSPFコスト値を設定
cost-fallbackリンク遅延や損失通知時にメトリックを変更する設定
default-metric再配布ルートのデフォルトメトリック値を設定
distanceOSPFルートのAD値を変更
max-metricトラフィックを迂回用に全リンクのメトリックを最大にする
ucmpUCMP(不等コストマルチパス)の設定
weightパス選択に使用する重み付け値を設定
ルート制御・再配布default-informationデフォルトルート(0.0.0.0/0)の生成・配布
distributeOSPFが持つLink StateをBGP-LSやLS配布をするモジュールに渡す
distribute-listLSDBの経路をRIBに入れるときにフィルタする
external-outエリア内ルートを外部ルートとして広告する設定(特殊用途)
loopback stub-networkループバックIFは通常/32のホストルートだが、stubを無効にしてサブネットの状態で広報できるようにする
prefix-suppressionLinkStateは伝えるが、Prefixを伝えない設定。Passiveの逆イメージ(Neighbor張るけど経路なし)
redistribute他プロトコル(BGP, Static等)ルートのOSPFへの再配布
summary-in外部プレフィックスをエリア間ルートに変更して集約広告
summary-prefixルート集約の設定
タイマー・調整dead-intervalネイバーダウン判定までの待機時間(秒)
delaynormalize 等による遅延の正規化間隔設定
exchange-timerデータベース交換(DBD)のタイムアウト時間
hello-intervalHelloパケットの送信間隔(秒)
packet-sizeOSPFパケットの最大サイズ。mtu以下にする。
retransmit-intervalLSA再送までの待機時間(秒)
spfSPF計算の優先度制御など
timersSPF計算やLSA生成の遅延(スロットリング)タイマー
transmit-delayLSA送信時に経過時間として加算する遅延時間(秒)
高可用性・保護fast-rerouteIP FRR(LFA: Loop-Free Alternateなど)による高速迂回の有効化
link-downfast-detect によるリンクダウン早期検出の有効化
microloop avoidanceコンバージェンス中のマイクロループ(一時的ループ)回避機能の設定
nsfNSF(Non Stop Forwarding)設定によるプロセス再起動時の通信維持
nsrNSR(Non Stop Routing)設定によるスタンバイRP同期と通信維持
MPLS / Segment Routingaffinity-mapリンクアフィニティ(属性)の名前と値のマッピング
flex-algoSegment RoutingのFlexible Algorithm(特定メトリック等に基づく経路計算)定義
mplsMPLS LDPやTraffic Engineering (TE) 関連パラメータの設定
segment-routingSegment Routing(SR)の有効化、GB(Global Block)等の設定
srlgSRLG(共有リスクリンクグループ)の設定
セキュリティ・制限authentication認証機能(MD5, Keychain等)の設定
authentication-key認証用パスワード(キー)の設定
database-filter特定LSAの送受信フィルタリング
ignore特定LSAタイプ受信時のエラーログ出力を抑制
max-external-lsa受信可能な外部LSA(Type-5)の最大数制限
max-lsa他ルータ生成LSAの保持最大数制限
maximumインターフェース数、パス数、再配布プレフィックス数などの上限設定
message-digest-keyMD5認証用キーIDとパスワードの設定
security ttlGTSM設定による遠隔攻撃の防止
ログ・監視・管理flood-reduction定期的なLSAリフレッシュを抑制しフラッディングを低減(DoNotAge使用)
logネイバー状態変化などのSyslog出力設定
monitor-convergenceコンバージェンス時間のモニタリング機能有効化
priorityDR/BDR選出用プライオリティの設定
queue内部イベント処理キューの調整
snmpOSPF関連SNMPトラップやコンテキストの設定
traceトラブルシューティング用トレースバッファサイズの設定

エリア直下のパラメータ

分類コマンド内容 (AI)
エリアタイプ定義stubスタブエリアとして設定(no-summary指定でTotally Stub化が可能)
nssaNSSAとして設定(no-summary, default-information-originate, translate等を指定可能)
default-costスタブ/NSSAへ注入されるデフォルトルートのコスト値を設定
インターフェース割当interface各種インターフェース(Ethernet, Bundle, Loopback, Tunnel等)をエリアへ割り当て
multi-area-interface単一インターフェースで複数のエリア隣接を確立
virtual-link対向ルータIDを指定して仮想リンクを確立
集約・フィルタリングrange指定したアドレス範囲を集約(サマリー)して広告
route-policyルートポリシー名を指定してフィルタリング等を適用

インターフェース直下のパラメータ

分類コマンド内容 (AI)
Segment Routing / Flex-Algoadjacency-sidSegment RoutingのAdjacency SID(絶対値またはインデックス)を手動設定
affinityFlex-Algo経路計算に使用するリンクアフィニティ(属性名)を設定
te-metricFlex-Algo経路計算に使用するTEメトリック値を設定
ネイバー関係neighborNBMA(Non-Broadcast Multi-Access)ネットワーク等におけるネイバーIPアドレスの静的設定
経路の生成

OSPFにおいて、経路を伝搬させる(=すなわち経路生成)は下記の方法で可能となる。

  • OSPFを有効にする : そのインターフェースでOSPFを有効にしてLSAに含める。Neighborを張らなくてもPassiveでも良い。
  • 再配送する : OSPF以外の経路をソースとしてOSPFの外部経路として

追加検証

プロセスは複数作ることができるのか?

できる。 ただし完全のOSPFドメインとなる。

router ospf OSPF-1
 router-id 10.255.0.2
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
   cost 100
   network point-to-point
  !
  interface GigabitEthernet0/0/0/1
   cost 100
   network point-to-point
  !
 !
 area 1
 !
!
router ospf OSPF-2
 router-id 10.255.0.2
 area 1
  interface GigabitEthernet0/0/0/2
   cost 100
   network point-to-point
  !
 !
!
RP/0/RP0/CPU0:router02#show ospf neighbor
Wed Dec 24 21:33:05.908 UTC

* Indicates MADJ interface
# Indicates Neighbor awaiting BFD session up

Neighbors for OSPF OSPF-1

Neighbor ID     Pri   State           Dead Time   Address         Interface
10.255.0.1      1     FULL/  -        00:00:37    10.254.1.1      GigabitEthernet0/0/0/0
    Neighbor is up for 02:41:25
10.255.0.3      1     FULL/  -        00:00:38    10.254.2.2      GigabitEthernet0/0/0/1
    Neighbor is up for 08:12:43

Total neighbor count: 2

* Indicates MADJ interface
# Indicates Neighbor awaiting BFD session up

Neighbors for OSPF OSPF-2

Neighbor ID     Pri   State           Dead Time   Address         Interface
10.255.0.4      1     FULL/  -        00:00:33    10.254.4.2      GigabitEthernet0/0/0/2
    Neighbor is up for 00:00:09

Total neighbor count: 1


RP/0/RP0/CPU0:router02#show ospf interface brief
Wed Dec 24 21:33:37.247 UTC

* Indicates MADJ interface, (P) Indicates fast detect hold down state

Interfaces for OSPF OSPF-1

Interface          PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Lo0                OSPF-1 0               10.255.0.2/32      1     LOOP  0/0
Gi0/0/0/0          OSPF-1 0               10.254.1.2/24      100   P2P   1/1
Gi0/0/0/1          OSPF-1 0               10.254.2.1/24      100   P2P   1/1

Interfaces for OSPF OSPF-2

Gi0/0/0/2          OSPF-2 1               10.254.4.1/24      100   P2P   1/1
Router-IDが重複するとどうなるのか?
RP/0/RP0/CPU0:Dec 24 21:42:49.506 UTC: ospf[1035]: %ROUTING-OSPF-3-DUP_RTRID : OSPF detected duplicate router-id 10.255.0.1 from 10.254.3.1 on interface GigabitEthernet0/0/0/0

同じRouter-IDを持つホスト同士はNeighborがUPしない。他のルータとはUPし続ける。
Duplicateしているというログは出ていた。LSAやAgeがおかしくなるらしい。

パラメータが不一致だとどうなるのか?

router02-router03の03のnetwork point-to-pointを削除してみた。
router03は2WAY/DROTHERになり、router02はDownした。下記のログも出ていた。

RP/0/RP0/CPU0:Dec 24 21:51:26.664 UTC: ospf[1035]: %ROUTING-OSPF-5-ADJCHG : Process OSPF-1, Nbr 10.255.0.3 on GigabitEthernet0/0/0/1 in area 0 from LOADING to FULL, Loading Done, vrf default vrfid 0x60000000
RP/0/RP0/CPU0:Dec 24 21:51:34.054 UTC: ospf[1035]: %ROUTING-OSPF-4-NETWORK_TYPE_MISMATCH : Unexpected non-zero DR 10.254.2.2 in hello packet from GigabitEthernet0/0/0/1

まとめ (AIによる生成)

今回の検証で確認できたIOS-XR版OSPFの要点は、以下の3点です。

  1. 設定の階層構造 従来のIOSとは異なり、プロセス配下にエリアとインターフェースを定義する階層型の記述が必要です。
  2. プロセスの独立性 複数のOSPFプロセス(OSPF-1, OSPF-2など)を同時に起動でき、それぞれ完全に分離されたデータベースとして動作します。
  3. 不整合時の挙動 Router-ID重複やネットワークタイプの不一致(P2P vs Broadcast)はネイバー確立の致命傷となりますが、DUP_RTRIDMISMATCH といったログ出力で原因を特定可能です。

IOS-XR特有の設定作法に慣れ、適切なログ確認を行うことが安定運用の鍵となります。


おすすめ書籍

楽天Kobo電子書籍ストア
¥1,430 (2026/02/18 19:40時点 | 楽天市場調べ)
\楽天ポイント4倍セール!/
楽天市場
¥4,730 (2025/12/23 17:40時点 | Yahooショッピング調べ)
\楽天ポイント4倍セール!/
楽天市場
上部へスクロール