コンフィグレーションガイド Vol.1


6.2.7 コンフィグレーションのファイルからの反映

loadコマンドを使用すると,指定したコンフィグレーションファイルの内容を編集中のコンフィグレーションへ反映できます。指定したコンフィグレーションファイルを編集中のコンフィグレーションにマージする例を次に示します。

図6‒27 コンフィグレーションファイルをマージ(追加)する例
(config)# show                                    <-1
    :
    :
    :
interface gigabitethernet 1/1
!
    :
    :
    :
(config)# exit
# cat /usr/home/operator/tmp.cnf                  <-2
interface gigabitethernet 1/1
  shutdown
  description "PORT001"
  speed 1000
  no shutdown
!
# configure
(config)# load merge /usr/home/operator/tmp.cnf   <-3
Do you want to apply the specified configuration file to the configuration being edited? (y/n): y
!(config)# show                                   <-4
    :
    :
    :
interface gigabitethernet 1/1
  description "PORT001"
  speed 1000
!
!(config)#
  1. 編集中のコンフィグレーションを確認します。

  2. マージするコンフィグレーションファイル/usr/home/operator/tmp.cnfを確認します(コンフィグレーションを追加する指定をします)。

  3. /usr/home/operator/tmp.cnfを編集中のコンフィグレーションにマージ(追加)します。

  4. マージが完了した編集中のコンフィグレーションを確認します。

図6‒28 コンフィグレーションファイルをマージ(削除)する例
# show running-config                             <-1
    :
    :
    :
interface gigabitethernet 1/1
  description "PORT001"
  speed 1000
    :
    :
    :
# cat /usr/home/operator/tmp2.cnf                 <-2
interface gigabitethernet 1/1
  shutdown
  no description
  no speed
  no shutdown
!
# configure
(config)# load merge /usr/home/operator/tmp2.cnf  <-3
Do you want to apply the specified configuration file to the configuration being edited? (y/n): y
!(config)# show                                   <-4
    :
    :
    :
interface gigabitethernet 1/1
!
    :
    :
    :
!(config)#
  1. 編集中のコンフィグレーションを確認します。

  2. マージするコンフィグレーションファイル/usr/home/operator/tmp2.cnfを確認します(コンフィグレーションを削除する指定をします)。

  3. /usr/home/operator/tmp2.cnfを編集中のコンフィグレーションにマージ(削除)します。

  4. マージが完了した編集中のコンフィグレーションを確認します。