2 ステージ コンフィギュレーション コミット

この章では、Cisco NX-OS デバイス上で 2 ステージ コンフィギュレーション コミット モードを有効にする方法について説明します。

この章は、次の項で構成されています。

2 段階構成のコミットについて

インタラクティブ セッションでは、コマンドを実行するとコマンドが実行され、実行コンフィギュレーションが変更されます。この動作は、1 ステージ コンフィギュレーション コミットと呼ばれます。確認コミットまたは2段階の設定コミットでは、設定の変更がステージング データベースに保存されます。これらの変更は、commit コマンドを実行するまで実行コンフィギュレーションに影響しません。この 2 段階のプロセスにより、ターゲット コンフィギュレーション セッションが作成されます。このコンフィギュレーションでは、スイッチの実行状態にコミットする前に、設定の変更、編集、および確認を行うことができます。永続的にコミットする前に、指定した期間の変更をコミットすることもできます。commit コマンドを実行しないと、指定した時間が経過してもスイッチは以前の設定に戻ります。コミットが成功すると、コミット ID、ユーザ名、およびタイムスタンプを含むコミット情報を表示できます。

次の図に、2 段階の設定コミット プロセスを示します。

図 1. 2 段階でのコミット コンフィギュレーション プロセス

注意事項と制約事項

2 段階設定コミットには、次の注意事項および制限事項があります。

  • この機能は、ユーザ インタラクティブ セッションの CLI インターフェイスでのみサポートされます。

  • 機能関連のコンフィギュレーション コマンドを実行する前に、feature コマンドを使用して機能を有効にし、commit コマンドを使用してコミットします。

  • 2 段階設定コミット モードは、メンテナンス モード、スケジューラ モード、仮想モードなどの他のモードをサポートしていません。

  • 2 段階設定コミット モードの場合は、1 段階設定コミット モードで異なるセッションから同時に設定を編集しないでください。

  • 変更を確定する前に、show configuration コマンドを使用して設定を確認します。

  • Show configuration には、段階的な設定が表示されます。

    • 実際の違いが表示されます。つまり、同じコマンドの yes および no 形式は空の設定になります。

    • 設定を無効にするには、正確な no 形式の cli を発行することを推奨します。

      例:「ip address x」設定を無効にするには、「no ip address」ではなく「no ip address x」を指定する必要があります。

    • インターフェイス レイヤ変更コマンド(switchport / no switchport)は明示的に発行する必要があります。

    • コミットを試行する前に、セッション内の無効な設定をユーザが手動で削除する必要があります。手動で削除できなかった場合は、セッションをクリアして新しいセッションを開始します。

  • 検証に失敗した場合は、コミットして編集します。

  • コミットが失敗すると、設定は以前の設定にロールバックされます。

  • コミットしない設定は、スイッチをリロードした後は保存されません。

  • この機能は、NX-API、EEM、PPM、および Netconf でのコミットをサポートしていません。

  • 一度にアクティブにできる 2 段階設定コミット セッションは 1 つだけです。

2 ステージ コンフィギュレーション コミット モードでの設定

2 ステージ コンフィギュレーション コミット モードで機能を有効にするには、次の手順を実行します。


(注)  


この手順では、例として BGP 機能を有効にします。


手順

  コマンドまたはアクション 目的

ステップ 1

configure dual-stage

例:

switch# configure dual-stage
switch(config-dual-stage)#

新しいターゲット コンフィギュレーション セッションを作成します。

(注)  

 

ターゲット コンフィギュレーションは、実行コンフィギュレーションのコピーではありません。ターゲット コンフィギュレーションには、そのターゲット コンフィギュレーション セッションで入力されたコンフィギュレーション コマンドだけが含まれます。

ステップ 2

feature feature_name

例:

switch(config-dual-stage)# feature bgp
switch(config-dual-stage)#

機能を有効にします。

(注)  

 
  • 2 ステージ コンフィギュレーション コミット モードを開始する前でも、この機能を有効にできます。

  • 機能が有効になっていない場合は、機能関連のコマンドを組み合わせて使用することはできません。

