メインコンテンツへスキップ
  1. Router および Switch 関連記事一覧/
  2. IOS-XR/

IOS XR OSPFスタブエリア設定(stub / totally stub)

目次

Cisco IOS XR OSPFスタブエリア設定方法

Cisco IOS XR でOSPFのスタブエリアとトータリースタブエリアを設定するコマンドです。router ospf配下のareaサブモードで指定します。スタブエリアで止まるLSAと代わりに入るデフォルト経路の仕組みはOSPFのスタブエリアとトータリースタブエリアで解説しています。

IOS XR OSPF スタブエリア設定
router ospf [プロセス名]
 area [エリアID]
  stub [no-summary]
  default-cost [コスト]
 !
!
入力箇所 入力内容
no-summary 付けるとトータリースタブエリア(Type 3も止める)。付けなければスタブエリア
[コスト] ABRがそのエリアへ注入するデフォルト経路のメトリック。既定は1

3つのコマンドは、入れるルータが違います。

コマンド 入れるルータ
stub そのエリアに接続する全ルータ(ABRと内部ルータの両方)。1台でも漏れると隣接が確立しません
stub no-summary そのエリアのABRだけ。ABRが複数あるときは全台に入れます。内部ルータはstubのままです
default-cost ABRだけ。ABRごと、エリアごとに別の値にできます
IOS XEではrouter ospf配下にarea [エリアID] stub [no-summary]area [エリアID] default-cost [コスト]を1行で書きます。IOS XRはareaサブモードの中に書く点が異なります。

Cisco IOS XR スタブエリアの確認コマンド

コマンド 確認できること
show ospf エリアごとの種別(It is a stub area / It is a stub area, no summary LSA in this area)。ABRでは、そのエリアへ注入するデフォルト経路のコスト(generates stub default route with cost)も出る
show ospf database エリアに入っているLSA。スタブエリアの内部ルータにはType-5 AS External Link Statesが無く、トータリースタブエリアではSummary Net Link States0.0.0.0だけになる
show ospf database summary 0.0.0.0 ABRごとのデフォルト経路(Summary-LSA)と、そのMetric
show route ospf 内部ルータのデフォルト経路O*IA 0.0.0.0/0と、経由するABR
show ospf neighbor 隣接がFULLか。stubの設定がエリア内でそろっていないと隣接は上がらない
show running-config router ospf 設定したスタブ種別とdefault-cost

実機での検証

XR1〜XR5の5台で、エリア1をスタブエリア、エリア2をトータリースタブエリアにしました。ABRはXR2とXR3の2台で、どちらもエリア0・1・2に接続しています。XR1はスタティックルート172.16.1.0/24を再配布するASBRで、Type 5の発生源です。

ルータ 役割 スタブ関連の設定
XR1 エリア0の内部ルータ、ASBR なし
XR2 ABR エリア1にstub、エリア2にstub no-summary
XR3 ABR エリア1にstubdefault-cost 50、エリア2にstub no-summary
XR4 エリア1(スタブ)の内部ルータ stub
XR5 エリア2(トータリースタブ)の内部ルータ stubno-summaryは入れない)

スタブエリアの設定

XR1 OSPF設定Config
router static
 address-family ipv4 unicast
  172.16.1.0/24 Null0
 !
!
router ospf 1
 router-id 1.1.1.1
 redistribute static
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
  !
  interface GigabitEthernet0/0/0/1
  !
 !
!
XR2 OSPF設定Config
router ospf 1
 router-id 2.2.2.2
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
  !
 !
 area 1
  stub
  interface GigabitEthernet0/0/0/1
  !
 !
 area 2
  stub no-summary
  interface GigabitEthernet0/0/0/2
  !
 !
!
XR3 OSPF設定Config
router ospf 1
 router-id 3.3.3.3
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
  !
 !
 area 1
  stub
  default-cost 50
  interface GigabitEthernet0/0/0/1
  !
 !
 area 2
  stub no-summary
  interface GigabitEthernet0/0/0/2
  !
 !
