IOS XRのConfig世代管理(Rollbackを使いこなす)

IOS XEとは違うIOS XR独特(juniperも似ているらしい)のConfig世代管理について、忘れても直ぐに思い出せるようにメモを残す。

IOS XR はIOS/IOS XEとは違って即座にrunning-configに定義が反映されない。
commitコマンドでrunning-configに反映される。
commitすると毎回記録する。また、何にcommitしたのかcommentを残せる。
更に便利なことに、rollbackも自由に出来る!また、rollbackも同様にcommentを残せる!


■ 1 ■ Install and Upgrade Guides

Cisco ASR 9000 シリーズ アグリゲーション サービ ス ルータ スタートアップ ガイド
https://www.cisco.com/c/ja_jp/td/docs/rt/servprovideredgert/asr9000aggregationservsrt/icg/001/asr9kbook/asr9kinit.html#95487

コンフィギュレーション履歴の管理とロールバック

Cisco ASR 9000 Series Aggregation Services Router Getting Started Guide
https://www.cisco.com/c/en/us/td/docs/routers/asr9000/software/getting_started/configuration/guide/asr9k/asr9kinit.html#95487
Managing Configuration History and Rollback

 

■ 2 ■ 雑に言うと...

ロールバックとは、Configをある時点の設定状態に戻すやり方

 ---

同じ構成で違う設定をして比較検証をしたかったので、このrollbackを使ったら便利そうだなと思いました。XR9Kvはリソース消費が激しいので同じ構成で、configの入れ替えをパンパンできるととても効率が良さそう。

実現したいこと(イメージ)

ISIS → OSPF → ISIS → OSPF+ISIS 

f:id:chimay_wh:20210306202852p:plain

f:id:chimay_wh:20210306202916p:plain

Cisco-live、Cisco-press、オンラインヘルプを見て検証したが意図したことができない。
CCOを見ながらオンラインヘルプを見て理解できた。
やっぱり最後はCCOに行きつく

 

今後よく使うであろう内容を検証しました。
(1) configの世代管理一覧
(2) configの世代管理一覧(コメント付き)
(3) Rollback(”to”vs ”to-exclude”)
(4) configの世代削除(CommitIdの削除)

 

■ 3 ■ config