ステップ 3

commit [confirmed seconds]

例:

switch(config-dual-stage-router)# commit confirmed 30
Verification Succeeded.
Proceeding to apply configuration. This might take a while depending on amount of configuration in buffer.
Please avoid other configuration changes during this time.

Configuration committed by user 'admin' using Commit ID : 1000000001

switch(config-dual-stage)# 
switch(config-dual-stage)# commit
Confirming commit for trial session.
switch(config-dual-stage)#

例:

switch(config-dual-stage)# hostname example-switch
switch(config-dual-stage)# commit 
Verification Succeeded.

Proceeding to apply configuration. This might take a while depending on amount of configuration in buffer.
Please avoid other configuration changes during this time.
Configuration committed by user 'admin' using Commit ID : 1000000002
example-switch(config-dual-stage)#

実行コンフィギュレーションに変更をコミットします。

  • confirmed :実行コンフィギュレーションに変更をコミットします。

  • : グローバル コンフィギュレーション モードで、最低 30 秒間、最大 65535 秒間の試験稼働のためにコンフィギュレーションをコミットします。

(注)  

 

トライアル期間を入力する場合は、commit コマンドを実行して設定を確認します。commit コマンドを実行しないと、トライアル期間後に以前の設定に戻ります。

ステップ 4

例:

switch(config-dual-stage)# router bgp 64515.46
switch(config-dual-stage-router)# 
switch(config-dual-stage-router)#   router-id 141.8.139.131
switch(config-dual-stage-router)#

このコンフィギュレーション モードでサポートされている機能関連のコマンドを実行します。

ステップ 5

show configuration

例:

switch(config-dual-stage-router)# show configuration
! Cached configuration
!
router bgp 64515.46
 router-id 141.8.139.131

ターゲット コンフィギュレーションの内容を表示します。

(注)  

 

このコマンドは、デュアルステージ コンフィギュレーション モードでのみ実行できます。

ステップ 6

commit [confirmed seconds ]

例:

switch(config-dual-stage-router)# commit 
Verification Succeeded.
Proceeding to apply configuration. This might take a while depending on amount of configuration in buffer.
Please avoid other configuration changes during this time.
Configuration committed by user 'admin' using Commit ID : 1000000003

実行コンフィギュレーションに変更をコミットします。

ステップ 7

(任意) show configuration commit [changes] commit-id

例:

switch(config-dual-stage-router)# show configuration commit changes 1000000003
*** /bootflash/.dual-stage/1000000003.tmp       Fri Mar 19 10:59:00 2021
--- /bootflash/.dual-stage/1000000003   Fri Mar 19 10:59:05 2021
***************
*** 378,383 ****
--- 378,385 ----
  line console
  line vty
  boot nxos bootflash:/nxos64.10.1.1.44.bin 
+ router bgp 64515.46
+   router-id 141.8.139.131
  xml server timeout 1200
  
  no priority-flow-control override-interface mode off

例:

switch(config-dual-stage)# show configuration commit 1000000003 
feature bgp
router bgp 64515.46
  router-id 141.8.139.131
.
.
. 
(任意)

コミット関連情報を表示します。

最後の 50 個のコミットまたは予約済みディスク領域に保存されたコミット ファイルのみが保存されます。予約済みディスク領域は 20 MB です。スイッチをリロードすると、すべてのコミット セッションが削除されます。ただし、コミット ID は削除されません。また、これらのコミット ID は、書き込み、消去、およびリロードの際にも削除されません。

指定したコミットの現在のセッションの変更のみを表示するには、show configuration commit changes commit-id コマンドを使用します。

指定したコミットの完全な構成と、いくつかのクラス マップ ポリシーが表示されます。これらのクラス マップ ポリシーは、新しいポリシーではなく、非表示のポリシーです。非表示のポリシーを表示するには、 show run all コマンドを使用します。

ステップ 8