!
XR4 OSPF設定Config
router ospf 1
 router-id 4.4.4.4
 area 1
  stub
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
  !
  interface GigabitEthernet0/0/0/1
  !
 !
!
XR5 OSPF設定Config
router ospf 1
 router-id 5.5.5.5
 area 2
  stub
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
  !
  interface GigabitEthernet0/0/0/1
  !
 !
!

XR3での投入の実行例です。commit後のshow configuration commit changes last 1で、実際に入った設定を確認しています。

XR3 スタブエリア設定 実行例
RP/0/RP0/CPU0:XR3#configure
Sun Sep 13 11:56:11.369 UTC
RP/0/RP0/CPU0:XR3(config)#router ospf 1
RP/0/RP0/CPU0:XR3(config-ospf)#router-id 3.3.3.3
RP/0/RP0/CPU0:XR3(config-ospf)#area 0
RP/0/RP0/CPU0:XR3(config-ospf-ar)#interface Loopback0
RP/0/RP0/CPU0:XR3(config-ospf-ar-if)#passive enable
RP/0/RP0/CPU0:XR3(config-ospf-ar-if)#exit
RP/0/RP0/CPU0:XR3(config-ospf-ar)#interface GigabitEthernet0/0/0/0
RP/0/RP0/CPU0:XR3(config-ospf-ar-if)#exit
RP/0/RP0/CPU0:XR3(config-ospf-ar)#exit
RP/0/RP0/CPU0:XR3(config-ospf)#area 1
RP/0/RP0/CPU0:XR3(config-ospf-ar)#stub
RP/0/RP0/CPU0:XR3(config-ospf-ar)#default-cost 50
RP/0/RP0/CPU0:XR3(config-ospf-ar)#interface GigabitEthernet0/0/0/1
RP/0/RP0/CPU0:XR3(config-ospf-ar-if)#exit
RP/0/RP0/CPU0:XR3(config-ospf-ar)#exit
RP/0/RP0/CPU0:XR3(config-ospf)#area 2
RP/0/RP0/CPU0:XR3(config-ospf-ar)#stub no-summary
RP/0/RP0/CPU0:XR3(config-ospf-ar)#interface GigabitEthernet0/0/0/2
RP/0/RP0/CPU0:XR3(config-ospf-ar-if)#exit
RP/0/RP0/CPU0:XR3(config-ospf-ar)#commit
Sun Sep 13 11:56:13.320 UTC
RP/0/RP0/CPU0:XR3(config-ospf-ar)#end
RP/0/RP0/CPU0:XR3#show configuration commit changes last 1
Sun Sep 13 11:56:17.096 UTC
!! Building configuration...
!! IOS XR Configuration 26.1.1
router ospf 1
 router-id 3.3.3.3
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
  !
 !
 area 1
  stub
  default-cost 50
  interface GigabitEthernet0/0/0/1
  !
 !
 area 2
  stub no-summary
  interface GigabitEthernet0/0/0/2
  !
 !
!
end

設定の確認

ABRのXR3でshow ospfを見ると、エリアごとの種別と、そのエリアへ注入するデフォルト経路のコストが並びます。エリア1はIt is a stub areaでコスト50、エリア2はIt is a stub area, no summary LSA in this areaでコスト1です。Number of areasの行にも、スタブエリアが2つあることが出ています。

XR3 show ospf
RP/0/RP0/CPU0:XR3#show ospf
Sun Sep 13 12:01:50.563 UTC

 Routing Process "ospf 1" with ID 3.3.3.3
 Role: Primary Active
 NSR (Non-stop routing) is Enabled
 Supports only single TOS(TOS0) routes
 Supports opaque LSA
 It is an area border router
 Maximum number of non self-generated LSA allowed 500000
    Current number of non self-generated LSA 28
    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, 3 full
 Maximum number of configured interfaces 1024
 Number of external LSA 1. Checksum Sum 0x00a539
 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 3. 1 normal 2 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 2
	SPF algorithm executed 3 times
	Number of LSA 17.  Checksum Sum 0x0ad84b
	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, 1 full
    Area 1
	Number of interfaces in this area is 1
	It is a stub area
	  generates stub default route with cost 50
	SPF algorithm executed 6 times
	Number of LSA 23.  Checksum Sum 0x0a699e
	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, 1 full
    Area 2
	Number of interfaces in this area is 1
	It is a stub area, no summary LSA in this area
	  generates stub default route with cost 1
	SPF algorithm executed 5 times
	Number of LSA 7.  Checksum Sum 0x02cdf9
	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, 1 full

