Cisco IOS XR OSPF NSSA設定方法
Cisco IOS XR でOSPFのNSSAとトータリーNSSAを設定するコマンドです。router ospf配下のareaサブモードで指定します。NSSAがType 7で外部経路を運ぶ仕組みと、ABRがType 5へ変換する動きはOSPFのNSSAとトータリーNSSAで解説しています。
router ospf [プロセス名]
area [エリアID]
nssa [no-summary | default-information-originate | translate type7 always]
default-cost [コスト]
!
!| 入力箇所 | 入力内容 |
|---|---|
no-summary | 付けるとトータリーNSSA(Type 3も止める)。付けなければNSSA |
default-information-originate | ABRがデフォルト経路をType 7で注入する。NSSAでは明示しないとデフォルト経路が入らない |
translate type7 always | そのABRを常にType 7 → Type 5の変換役にする |
| [コスト] | no-summaryのときにABRが注入するType 3デフォルト経路のメトリック。既定は1 |
コマンドは、入れるルータが違います。
| コマンド | 入れるルータ |
|---|---|
nssa | そのエリアに接続する全ルータ(ABRと内部ルータの両方)。1台でも漏れるとOptionsのNビットが一致せず隣接が確立しません |
nssa no-summary | そのエリアのABRだけ。ABRが複数あるときは全台に入れます。内部ルータはnssaのままです |
nssa default-information-originate | ABRだけ |
default-cost | ABRだけ。ABRごと、エリアごとに別の値にできます |
nssaの後ろのキーワードは上書きになる
IOS XRで注意が必要なのはここです。nssaの後ろのキーワードは併記できず、後から入れたものが前のものを置き換えます。 nssa default-information-originateが入っているエリアにnssa no-summaryを入れると、default-information-originateは消えます。逆も同様です。
(投入前) nssa default-information-originate
(投入) nssa no-summary
(投入後) nssa no-summary ← default-information-originate が消えるエラーも警告も出ないため、show running-configで確かめるまで気づけません。両方の効果が欲しい場合はno-summaryだけを入れます。 トータリーNSSAではABRがType 3のデフォルト経路を自動で注入するので、default-information-originateは不要です。
area [エリアID] nssa [no-summary] [default-information-originate]のようにキーワードを併記できます。IOS XRはareaサブモードの中に書き、キーワードが上書きになる点が異なります。Cisco IOS XR NSSAの確認コマンド
| コマンド | 確認できること |
|---|---|
show running-config router ospf | 設定したキーワード。上書きの結果を確かめる唯一の方法 |
show ospf | エリアごとの種別(It is a NSSA area)、変換役かどうか(Perform type-7/type-5 LSA translation)、Type 7のデフォルト経路を出しているか(generates NSSA default route with cost) |
show ospf database | エリアに入っているLSA。NSSAにはType-7 AS External Link StatesがありType-5が無い。トータリーNSSAではSummary Net Link Statesが0.0.0.0だけになる |
show ospf database nssa-external | Type 7の中身。OptionsのType 7/5 translationがPビット |
show ospf database external | エリア0側から見たType 5。変換されたものはAdvertising RouterがABR、Forward Addressが元のASBRになる |
show ospf database summary 0.0.0.0 | トータリーNSSAでABRが入れるType 3のデフォルト経路と、そのMetric |
show route ospf | 内部ルータのデフォルト経路。NSSAはO*N2、トータリーNSSAはO*IA |
show ospfではNSSAとトータリーNSSAを区別できません。 スタブエリアのIt is a stub area, no summary LSA in this areaにあたる表示がNSSAには無く、どちらもIt is a NSSA areaとだけ出ます。no-summaryが効いているかはshow running-configか、内部ルータのshow ospf databaseでType 3が止まっていることで確かめます。
実機での検証
XR1〜XR5の5台で、エリア1をNSSA、エリア2をトータリーNSSAにしました。ABRはXR2とXR3の2台で、どちらもエリア0・1・2に接続しています。XR1はスタティックルート172.16.1.0/24を再配布するASBRです。XR4はNSSAの中のASBRで、172.16.4.0/24を再配布します。スタブエリアと違い、NSSAはエリア内にASBRを置けます。
| ルータ | 役割 | NSSA関連の設定 |
|---|---|---|
| XR1 | エリア0の内部ルータ、ASBR | なし |
| XR2 | ABR | エリア1にnssa default-information-originate、エリア2にnssa no-summary |
| XR3 | ABR | エリア1にnssa default-information-originate、エリア2にnssa no-summaryとdefault-cost 50 |
| XR4 | エリア1(NSSA)の内部ルータ、NSSA内のASBR | nssa |
| XR5 | エリア2(トータリーNSSA)の内部ルータ | nssa(no-summaryは入れない) |
NSSAの設定
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 Loopback1
passive enable
!
interface GigabitEthernet0/0/0/0
!
interface GigabitEthernet0/0/0/1
!
!
!router ospf 1
router-id 2.2.2.2
area 0
interface Loopback0
passive enable
!
interface GigabitEthernet0/0/0/0
!
!
area 1
nssa default-information-originate
interface GigabitEthernet0/0/0/1
!
!
area 2
nssa no-summary
interface GigabitEthernet0/0/0/2
!
!
!router ospf 1
router-id 3.3.3.3
area 0
interface Loopback0
passive enable
!
interface GigabitEthernet0/0/0/0
!
!
area 1
nssa default-information-originate
interface GigabitEthernet0/0/0/1
!
!
area 2
nssa no-summary
default-cost 50
interface GigabitEthernet0/0/0/2
!
!
!router static
address-family ipv4 unicast
172.16.4.0/24 Null0
!
!
router ospf 1
router-id 4.4.4.4
redistribute static
area 1
nssa
interface Loopback0
passive enable
!
interface Loopback1
passive enable
!
interface GigabitEthernet0/0/0/0
!
interface GigabitEthernet0/0/0/1
!
!
!router ospf 1
router-id 5.5.5.5
area 2
nssa
interface Loopback0
passive enable
!
interface GigabitEthernet0/0/0/0
!
interface GigabitEthernet0/0/0/1
!
!
!XR4とXR5はnssaだけです。no-summaryはABRに入れるものなので、トータリーNSSAの中の内部ルータであるXR5にも入れません。
キーワードの上書きを確認する
エリア2のABRには、先にnssa default-information-originateを入れ、後からnssa no-summaryを入れました。commitされた差分はnssa no-summaryの1行です。
RP/0/RP0/CPU0:XR2#show configuration commit changes last 1
Sun Sep 20 09:49:54.218 UTC
!! Building configuration...
!! IOS XR Configuration 26.1.1
router ospf 1
area 2
nssa no-summary
!
!
end投入後のshow running-configを見ると、エリア2からdefault-information-originateが消えています。エリア1は触っていないので残ったままです。
router ospf 1
router-id 2.2.2.2
area 0
interface Loopback0
passive enable
!
interface GigabitEthernet0/0/0/0
!
!
area 1
nssa default-information-originate
interface GigabitEthernet0/0/0/1
!
!
area 2
nssa no-summary
interface GigabitEthernet0/0/0/2
!
!
!設定の確認
show ospf
ABRでエリアごとの種別を確認します。エリア1・エリア2ともIt is a NSSA areaです。no-summaryを入れたエリア2にも専用の表示は出ません。
Area 1
Number of interfaces in this area is 1
It is a NSSA area
generates NSSA default route with cost 1
SPF algorithm executed 8 times
Number of LSA 26. Checksum Sum 0x0eb570
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 NSSA area
SPF algorithm executed 8 times
Number of LSA 7. Checksum Sum 0x03b69f
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 NSSA area
Perform type-7/type-5 LSA translation
generates NSSA default route with cost 1
Area 2
Number of interfaces in this area is 1
It is a NSSA area
Perform type-7/type-5 LSA translation読み取れることは3つです。
- エリア1の
generates NSSA default route with cost 1はdefault-information-originateの効果です。エリア2にこの行が無いのは、上書きで消えたためです - XR3だけに
Perform type-7/type-5 LSA translationが出ています。変換役は自動で1台に決まり、ルータIDの大きいほうが選ばれます(XR3が3.3.3.3、XR2が2.2.2.2) default-cost 50はここには出ません。値を確かめるには内部ルータ側のLSAを見ます
show ospf database
内部ルータのLSDBを見ると、NSSAとトータリーNSSAの違いがはっきり出ます。
RP/0/RP0/CPU0:XR4#show ospf database
Sun Sep 20 09:53:06.322 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 477 0x80000003 0x00777a 1
3.3.3.3 3.3.3.3 477 0x80000003 0x004d99 1
4.4.4.4 4.4.4.4 476 0x80000003 0x00466c 4
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
10.2.4.4 4.4.4.4 476 0x80000001 0x00ea0d
10.3.4.4 4.4.4.4 476 0x80000001 0x0001f1
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
1.1.1.1 2.2.2.2 498 0x80000001 0x00d850
1.1.1.1 3.3.3.3 487 0x80000001 0x00ba6a
2.2.2.2 2.2.2.2 538 0x80000001 0x00a085
2.2.2.2 3.3.3.3 487 0x80000001 0x009689
3.3.3.3 2.2.2.2 482 0x80000001 0x008699
3.3.3.3 3.3.3.3 527 0x80000001 0x0054c9
5.5.5.5 2.2.2.2 465 0x80000001 0x0020f8
5.5.5.5 3.3.3.3 465 0x80000001 0x000213
10.1.2.0 2.2.2.2 538 0x80000001 0x0058c8
10.1.2.0 3.3.3.3 487 0x80000001 0x0044d7
10.1.3.0 2.2.2.2 498 0x80000001 0x0057c7
10.1.3.0 3.3.3.3 527 0x80000001 0x002fec
10.2.5.0 2.2.2.2 538 0x80000001 0x002bf1
10.2.5.0 3.3.3.3 464 0x80000002 0x001502
10.3.5.0 2.2.2.2 464 0x80000002 0x0027f2
10.3.5.0 3.3.3.3 527 0x80000001 0x000117
172.16.1.1 2.2.2.2 498 0x80000001 0x006c02
172.16.1.1 3.3.3.3 487 0x80000001 0x004e1c
Type-7 AS External Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Tag
0.0.0.0 2.2.2.2 539 0x80000001 0x00d0d8 0
0.0.0.0 3.3.3.3 528 0x80000001 0x00b2f2 0
172.16.4.0 4.4.4.4 516 0x80000001 0x00f1c3 0RP/0/RP0/CPU0:XR5#show ospf database
Sun Sep 20 09:53:50.484 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 509 0x80000003 0x007978 1
3.3.3.3 3.3.3.3 509 0x80000003 0x006d76 1
5.5.5.5 5.5.5.5 508 0x80000002 0x0094e2 3
Net Link States (Area 2)
Link ID ADV Router Age Seq# Checksum
10.2.5.2 2.2.2.2 509 0x80000001 0x00629a
10.3.5.5 5.5.5.5 508 0x80000001 0x00ffe8
Summary Net Link States (Area 2)
Link ID ADV Router Age Seq# Checksum
0.0.0.0 2.2.2.2 239 0x80000001 0x00fc31
0.0.0.0 3.3.3.3 231 0x80000002 0x00c82f| 項目 | XR4(NSSA) | XR5(トータリーNSSA) |
|---|---|---|
Summary Net Link States(Type 3) | エリア外の経路がすべて入る | 0.0.0.0の2本だけ(ABRごとに1本) |
Type-7 AS External Link States | ABRが出すデフォルト0.0.0.0と、XR4自身の172.16.4.0 | 無い |
Type-5 AS External Link States | 無い(NSSAの境界で止まる) | 無い |
XR5にType-7が無いのは、no-summaryでdefault-information-originateが上書きされ、ABRがType 7のデフォルトを出さなくなったためです。代わりにType 3の0.0.0.0が入っています。
show ospf database summary 0.0.0.0(default-costの確認)
トータリーNSSAでABRが入れるデフォルト経路のメトリックです。XR3にだけdefault-cost 50を入れたので、ABRごとに値が違います。
RP/0/RP0/CPU0:XR5#show ospf database summary 0.0.0.0
Sun Sep 20 09:50:28.777 UTC
OSPF Router with ID (5.5.5.5) (Process ID 1)
Summary Net Link States (Area 2)
Routing Bit Set on this LSA
LS age: 37
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: 0xfc31
Length: 28
Network Mask: /0
TOS: 0 Metric: 1
LS age: 28
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: 80000002
Checksum: 0xc82f
Length: 28
Network Mask: /0
TOS: 0 Metric: 50 show ospf database nssa-external(PビットとType 7の中身)
Type 7のOptionsにあるPビットが、そのLSAをABRがType 5へ変換するかどうかを決めます。showではType 7/5 translationという文字列で出ます。
Type-7 AS External Link States (Area 1)
Routing Bit Set on this LSA
Options: (No TOS-capability, No Type 7/5 translation, DC)
LS Type: AS External Link
Link State ID: 0.0.0.0 (External Network Number)
Advertising Router: 2.2.2.2
Network Mask: /0
Metric Type: 2 (Larger than any link state path)
Metric: 1
Forward Address: 0.0.0.0
Routing Bit Set on this LSA
Options: (No TOS-capability, No Type 7/5 translation, DC)
LS Type: AS External Link
Link State ID: 0.0.0.0 (External Network Number)
Advertising Router: 3.3.3.3
Network Mask: /0
Metric Type: 2 (Larger than any link state path)
Metric: 1
Forward Address: 0.0.0.0
LS age: 519
Options: (No TOS-capability, Type 7/5 translation, DC)
LS Type: AS External Link
Link State ID: 172.16.4.0 (External Network Number)
Advertising Router: 4.4.4.4ABRが出すデフォルト経路はNo Type 7/5 translation(Pビット0)です。エリア外へ持ち出す必要がないため変換されません。XR4が再配布した172.16.4.0はType 7/5 translation(Pビット1)なので、ABRがType 5に作り直してAS全体へ流します。
show ospf database external(変換されたType 5)
エリア0のXR1から見ると、Type 5が2本あります。
RP/0/RP0/CPU0:XR1#show ospf database external
Sun Sep 20 09:50:59.471 UTC
OSPF Router with ID (1.1.1.1) (Process ID 1)
Type-5 AS External Link States
LS age: 422
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
Routing Bit Set on this LSA
LS age: 350
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 172.16.4.0 (External Network Number)
Advertising Router: 3.3.3.3
LS Seq Number: 80000001
Checksum: 0xa41f
Length: 36
Network Mask: /24
Metric Type: 2 (Larger than any link state path)
TOS: 0
Metric: 20
Forward Address: 4.4.4.4
External Route Tag: 0172.16.1.0はXR1自身が再配布したものです。172.16.4.0はXR4がType 7で出したものをXR3が変換したもので、Advertising Routerが変換役のXR3、Forward Addressが元のASBRであるXR4のルータIDになっています。転送先はXR3ではなくXR4という意味で、エリア0のルータはXR4へ直接向かいます。
show route ospf
内部ルータのルーティングテーブルです。同じ「デフォルト経路」でも、出どころが違うため表示が変わります。
RP/0/RP0/CPU0:XR4#show route ospf
Sun Sep 20 09:53:01.730 UTC
O*N2 0.0.0.0/0 [110/1] via 10.2.4.2, 00:07:50, GigabitEthernet0/0/0/0
[110/1] via 10.3.4.3, 00:07:50, GigabitEthernet0/0/0/1
O IA 1.1.1.1/32 [110/3] via 10.2.4.2, 00:07:50, GigabitEthernet0/0/0/0
[110/3] via 10.3.4.3, 00:07:50, GigabitEthernet0/0/0/1
O IA 2.2.2.2/32 [110/2] via 10.2.4.2, 00:07:50, GigabitEthernet0/0/0/0
O IA 3.3.3.3/32 [110/2] via 10.3.4.3, 00:07:50, GigabitEthernet0/0/0/1
O IA 5.5.5.5/32 [110/3] via 10.2.4.2, 00:07:39, GigabitEthernet0/0/0/0
[110/3] via 10.3.4.3, 00:07:39, GigabitEthernet0/0/0/1
O IA 10.1.2.0/24 [110/2] via 10.2.4.2, 00:07:50, GigabitEthernet0/0/0/0
O IA 10.1.3.0/24 [110/2] via 10.3.4.3, 00:07:50, GigabitEthernet0/0/0/1
O IA 10.2.5.0/24 [110/2] via 10.2.4.2, 00:07:50, GigabitEthernet0/0/0/0
O IA 10.3.5.0/24 [110/2] via 10.3.4.3, 00:07:50, GigabitEthernet0/0/0/1
O IA 172.16.1.1/32 [110/3] via 10.2.4.2, 00:07:50, GigabitEthernet0/0/0/0
[110/3] via 10.3.4.3, 00:07:50, GigabitEthernet0/0/0/1RP/0/RP0/CPU0:XR5#show route ospf
Sun Sep 20 09:53:45.175 UTC
O*IA 0.0.0.0/0 [110/2] via 10.2.5.2, 00:03:43, GigabitEthernet0/0/0/0| ルータ | デフォルト経路 | LSAの種類 |
|---|---|---|
| XR4(NSSA) | O*N2 0.0.0.0/0 | Type 7(default-information-originate) |
| XR5(トータリーNSSA) | O*IA 0.0.0.0/0 | Type 3(no-summaryでABRが自動注入) |
XR5の経路が1本だけなのは、Type 3がデフォルト経路以外すべて止まっているためです。XR2経由だけになっているのは、XR3のdefault-cost 50よりXR2のコスト1のほうが小さいからです。
XR4の172.16.1.1/32は、XR1のLoopback1をOSPFで広告したものなのでType 3として届きます。再配布した172.16.1.0/24のほうはType 5なのでNSSAの境界で止まり、XR4のテーブルには入っていません。
ping / traceroute
XR1からNSSA内のASBRが再配布した172.16.4.1へ、XR5からエリア0の1.1.1.1へ、それぞれ到達します。Type 7 → Type 5の変換と、トータリーNSSAのデフォルト経路が実際に機能していることの確認です。
RP/0/RP0/CPU0:XR1#ping 172.16.4.1 source 1.1.1.1 count 50 timeout 1
Success rate is 100 percent (50/50), round-trip min/avg/max = 7/9/45 ms
RP/0/RP0/CPU0:XR1#traceroute 172.16.4.1 source 1.1.1.1 timeout 1 probe 2 maxttl 3
Sun Sep 20 09:50:43.527 UTC
Type escape sequence to abort.
Tracing the route to 172.16.4.1
1 10.1.2.2 6 msec 5 msec
2 10.2.4.4 10 msec * RP/0/RP0/CPU0:XR5#ping 1.1.1.1 source 5.5.5.5 count 50 timeout 1
Success rate is 100 percent (50/50), round-trip min/avg/max = 6/8/32 ms
RP/0/RP0/CPU0:XR5#traceroute 1.1.1.1 source 5.5.5.5 timeout 1 probe 2 maxttl 3
Sun Sep 20 09:53:38.959 UTC
Type escape sequence to abort.
Tracing the route to 1.1.1.1
1 10.2.5.2 6 msec 4 msec
2 10.1.2.1 8 msec *バックボーンはNSSAにできない
エリア0(バックボーン)はNSSAにできません。ABRのXR2でエリア0にnssaを入れると、commitの時点で拒否されます。
RP/0/RP0/CPU0:XR2(config-ospf-ar)#show configuration failed
Sun Sep 20 09:54:49.899 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
nssa
!!% '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 database nssa-external / show ospf database external / show ospf database summary / show ospf database summary 0.0.0.0 / show ospf border-routers / 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 |
..._commit.cfg | NSSAの設定を投入したときに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 |
エリア2にnssa no-summaryを入れたときのcommit内容はXR2 / XR3、XR2のエリア0にnssaを入れて拒否された内容はこちらです。
関連記事
NSSAの仕組みはOSPFのNSSAとトータリーNSSA、スタブエリアはOSPFのスタブエリアとトータリースタブエリア、OSPFの基本的な設定はIOS XR OSPF基本設定、スタブエリアの設定はIOS XR OSPFスタブエリア設定を参照してください。