(任意) save configuration filename

例:

switch(config-dual-stage)# save configuration bootflash:test.cfg
(任意)

ターゲット コンフィギュレーションは、実行コンフィギュレーションにコミットすることなく、独立したファイルに保存できます。

(注)  

 
  • ターゲット コンフィギュレーション ファイルは、後でロード、変更、またはコミットできます。ファイルはブートフラッシュに保存されます。

  • 保存したコンフィギュレーション ファイルを表示するには、show configuration filefilename コマンドを実行します。

  • ユーザ固有の情報の一部は、ユーザ ロールに基づいてマスクされます。

  • デュアルステージモードで保存された設定は暗号化されたファイルであり、#show configuration file <> を使用してのみ表示でき、#show file <> は使用できません。

ステップ 9

(任意) load filename

例:

switch (config-dual-stage)# show configuration 
! Cached configuration
switch (config-dual-stage)# load test.cfg
switch (config-dual-stage-router)# show configuration 
! Cached configuration
!
router bgp 1
switch(config-dual-stage-router)#
(任意)

保存したターゲット コンフィギュレーションをロードします。ファイルをロードした後、ファイルを変更したり、実行コンフィギュレーションにコミットしたりできます。変更を保存するには、save configuration filename コマンドを使用します。

save configuration filename コマンドのみを使用して保存したターゲット コンフィギュレーションをロードできます。

ステップ 10

(任意) clear configuration

例:

switch(config-dual-stage)# show configuration 
! Cached configuration
!
router bgp 64515.46
router-id 141.8.139.131
switch (config-dual-stage)# clear configuration 
switch (config-dual-stage)# show configuration 
! Cached configuration
switch (config-dual-stage)#
(任意)

コンフィギュレーション セッションを終了せずに、ターゲット コンフィギュレーションに加えられた変更をクリアします。コミットされていない設定変更は削除されます。

ステップ 11

end

例:

switch(config-dual-stage-if)# end
Uncommitted changes found, commit them before exiting (yes/no/cancel)? [cancel]

グローバル デュアル コンフィギュレーション モードを終了します。

設定変更をコミットせずにコンフィギュレーション セッションを終了すると、変更内容を保存するか、変更を破棄するか、または操作をキャンセルするように指示されます。

  • はい:設定変更をコミットしてから、コンフィギュレーション モードを終了します。

  • いいえ:設定変更をコミットせずに、コンフィギュレーション モードを終了します。

  • キャンセル:設定変更をコミットせずに、コンフィギュレーション モードに留まります。

(注)  

 
  • 確認コミット タイマーの実行中に終了することを選択した場合は、同じオプションが表示されます。終了を選択した場合、トライアル設定はすぐにロールバックされます。

  • タイマーが期限切れになる前にデフォルト セッションがタイムアウトした場合、トライアル設定はセッションを終了する前にロールバックします。この場合、警告メッセージが表示されます。

ステップ 12

show configuration dual-stage sessions

例:

switch(config-dual-stage)# show configuration dual-stage sessions 
SNo. Session          Line         User         Date      
---- ---------------- ------------ ------------ ----------
1    8671-17101913    /dev/ttyS0   admin        Wed Feb 17 10:56:00 2021
switch(config-dual-stage)# end
switch# show configuration dual-stage sessions 
There are no active dual stage sessions
switch#
 

コンフィギュレーション セッションを開始する前に、進行中のその他のコンフィギュレーション セッションがないか確認する必要があります。シングル ユーザのみがデュアル ステージ コンフィギュレーション モードを開始できます。したがって、新しいセッションを開始する前に、前のセッションを終了する必要があります。最大 32 のインタラクティブ VSH セッションがあり、show コマンドはデュアル ステージ セッションの PID と回線情報を表示します。

(注)  

 

デュアル ステージ モードは、システムの準備完了後にのみアクセスできます。

ステップ 13

clear configuration commits diskspace

例:

Southlake-2# clear configuration commits diskspace ?
<1-20971> Number of Kilo Bytes of disk space to free