Type 5(AS External-LSA)はエリア0に接続するXR1〜XR3にはありますが、スタブエリアの内部ルータXR4とトータリースタブエリアの内部ルータXR5には入っていません。

XR1 show ospf database external
RP/0/RP0/CPU0:XR1#show ospf database external
Sun Sep 13 12:00:38.593 UTC


            OSPF Router with ID (1.1.1.1) (Process ID 1)

		Type-5 AS External Link States

  LS age: 283
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 172.16.1.0 (External Network Number)
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000001
  Checksum: 0x39a5
  Length: 36
  Network Mask: /24
	Metric Type: 2 (Larger than any link state path)
	TOS: 0 
	Metric: 20 
	Forward Address: 0.0.0.0
	External Route Tag: 0
XR4 show ospf database external
RP/0/RP0/CPU0:XR4#show ospf database external
Sun Sep 13 12:02:42.253 UTC


            OSPF Router with ID (4.4.4.4) (Process ID 1)
XR5 show ospf database external
RP/0/RP0/CPU0:XR5#show ospf database external
Sun Sep 13 12:03:26.438 UTC


            OSPF Router with ID (5.5.5.5) (Process ID 1)

内部ルータのshow ospf databaseを比べます。XR4(スタブ)にはSummary Net Link Statesとしてエリア間の経路とデフォルト経路0.0.0.0が入っています。XR5(トータリースタブ)のSummary Net Link Statesは、2台のABRが入れた0.0.0.0の2行だけです。

XR4 show ospf database
RP/0/RP0/CPU0:XR4#show ospf database
Sun Sep 13 12:02:36.705 UTC


            OSPF Router with ID (4.4.4.4) (Process ID 1)

		Router Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum Link count
2.2.2.2         2.2.2.2         331         0x80000002 0x00eb11 1
3.3.3.3         3.3.3.3         331         0x80000002 0x00c130 1
4.4.4.4         4.4.4.4         330         0x80000002 0x008c04 3

		Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum
10.2.4.4        4.4.4.4         330         0x80000001 0x00639c
10.3.4.4        4.4.4.4         330         0x80000001 0x007981

		Summary Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum
0.0.0.0         2.2.2.2         391         0x80000001 0x0075c0
0.0.0.0         3.3.3.3         381         0x80000001 0x0043bd
1.1.1.1         2.2.2.2         351         0x80000001 0x0051df
1.1.1.1         3.3.3.3         341         0x80000001 0x0033f9
2.2.2.2         2.2.2.2         391         0x80000001 0x001915
2.2.2.2         3.3.3.3         341         0x80000001 0x000f19
3.3.3.3         2.2.2.2         336         0x80000001 0x00fe29
3.3.3.3         3.3.3.3         381         0x80000001 0x00cc59
5.5.5.5         2.2.2.2         320         0x80000001 0x009888
5.5.5.5         3.3.3.3         320         0x80000001 0x007aa2
10.1.2.0        2.2.2.2         391         0x80000001 0x00d058
10.1.2.0        3.3.3.3         341         0x80000001 0x00bc67
10.1.3.0        2.2.2.2         351         0x80000001 0x00cf57
10.1.3.0        3.3.3.3         381         0x80000001 0x00a77c
10.2.5.0        2.2.2.2         391         0x80000001 0x00a381
10.2.5.0        3.3.3.3         320         0x80000002 0x008d91
10.3.5.0        2.2.2.2         320         0x80000002 0x009f82
10.3.5.0        3.3.3.3         381         0x80000001 0x0079a6
XR5 show ospf database
RP/0/RP0/CPU0:XR5#show ospf database
Sun Sep 13 12:03:21.137 UTC


            OSPF Router with ID (5.5.5.5) (Process ID 1)

		Router Link States (Area 2)