CONFIGに深い意味はありません。
(勉強会#7 Segment Routing IGP Control Plane(後編)で使う予定の一部)

f:id:chimay_wh:20210306230452p:plain

■ 4 ■ Rollback あれこれ確認

(1) "commit"を実施した一覧を表示する。
# show configuration commit list

f:id:chimay_wh:20210306221820p:plain

設計書などに”CommitId”を控えていなければ、どこにrollbackするのかが分からない。
”CommitId”は何かしらの変更があって、commitコマンド実行するとドンドン増える...

任意ではあるが、

commit時にcommentを残した方が

後々都合が良い!

f:id:chimay_wh:20210306231425p:plain


(2) "commit"実施時のcommentを確認する。
# show configuration commit list detail

f:id:chimay_wh:20210306221909p:plain

 ちなみに今のrunning-configはこれ!

f:id:chimay_wh:20210306230715p:plain

これにロールバックするとどうなるかを確認する。

f:id:chimay_wh:20210306222212p:plain

 (3) 現状から、「CommitId: 1000000009」にrollbackするとどうなるかを確認する
# show configuration commit changes 【CommitId】

RP/0/RP0/CPU0:XR9Kv-3#show configuration commit changes 1000000009
Sat Mar 6 09:54:24.594 UTC
Building configuration...
!! IOS XR Configuration 6.6.2
no router isis 1
end

RP/0/RP0/CPU0:XR9Kv-3#

→ # no router isis 1 実行すれば、OSPFのみになる。ってことか。
これを実行することで、「CommitId: 1000000009」へrollbackする。

 

(4) 現状から、「CommitId: 1000000009」にrollbackするとどうなるかを確認する
# show configuration commit changes 【CommitId】diff
※(3)と実施している内容は同じ!表示を変えているだけ。

==== オンラインヘルプ =====
diff Show the changes in unix-like format

f:id:chimay_wh:20210306222657p:plain

→ # no router isis 1 実行すれば、OSPFのみになる。
これを実行することで、「CommitId: 1000000009」へrollbackする。
”- ”が付いている定義行が消える。
「CommitId: 1000000009」にrollbackすると、何が削除されるのかが分かり易い!

 

(5) CommitId: 1000000009 にロールバックする(to)

# rollback configuration to 【CommitId】 comment XXXXXXXX
※ comment以降は任意だが、記載した方が後々都合が良い

f:id:chimay_wh:20210306222921p:plain

RP/0/RP0/CPU0:XR9Kv-3#rollback configuration to 1000000009 comment OSPF and ISIS rollback to 1000000009(and including)
Sat Mar 6 09:59:49.203 UTC

Loading Rollback Changes.
Loaded Rollback Changes in 1 sec
Committing.
24 items committed in 1 sec (22)items/sec
Updating.
Updated Commit database in 1 sec
Configuration successfully rolled back to '1000000009'.
RP/0/RP0/CPU0:XR9Kv-3#

 

Max 60 characters かなり長いコメントもいける

OSPF and ISIS rollback to 1000000009(and including)

↑↑↑↑↑スペース含めて51文字↑↑↑↑↑

  

(6) rollbackの状況を確認する

f:id:chimay_wh:20210306223927p:plain

 

何も変わってない :(
”to Rollback up to (and including) a specific commit ”の意味が分かっていなかった。

# rollback configuration to 【CommitId】とすると、【CommitId】を含むことになるので
今回のようなロールバックは、”to-exclude ”にする必要があることが分かった。

 

(7) CommitId: 1000000013 / Comment: SR OSPF ONLY config にロールバックする(to-exclude)
# rollback configuration to-exclude 1000000009 comment OSPF and ISIS rollback to 1000000009(and excluding) => OSPF ONLY
RP/0/RP0/CPU0:XR9Kv-3#rollback configuration to-exclude 1000000009 comment OSPF and ISIS rollback to 1000000009(and$
Sat Mar 6 10:06:16.046 UTC

Loading Rollback Changes.
Loaded Rollback Changes in 1 sec
Committing....
13 items committed in 4 sec (3)items/sec
Updating.
Updated Commit database in 1 sec
Configuration successfully rolled back to excluding '1000000009'.
RP/0/RP0/CPU0:XR9Kv-3#

 

(8) rollbackの状況を確認する

f:id:chimay_wh:20210306224146p:plain

 

OSPFのみに出来た!次は、ISISのみにする!

 

(9) CommitId: 1000000006 にロールバックする(to-exclude)

f:id:chimay_wh:20210306224414p:plain

 

RP/0/RP0/CPU0:XR9Kv-3#rollback configuration to-exclude 1000000006
Sat Mar 6 10:18:50.794 UTC

Loading Rollback Changes.
Loaded Rollback Changes in 1 sec
Committing.
32 items committed in 1 sec (28)items/sec
Updating.
Updated Commit database in 1 sec
Configuration successfully rolled back to excluding '1000000006'.
RP/0/RP0/CPU0:XR9Kv-3#

 

(10) rollbackの状況を確認する

f:id:chimay_wh:20210306224741p:plain

 ISISのみに出来た!

 

■ 5 ■ Deleting CommitIDs

(1) CommitId を消すこともできる。

最古のCommitIdからどこまでを削除するのかを指定する。

==== オンラインヘルプ =====

f:id:chimay_wh:20210306225243p:plain

若しくは

f:id:chimay_wh:20210306225437p:plain

 

(2) 実際に削除するサイズを指定して、Diskスペースを確保する。

RP/0/RP0/CPU0:XR9Kv-3#clear configuration commits diskspace 5
Sat Mar 6 09:08:59.137 UTC
Deleting 3 rollback points '1000000001' to '1000000003'
6 KB of disk space will be freed. Continue with deletion?[confirm]
RP/0/RP0/CPU0:XR9Kv-3#

[confirm]でenterすれば実行!(他のコマンドと同じです。)

f:id:chimay_wh:20210306225704p:plain

rollback points '1000000001' to '1000000003'が確かに削除できた。


若しくは、最古の5つを削除する

RP/0/RP0/CPU0:XR9Kv-3#clear configuration commits oldest 5
Sat Mar 6 09:09:37.326 UTC
Deleting 5 rollback points '1000000004' to '1000000008'
12 KB of disk space will be freed. Continue with deletion?[confirm]
RP/0/RP0/CPU0:XR9Kv-3#

[confirm]でenterすれば実行!(他のコマンドと同じです。)

 f:id:chimay_wh:20210306225910p:plain

rollback points '1000000004' to '1000000008'が確かに削除できた。

 ■ 5 ■ 参考あれこれ

--- 参考図書 ---

Cisco IOS XR Fundamentals(CiscoPress)
 Chapter 4 Configuration Management
  Configuration Rollback

--- 参考URL ---

https://ccieojisan.net/post-1331/
Cisco:コンフィグレーション世代管理(IOS-XE/IOS-XR/NX-OS)

 

https://www.ciscolive.com/c/dam/r/ciscolive/us/docs/2016/pdf/BRKARC-1008.pdf
Intro to IOS XR for Enterprises and Service Providers(BRKARC-1008:Cisco-Live)