Southlake-2# clear configuration commits diskspace 100
Deleting 7 rollback points from '1000005557' to '1000005563'
101 KB of disk space will be freed.
Continue with deletion (yes/no)? [no] y
Southlake-2#

EXEC モードまたは管理 EXEC モードで clear configuration commits コマンドを入力することにより、最も古い設定の commitID を削除できます。clear configuration commit コマンドの後ろには、解放するディスク スペースの量または削除する commitID の数を指定する必要があります。最も古い一連の commitID を削除して指定したディスク スペースを空けるには、ディスクスペース キーワードと再要求するキロバイト数の後ろに clear configuration commits コマンドを入力します。

ステップ 14

clear configuration commits oldest

例:

switch(config-dual-stage)# clear configuration commits oldest 10
Deleting 10 rollback points '1000000030' to '1000000039'
125 KB of disk space will be freed.
Continue with deletion (yes/no)? [no] n
 

最も古い方からの指定した回数分の commitID を削除するには、最も古いキーワードと削除する commitID 数の後ろに clear configuration commits コマンドを入力します。

ステップ 15

Show configuration failed

例:

switch(config-dual-stage-if)# commit
Verification Succeeded.

Proceeding to apply configuration. This might take a while depending on amount of configuration in buffer.
Please avoid other configuration changes during this time.
Failed to commit one or more configuration items.
Commit Failed, Rolling back ...
switch(config-dual-stage)#
switch(config-dual-stage)# show configuration failed 
`config terminal`
`router bgp 100 `
`neighbor 2.2.2.2 `
`bfd `
Syntax error while parsing 'bfd '

`neighbor 3.3.3.3 `
`bfd `
Syntax error while parsing 'bfd '

`interface port-channel23 `
`bfd `
Syntax error while parsing 'bfd '

`end`
`end`
switch(config-dual-stage)#

 

設定変更は、コミット操作中に意味的に検証され、検証が成功すると実際のバックエンド コミットが開始されます。コミット中に 1 つ以上の設定エントリが失敗すると、メッセージが表示されます。失敗したコンフィギュレーションのエラー メッセージと説明を表示するには、show configuration failed コマンドを入力します。これにより、最後のコミットで失敗した設定ブロックが表示されます。設定ブロックは、設定コンテキストを保持します。

ステップ 16

show configuration failed noerrors

例:

switch(config-dual-stage)# show configuration failed noerror 
router bgp 100 
  neighbor 2.2.2.2 
    bfd 
  neighbor 3.3.3.3 
    bfd 
interface port-channel23 
  bfd 
switch(config-dual-stage)#

 

失敗したコンフィギュレーション ブロックのエラー設定(説明なし)のみを表示するには、show configuration failed noerrors コマンドを入力します。

ステップ 17

load configuration failed commit

例:

switch(config-dual-stage)# load configuration failed commit 
switch(config-dual-stage-if)# sh configuration 
! Cached configuration
!
router bgp 100
 neighbor 2.2.2.2
    bfd
!
interface port-channel23
 bfd
switch(config-dual-stage-if)#

 

コミット中にルータが検証失敗メッセージを表示した場合、設定変更は失われません。ターゲット設定を変更し、再度コミットできます。設定変更をコミットしようとして、コンフィギュレーションが失敗したというメッセージがルータから表示された場合、その設定変更内容は失われません。デュアルステージ コンフィギュレーション モード留まっている間に、sいっぱい下コンフィギュレーション ブロックをターゲット コンフィギュレーションにリロードし、エラーを修正して、変更内容をコミットできます。

失敗した設定をロードするには、load configuration failed commit コマンドを入力します。コンフィギュレーションを回復して、修正、コミットするか、またはファイルに保存した後であれば、コンフィギュレーションが失われることはありません。ロード中、構文的に誤った設定は無視されることに注意してください。「show configuration」を使用してターゲット設定を表示できます。

2ステージコンフィギュレーション コミット モードの中止