Link ID         ADV Router      Age         Seq#       Checksum Link count
2.2.2.2         2.2.2.2         365         0x80000002 0x00ed0f 1
3.3.3.3         3.3.3.3         365         0x80000002 0x00e10d 1
5.5.5.5         5.5.5.5         364         0x80000002 0x000d72 3

		Net Link States (Area 2)

Link ID         ADV Router      Age         Seq#       Checksum
10.2.5.2        2.2.2.2         365         0x80000001 0x00da2a
10.3.5.5        5.5.5.5         364         0x80000001 0x007878

		Summary Net Link States (Area 2)

Link ID         ADV Router      Age         Seq#       Checksum
0.0.0.0         2.2.2.2         436         0x80000001 0x0075c0
0.0.0.0         3.3.3.3         425         0x80000001 0x0057da

XR4のshow ospf database summary 0.0.0.0で、ABRごとのデフォルト経路のMetricを確認します。default-cost 50を入れたXR3(3.3.3.3)からのものがMetric 50、既定のままのXR2(2.2.2.2)からのものがMetric 1です。

XR4 show ospf database summary 0.0.0.0
RP/0/RP0/CPU0:XR4#show ospf database summary 0.0.0.0
Sun Sep 13 12:02:41.395 UTC


            OSPF Router with ID (4.4.4.4) (Process ID 1)

		Summary Net Link States (Area 1)

  Routing Bit Set on this LSA
  LS age: 395
  Options: (No TOS-capability, DC)
  LS Type: Summary Links (Network)
  Link State ID: 0.0.0.0 (Summary Network Number)
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000001
  Checksum: 0x75c0
  Length: 28
  Network Mask: /0
	TOS: 0 	Metric: 1 

  LS age: 385
  Options: (No TOS-capability, DC)
  LS Type: Summary Links (Network)
  Link State ID: 0.0.0.0 (Summary Network Number)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000001
  Checksum: 0x43bd
  Length: 28
  Network Mask: /0
	TOS: 0 	Metric: 50 

経路表では、XR4のデフォルト経路はMetricの小さいXR2経由の1本だけです。XR5は2台のABRのコストが同じなので、デフォルト経路が2本(ECMP)になり、OSPFの経路はこのデフォルト経路だけです。

XR4 show route ospf
RP/0/RP0/CPU0:XR4#show route ospf
Sun Sep 13 12:02:31.547 UTC

O*IA 0.0.0.0/0 [110/2] via 10.2.4.2, 00:05:24, GigabitEthernet0/0/0/0
O IA 1.1.1.1/32 [110/3] via 10.2.4.2, 00:05:24, GigabitEthernet0/0/0/0
                [110/3] via 10.3.4.3, 00:05:24, GigabitEthernet0/0/0/1
O IA 2.2.2.2/32 [110/2] via 10.2.4.2, 00:05:24, GigabitEthernet0/0/0/0
O IA 3.3.3.3/32 [110/2] via 10.3.4.3, 00:05:24, GigabitEthernet0/0/0/1
O IA 5.5.5.5/32 [110/3] via 10.2.4.2, 00:05:14, GigabitEthernet0/0/0/0
                [110/3] via 10.3.4.3, 00:05:14, GigabitEthernet0/0/0/1
O IA 10.1.2.0/24 [110/2] via 10.2.4.2, 00:05:24, GigabitEthernet0/0/0/0
O IA 10.1.3.0/24 [110/2] via 10.3.4.3, 00:05:24, GigabitEthernet0/0/0/1
O IA 10.2.5.0/24 [110/2] via 10.2.4.2, 00:05:24, GigabitEthernet0/0/0/0
O IA 10.3.5.0/24 [110/2] via 10.3.4.3, 00:05:24, GigabitEthernet0/0/0/1
XR5 show route ospf
RP/0/RP0/CPU0:XR5#show route ospf
Sun Sep 13 12:03:16.177 UTC

O*IA 0.0.0.0/0 [110/2] via 10.2.5.2, 00:05:58, GigabitEthernet0/0/0/0
               [110/2] via 10.3.5.3, 00:05:58, GigabitEthernet0/0/0/1

Type 5が届かない172.16.1.0/24(XR1が再配布している経路)へは、デフォルト経路で出ていきます。XR4からのtracerouteの1ホップ目がXR2(10.2.4.2)になっています。172.16.1.0/24はXR1でNull0に向けているので、2ホップ目以降は応答がありません。

XR4 show route 172.16.1.1 / traceroute 172.16.1.1
RP/0/RP0/CPU0:XR4#show route 172.16.1.1

Sun Sep 13 12:04:50.856 UTC

Routing entry for 0.0.0.0/0
  Known via "ospf 1", distance 110, metric 2, candidate default path, type inter area
  Installed Sep 13 11:57:07.338 for 00:07:43
  Routing Descriptor Blocks
    10.2.4.2, from 2.2.2.2, via GigabitEthernet0/0/0/0
      Route metric is 2
  No advertising protos. 
RP/0/RP0/CPU0:XR4#traceroute 172.16.1.1 source 4.4.4.4 maxttl 4 timeout 1

Sun Sep 13 12:04:51.160 UTC

Type escape sequence to abort.
Tracing the route to 172.16.1.1

 1  10.2.4.2 5 msec  4 msec  5 msec 
 2   *  *  * 
 3   *  *  * 
 4   *  *  * 

バックボーンはスタブにできない

エリア0(バックボーン)はスタブにできません。ABRのXR2でエリア0にstubを入れると、commitの時点で拒否されます。拒否された設定とエラーはshow configuration failedで確認できます。

XR2 エリア0にstubを入れたときの show configuration failed
RP/0/RP0/CPU0:XR2(config-ospf-ar)#show configuration failed
Sun Sep 13 12:05:32.418 UTC
!! SEMANTIC ERRORS: This configuration was rejected by 
!! the system due to semantic errors. The individual 
!! errors with each failed configuration command can be 
!! found below.


router ospf 1
 area 0
  stub
!!% 'OSPF' detected the 'warning' condition 'Error: Backbone area cannot be configured as a stub or NSSA'
 !
!
end

拒否された設定は反映されないので、エリア0の設定は変わりません。

検証Configおよびshow結果

5台すべてから、次の種類をルータごとに分けて取得しています。検証Configは..._run.txtです。

ファイル 内容
..._show.txt show version / show interface description / show route / show route ospf / show ospf / show ospf interface / show ospf interface brief / show ospf neighbor / show ospf neighbor detail / show ospf database / show ospf database router / show ospf database network / show ospf statistics interface / show ospf database summary / show ospf database summary 0.0.0.0 / show ospf database external / show ospf routes / show router-id / show running-config router ospf
..._log.txt 設定を投入する直前にlogmsgでマーカーを入れ、その時刻をshow logging startに指定して取得したshow logging
..._run.txt show running-config(=検証Config)
..._trace.txt show ospf trace events
..._ping.txt ping / traceroute(XR1〜XR3からXR4・XR5のLoopback0、XR4・XR5からXR1のLoopback0)
..._commit.cfg 設定を投入したときにcommitされた内容(show configuration commit changes last 1
ルータ show出力 syslog running-config trace ping commit
XR1 show log run trace ping commit
XR2 show log run trace ping commit
XR3 show log run trace ping commit
XR4 show log run trace ping commit
XR5 show log run trace ping commit

XR4・XR5からデフォルト経路で172.16.1.1へ向けたtracerouteXR4 / XR5、XR2のエリア0にstubを入れて拒否された内容はこちらです。

関連記事

スタブエリアの仕組みはOSPFのスタブエリアとトータリースタブエリア、NSSAはOSPFのNSSAとトータリーNSSA、OSPFの基本的な設定はIOS XR OSPF基本設定を参照してください。