コンフィギュレーション セッションを破棄すると、コミットされていない変更内容は破棄され、コンフィギュレーション セッションが終了します。設定変更は、警告なしに削除されます。

switch(config-dual-stage)# router bgp 1
switch(config-dual-stage-router)# neighbor 1.2.3.4
switch(config-dual-stage-router-neighbor)# remote-as 1
switch(config-dual-stage-router-neighbor)# show configuration 
! Cached configuration
!
router bgp 1
neighbor 1.2.3.4
remote-as 1
switch(config-dual-stage-router-neighbor)# show run bgp 

!Command: show running-config bgp
!Running configuration last done at: Wed Mar 17 16:17:40 2021
!Time: Wed Mar 17 16:17:55 2021

version 10.1(2) Bios:version 
feature bgp


switch(config-dual-stage-router-neighbor)# abort
switch# show run bgp

!Command: show running-config bgp
!Running configuration last done at: Wed Mar 17 16:18:00 2021
!Time: Wed Mar 17 16:18:04 2021

version 10.1(2) Bios:version 
feature bgp

switch#

コミット ID の表示

コミットが成功するたびに、コミット ID が syslog に表示されます。システムに保存されるコミット ID の総数は、設定サイズと使用可能なディスク領域によって異なります。ただし、任意の時点で保存されるコミット ID の最大数は 50 です。

最後の 50 のコミット ID に関する情報を表示するには、show configuration commit list コマンドを使用します。各エントリに、設定変更をコミットしたユーザ、コミットの実行に使用された接続、およびコミット ID のタイムスタンプが表示されます。
switch# show configuration commit list
SNo. Label/ID     User     Line         Client     Time Stamp
~~~~ ~~~~~~~~~~~~ ~~~~~~~~ ~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
1    1000000001   admin    /dev/ttyS0   CLI        Wed Jul 15 15:21:37 2020
2    1000000002   admin    /dev/ttyS0   Rollback   Wed Jul 15 15:22:15 2020
3    1000000003   admin    /dev/pts/0   CLI        Wed Jul 15 15:23:08 2020
4    1000000004   admin    /dev/pts/0   Rollback   Wed Jul 15 15:23:46 2020

ロールバック機能

以前に成功したコミットのいずれかに設定をロールバックできます。rollback configuration コマンドを使用して、最後の 50 のコミットのいずれかにロールバックします。

switch# rollback configuration to ?
1000000015
1000000016
1000000017

:
:

switch#

Each commit ID acts as a (checkpoint or) rollback point. You can rollback to any given
commit ID. When you roll back the configuration to a specific rollback point, you undo
all configuration changes made during the session identified by the commitID for that
rollback point, and you undo all configuration changes made after that point. The
rollback process rolls back the configuration and commits the rolled-back configuration.
The rollback process also creates a new rollback point (commit ID)so that you can roll
back the configuration to the previous configuration.


switch(config-dual-stage)# rollback configuration to 1000000002
Rolling back to commitID :1000000002
ADVISORY: Rollback operation started...
Modifying running configuration from another VSH terminal in parallel
is not recommended, as this may lead to Rollback failure.

Configuration committed by rollback using Commit ID : 1000000004
switch(config-dual-stage)#

現在のセッション設定の表示

show configuration コマンドを使用して、現在のコンフィギュレーション セッションを表示できます。このコマンドは、デュアル ステージ モードでのみサポートされます。コミットが失敗すると、セッション設定はクリアされます。

switch(config-dual-stage-cmap)# show configuration
! Cached configuration
!
class-map type control-plane match-any copp-s-ipmcmiss
class-map type control-plane match-any copp-s-l2switched
class-map type control-plane match-any copp-s-l3destmiss
switch(config-dual-stage-cmap)#

If there is no configuration, the following message appears:

switch(config-dual-stage)# show configuration
! Cached configuration
switch(config-dual-stage)# commit
No configuration changes to commit.
switch(config-dual-stage)#