サービスの改善にご協力お願いします。

お客様のご意見をお聞かせください。

アンケートの所要時間はおよそ 2 分です。

header-navigation
keyboard_arrow_up
list Table of Contents

この機械翻訳はお役に立ちましたでしょうか?

starstarstarstarstar
Go to English page
免責事項:

このページは、サードパーティー製機械翻訳ソフトウェアを使用して翻訳されます。質の高い翻訳を提供するために合理的な対応はされていますが、ジュニパーネットワークスがその正確性を保証することはできかねます。この翻訳に含まれる情報の正確性について疑問が生じた場合は、英語版を参照してください. ダウンロード可能なPDF (英語版のみ).

はじめに:CLI のクイック ツアー

date_range 19-Jan-25

ネットワーク管理者は、Junos OS CLI を使用して、設定の変更、運用モードと設定モードの切り替え、 ユーザー アカウントの作成、および基本的なコマンドの実行を行うために、以下のトピックを参照してください。

注:

Junos OS の基本的な紹介が必要な場合は、 Junos OS の入門ガイドを参照してください。

さらに詳しい情報や、ジュニパーネットワークスのデバイスでの Junos OS の使用方法については、「 Junos OS の概要」を参照してください。

この CJunos OSLI ガイドは、概Junos OS念と動作原理を理解していることを前提にしています。

コマンド ライン インタフェースを使い始める

このトピックでは、Junos OS CLI の起動方法、コマンド階層の表示方法、および小規模な設定変更の方法を説明します。

注:

始める前に、デバイスのハードウェアがセットアップされ、Junos OSがインストールされていることを確認します。コンソールとデバイスを直接接続するか、またはコンソールから SSH または Telnet を使用してネットワークにアクセスできる必要があります。デバイスがセット アップされていない場合は、先に進む前に、デバイスに同梱されているインストール手順に従ってください。

デバイスにログインして CLI を起動するには、次の手順に従います。

  1. root としてログインします。

    root ログイン アカウントは、すべてのコマンドとステートメントにアクセスできるスーパーユーザー権限を持っています。

  2. CLI を起動します。
    content_copy zoom_out_map
    root# cli
    root@>
    

    コマンド プロンプトの > に、運用モードであることが表示されます。その後、設定モードになると、プロンプトは「#」に変わります。

注:

デバイスで初めて root アカウントを使用する場合、デバイスは root に必要なパスワードなしで出荷されていることを忘れないでください。初めてコンフィギュレーションをコミットするときは、root パスワードを設定する必要があります。Telnet セッションでは、root アクセスは許可されていません。SSH 接続経由で root アクセスを有効にするには、 system services ssh root-login allow ステートメントを設定する必要があります。

CLI コマンドは、プラットフォームやソフトウェアのリリースによって異なる場合があります。CLI には、利用可能なコマンドに関するヘルプを得るための方法がいくつかあります。このセクションでは、ヘルプの確認方法に関する例をいくつか示します。

  1. ? を入力すると、動作モードで使用可能な最上位のコマンドが表示されます。

    content_copy zoom_out_map
    root@>  ? 
    Possible completions:
        clear           Clear information in the system
        configure       Manipulate software configuration information
        diagnose        Invoke diagnose script
        file            Perform file operations
        help            Provide help information
        monitor         Show real-time debugging information
        mtrace          Trace multicast path from source to receiver
        ping            Ping remote target
        quit            Exit the management session
        request         Make system-level requests
        restart         Restart software process
        set             Set CLI properties, date/time, craft interface message
        show            Show system information
        ssh             Start secure shell on another host
        start           Start shell
        telnet          Telnet to another host
        test            Perform diagnostic debugging
        traceroute      Trace route to remote host
    
  2. file ? を入力すると、file コマンドのすべての補完候補が表示されます。

    content_copy zoom_out_map
    root@> file ?
    Possible completions:
        <[Enter]>            Execute this command
        archive              Archives files from the system
        checksum             Calculate file checksum
        compare              Compare files
        copy                 Copy files (local or remote)
        delete               Delete files from the system
        list                 List file information
        rename               Rename files
        show                 Show file contents
        source-address       Local address to use in originating the connection
        |                    Pipe through a command
    
  3. file archive ? を入力すると、file archive コマンドのすべての補完候補が表示されます。

    content_copy zoom_out_map
    root@>  file archive ? 
    Possible completions:
        compress             Compresses the archived file using GNU gzip (.tgz)
        destination          Name of created archive (URL, local, remote, or floppy)
        source               Path of directory to archive
    

オペレーション モードとコンフィギュレーション モードの切り替え

を実行しているデバイスを監視および設定する場合Junos OS、モードの切り替えが必要になることがあります。運用モードとコンフィギュレーションモードを切り替えると、コマンド プロンプトも変化します。動作モード プロンプトは、直角ブラケット(>)である。コンフィギュレーション モードのプロンプトは、ポンド記号またはハッシュ記号(#)です。

動作モードと設定モードを切り替える方法は、以下の通りです。

  1. 機器にログインしてcliコマンドを入力し、Enter キーを押すと、自動的にオペレーションモードになります。
    content_copy zoom_out_map
    ---JUNOS 17.2B1.8 built 2018-05-09 23:41:29 UTC
    % cli
    user@host> 
  2. コンフィグレーションモードに入るには、CLI の運用モードで configureコマンドまたはeditコマンドを入力します。括弧内のプロンプト([edit])は、バナーとも呼ばれ、階層の最上位にあるコンフィギュレーション モードであることを示しています。たとえば、以下のように表示されます。
    content_copy zoom_out_map
    user@host> configure 
    Entering configuration mode
    
    [edit]
    user@host# 

    CLI プロンプトがuser@host>からuser@host#に変わり、コンフィギュレーション モードであることが示され、階層レベルを示すバナーが表示されます。

  3. コンフィギュレーション モードを終了し、オペレーション モードに戻るには、次のいずれかの方法があります。
    • 設定をコミットして終了する:

      content_copy zoom_out_map
      [edit]
      user@host# commit and-quit
      commit complete
      Exiting configuration mode
      user@host>
      
    • コミットせずに終了する:

      content_copy zoom_out_map
      [edit]
      user@host# exit
      Exiting configuration mode
      user@host>
      

    コンフィグレーション モードを終了すると、CLI プロンプトがuser@host#からuser@host>に変わり、バナーが表示されなくなります。設定モードの開始または終了は、変更をコミットすることなく、何回でも行うことができます。

  4. コンフィグレーションモード中に showなどのオペレーションモードコマンドの出力を表示するには、コンフィグレーrun ション モード コマンドを発行してください。次に、運用モード コマンドを指定します。
    content_copy zoom_out_map
    [edit]
    user@host# run operational-mode-command
    

    たとえば、バックアップ デバイスの VRRP 設定を変更しているときに、VRRP(仮想ルーター冗長性プロトコル)プライマリ デバイスの現在設定されている優先度値を表示する方法は以下の通りです。

    content_copy zoom_out_map
    [edit interfaces xe-4/2/0 unit 0 family inet vrrp-group 27]
    user@host# show 			
    virtual-address [ 192.168.1.15 ];
    [edit interfaces xe-4/2/0 unit 0 family inet vrrp-group 27]
    user@host# run show vrrp detail 			
    Physical interface: xe-5/2/0, Unit: 0, Address: 192.168.29.10/24
      Interface state: up, Group: 10, State: backup
      Priority: 190, Advertisement interval: 3, Authentication type: simple
      Preempt: yes, VIP count: 1, VIP: 192.168.29.55
      Dead timer: 8.326, Master priority: 201, Master router: 192.168.29.254
    [edit interfaces xe-4/2/0 unit 0 family inet vrrp-group 27]
    user@host# set priority ... 			
    

キーボードシーケンスを使用して、CLIを移動したり編集することができます。

Junos OSCLIのキーボードシーケンスを使用して、コマンドラインを移動したり編集することができます。また、キーボードシーケンスを使用して、最近実行されたコマンドのリストをスクロールすることもできます。以下の表は、CLIのキーボードシーケンスの一部を示しています。Emacsで使用されるものと同じものです。

表 1: CLIのキーボード ショートカット

キーボードシーケンス

アクション

Ctrl+b

カーソルを1 文字戻します。

Esc+bまたはAlt+b

カーソルを1単語戻します。

Ctrl+f

カーソルを1文字進めます。

Esc+fまたはAlt+f

カーソルを1単語進めます。

Ctrl+a

カーソルをコマンドラインの先頭に移動します。

Ctrl+e

カーソルをコマンドラインの末尾に移動します。

Ctrl+h、Delete、 またはBackspace

カーソルの前にある文字を削除します。

Ctrl+d

カーソルの位置にある文字を削除します。

Ctrl+k

カーソルの位置からコマンドラインの末尾までのすべての文字を削除します。

Ctrl+uまたは Ctrl+x

コマンドラインのすべての文字を削除します。

Ctrl+w、Esc+Backspace、 またはAlt+Backspace

カーソルの前にある単語を削除します。

Esc+dまたはAlt+d

カーソルの後ろにある単語を削除します。

Ctrl+y

カーソルで最後に削除されたテキストを挿入します。

Ctrl+l

現在の行を再度入力します。

Ctrl+p

最近実行されたコマンドのリストを後ろにスクロールします。

Ctrl+n

最近実行されたコマンドのリストを前にスクロールします。

Ctrl+r

検索文字列に一致する行を逆の順序で、CLI履歴から順次検索します。

Esc+/または Alt+/

現在の単語がプレフィックスである単語をCLI 履歴から検索します。

Esc+.またはAlt+.

最近コマンドラインに入力された単語のリストを後ろにスクロールします。

Esc+number sequence あるいはAlt+number sequence

キーボードシーケンスを実行する回数を指定します。

Juniper Networks デバイスのユーザー アカウントを設定する

このトピックでは、ルート アカウントを使用して Juniper Networks デバイスにログインし、新しいユーザー アカウントを設定する方法について説明します。自分自身のアカウントを設定したり、テスト アカウントを作成したりできます。

デバイスに新しいユーザー アカウントを設定するには、次の手順に従います。

  1. root としてログインし、設定モードにします。
    content_copy zoom_out_map
    root@host> configure
    [edit]
    root@host#
    

    [edit])プロンプトのバナーは、階層の最上位で設定編集モードになっていることを示しています。

  2. 設定の [edit system login] セクションを次のように変更します。
    content_copy zoom_out_map
    [edit]
    root@host# edit system login 
    [edit system login]
    root@host# 
    

    角括弧で囲まれたプロンプトが [edit system login] に変わり、階層内の新しいレベルであることを示します。

  3. ここで、新しいユーザーアカウントを追加します。この例では、user1がユーザー名を表しています。
    content_copy zoom_out_map
    [edit system login]
    root@host# edit user user1
    

    この例では、アカウントuser1を追加しています。

    注:

    ユーザー アカウント名にはピリオド(.)を使用できます。例えば、ユーザーアカウントを作ることができますuser.1。ただし、ユーザー名の先頭または末尾にピリオドを使用することはできません。

  4. アカウントのフル ネームを設定します。名前にスペースが含まれる場合は、名前全体を引用符(" ")で囲んでください。
    content_copy zoom_out_map
    [edit system login user user1]
    root@host# set full-name "User One" 
    
  5. アカウント クラスを設定します。アカウント クラスには、アカウントのユーザー アクセス権限を設定します。
    content_copy zoom_out_map
    [edit system login user user1]
    root@host# set class super-user 
    
  6. アカウントの認証方法とパスワードを設定します。
    content_copy zoom_out_map
    [edit system login user user1]
    root@host# set authentication plain-text-password 
    New password: 
    Retype new password:
    

    新しいパスワードのプロンプトが表示されたら、システムで暗号化が可能なクリアテキストのパスワードを入力し、新しいパスワードを確認します。

  7. 設定をコミットします。
    content_copy zoom_out_map
    [edit system login user user1]
    root@host# commit 
    commit complete
    

    コンフィグレーションの変更は、コンフィグレーションをコミットするまで有効ではありません。コミットが正常に完了すると、 commit complete メッセージが表示されます。

  8. 設定の最上位レベルに戻り、次のように終了します。
    content_copy zoom_out_map
    [edit system login user user1]
    root@host# top 
    [edit]
    root@host# exit 
    Exiting configuration mode
    
  9. デバイスからログアウトします。
    content_copy zoom_out_map
    root@host> exit 
    % logout Connection closed.
    
  10. 変更をテストするには、設定したばかりのユーザー アカウントとパスワードを使用して再度ログインします。
    content_copy zoom_out_map
    login: user1
    Password: password
    ---JUNOS 17.2B1.8 built 2018-05-09 23:41:29 UTC
    user1@host> 
    

    ログイン時に、コマンド プロンプトで新しいユーザー名を確認できます。

これで、CLI を使用してデバイスの状態を表示し、簡単な設定変更ができました。

注:

デバイスを設定するために発行するコマンドの完全な情報(例を含む)については、コンフィギュレーJunos OSションガイドを参照してください。

設定モードでのCLIエディターの使用

このトピックではCLIエディターで設定モードに入るために使用できる基本的なコマンドについて説明します。また、このトピックでは、設定階層のナビゲーション、ヘルプの取得、および設定セッション中に行う変更のコミットまたは取り消しに使用するコマンドについても説明します。

タスク

コマンド/ステートメント

設定の編集  

構成モードにします。

CLI を起動すると、デバイスは動作モードになります。設定モードを明示的に入力する必要があります。これを行うと、CLIプロンプトが から user@host>に変更されuser@host#、階層レベルが角括弧内に表示されます。

configure
user@host> configure
[edit]
user@host# 

ステートメントの階層を作成します。

edit コマンドを使用して、階層を同時に作成し、階層内のその新しいレベルに移動することができます。edit コマンドを使用して、識別子の値を変更することはできません。

edit hierarchy-level value
[edit]
user@host# edit security zones security-zone myzone
[edit security zones security-zone myzone]
user@host# 

ステートメント階層を作成し、識別子値を設定します。

コマsetンドは などとなります。ただしedit、階層内の現在のレベルは変更されません。

set hierarchy-level value
[edit]
user@host# set security zones security-zone myzone
[edit]
user@host# 
階層の移動  

既存の階層レベルに下がります。

edit hierarchy-level
[edit]
user@host# edit security zones
[edit security zones]
user@host#

1 レベル上の階層に移動します。

up
[edit security zones]
user@host# up
[edit security]
user@host#

階層の最上位に移動します。

top 
[edit security zones]
user@host# top
[edit]
user@host#
変更のコミットまたは取り消し  

設定をコミットします。

commit
[edit]
user@host# commit
commit complete

現在のセッションから変更がロールバックされます。

rollback コマンドを使用して、現在の設定セッションからすべての変更を取り消すことができます。セッションを終了するか、変更をコミットする前に rollbackコマンドを実行すると、ソフトウェアが最近コミットされた設定をデバイスに読み込みます。階層の edit レベルで rollback ステートメントを入力する必要があります。

rollback 
[edit]
user@host# rollback
load complete
設定モードの終了  

設定をコミットし、設定モードを終了します。

commit and-quit
[edit]
user@host# commit and-quit
user@host>

設定をコミットせずに、設定モードを終了します。

設定モードを終了する前に、up または top コマンドを使用して、階層の最上位に移動する必要があります。

exit
[edit]
user@host# exit
The configuration has been changed but not committed
Exit with uncommitted changes? [yes,no] (yes)
ヘルプの取得  

現在の階層レベルで有効なオプションのリストを表示します。

?
[edit ]
user@host# edit security zones ?
Possible completions:
   <[Enter]>                Execute this command 
> functional-zone      Functional zone 
> security-zone          Security zones   
|                                  Pipe through a command 
[edit]

ジュニパーネットワークス デバイスのステータスを確認

動作モードでは、show コマンドを使用してデバイスの状態を確認し、デバイスの活動を監視できます。

show コマンドの使用方法に慣れるには、次の手順に従います。

  • show ? を入力して、ルーターの監視に使用できる show コマンドのリストを表示します。

    content_copy zoom_out_map
    root@>  show ? 
    Possible completions:
      accounting           Show accounting profiles and records
      aps                  Show Automatic Protection Switching information
      arp                  Show system Address Resolution Protocol table entries
      as-path              Show table of known autonomous system paths
      bfd                  Show Bidirectional Forwarding Detection information
      bgp                  Show Border Gateway Protocol information
      chassis              Show chassis information
      class-of-service     Show class-of-service (CoS) information
      cli                  Show command-line interface settings
      configuration        Show current configuration
      connections          Show circuit cross-connect connections
      dvmrp                Show Distance Vector Multicast Routing Protocol        info
      dynamic-tunnels      Show dynamic tunnel information information
      esis                 Show end system-to-intermediate system information
      firewall             Show firewall information
      helper               Show port-forwarding helper information
      host                 Show hostname information from domain name server
      igmp                 Show Internet Group Management Protocol information
      ike                  Show Internet Key Exchange information
      ilmi                 Show interim local management interface information
      interfaces           Show interface information
      ipsec                Show IP Security information
      ipv6                 Show IP version 6 information
      isis                 Show Intermediate System-to-Intermediate System info
      l2circuit            Show Layer 2 circuit information
      l2vpn                Show Layer 2 VPN information
      lacp                 Show Link Aggregation Control Protocol information
      ldp                  Show Label Distribution Protocol information
      link-management      Show link management information
      llc2                 Show LLC2 protocol related information
      log                  Show contents of log file
      mld                  Show multicast listener discovery information
      mpls                 Show Multiprotocol Label Switching information
      msdp                 Show Multicast Source Discovery Protocol information
      multicast            Show multicast information
      ntp                  Show Network Time Protocol information
      ospf                 Show Open Shortest Path First information
      ospf3                Show Open Shortest Path First version 3 information
      passive-monitoring   Show information about passive monitoring
      pfe                  Show Packet Forwarding Engine information
      pgm                  Show Pragmatic Generalized Multicast information
      pim                  Show Protocol Independent Multicast information
      policer              Show interface policer counters and information
      policy               Show policy information
      ppp                  Show PPP process information
      rip                  Show Routing Information Protocol information
      ripng                Show Routing Information Protocol for IPv6 info
      route                Show routing table information
      rsvp                 Show Resource Reservation Protocol information
      sap                  Show Session Announcement Protocol information
      security             Show security information
      services             Show services information
      snmp                 Show Simple Network Management Protocol information
      system               Show system information
      task                 Show routing protocol per-task information
      ted                  Show Traffic Engineering Database information
      version              Show software process revision levels
      vpls                 Show VPLS information
      vrrp                 Show Virtual Router Redundancy Protocol information
    
  • show chassis routing-engine コマンドを使用して、ルーティング エンジンの状態を表示します。

    content_copy zoom_out_map
    root@>  show chassis routing-engine  
    Routing Engine status:
      Slot 0:
        Current state                  Master
        Election priority              Master (default)
        Temperature                 31 degrees C / 87 degrees F
        CPU temperature             32 degrees C / 89 degrees F
        DRAM                       768 MB
        Memory utilization          84 percent
        CPU utilization:
          User                       0 percent
          Background                 0 percent
          Kernel                     1 percent
          Interrupt                  0 percent
          Idle                      99 percent
        Model                          RE-2.0
        Serial ID                      b10000078c10d701
        Start time                     2005-12-28 13:52:00 PST
        Uptime                        12 days, 3 hours, 44 minutes, 19 seconds
        Load averages:                 1 minute   5 minute  15 minute
                                           0.02       0.01       0.00
    
  • show system storage コマンドを使用して、デバイスで使用可能なストレージを表示します。

    content_copy zoom_out_map
    root@>  show system storage 
     
    Filesystem        Size       Used     Avail  Capacity   Mounted on
    /dev/ad0s1a       865M       127M      669M       16%  /
    devfs             1.0K       1.0K        0B      100%  /dev
    devfs             1.0K       1.0K        0B      100%  /dev/
    /dev/md0          30M        30M         0B      100%  /packages/mnt/jbase
    /dev/md1          158M       158M        0B      100%  /packages/mnt/jkernel-9.3B1.5
    /dev/md2          16M        16M         0B      100%  /packages/mnt/jpfe-M7i-9.3B1.5
    /dev/md3          3.8M       3.8M        0B      100%  /packages/mnt/jdocs-9.3B1.5
    /dev/md4          44M        44M         0B      100%  /packages/mnt/jroute-9.3B1.5
    /dev/md5          12M        12M         0B      100%  /packages/mnt/jcrypto-9.3B1.5
    /dev/md6          25M        25M         0B      100%  /packages/mnt/jpfe-common-9.3B1.5
    /dev/md7          1.5G       196K      1.4G        0%  /tmp
    /dev/md8          1.5G       910K      1.4G        0%  /mfs
    /dev/ad0s1e       96M        38K        88M        0%  /config
    procfs            4.0K       4.0K        0B      100%  /proc
    /dev/ad1s1f       17G        2.6G       13G       17%  /var

設定変更のロールバック

このトピックでは、rollbackコマンドを使用して、コミットされていないが改訂されたコンフィギュレーションを、最も最近コミットされたJunos OS構成の状態に戻す方法を説明します。rollback コマンドは、設定を変更した後、それを保持しないことを決定した場合に便利です。

次の手順は、Juniper Networks デバイスで SNMP ヘルスモニターを設定し、ヘ ルスモニターを含まない、最近コミットされた設定に戻る方法を示しています。SNMP 正常性監視が設定されている場合、デバイスのファイル システムの使用率、CPU の使用率、メモリ使用率に関する、事前定義された監視情報が NMS(ネットワーク管理システム)に提供されます。

  1. 設定モードにします。

    content_copy zoom_out_map
    user@host> configure 
    entering configuration mode
    [edit]
    user@host# 
    
  2. SNMP の現在の設定があれば、それを表示します。

    content_copy zoom_out_map
    [edit]
    user@host# show snmp
    

    SNMP がデバイスで設定されていないため、snmp ステートメントは表示されません。

  3. 正常性監視を設定します。

    content_copy zoom_out_map
    [edit]
    user@host# set snmp health-monitor 
    
  4. 新しい設定を表示します。

    content_copy zoom_out_map
    [edit]
    user@host# show snmp 
    health-monitor;
    

    health-monitor ステートメントは、SNMP 正常性監視がデバイスで設定されていることを示します。

  5. rollback 設定モード コマンドを入力して、直近のコミットされた設定に戻します。

    content_copy zoom_out_map
    [edit]
    user@host# rollback 
    load complete
    
  6. 再度設定を表示して、変更がなくなったことを確認します。

    content_copy zoom_out_map
    [edit]
    user@host# show snmp 
    

    snmp 設定ステートメントは表示されません。正常性監視は設定されていません。

  7. commit コマンドを入力して、ロール バックした設定をアクティブにします。

    content_copy zoom_out_map
    [edit]
    user@host# commit
    
  8. 設定モードを終了します。

    content_copy zoom_out_map
    [edit]
    user@host# exit 
    Exiting configuration mode
    

rollback コマンドを使用して、以前の設定に戻すこともできます。

ルーティング プロトコルを設定する

このトピックでは、2 つの SONET インターフェイスを持つ OSPF バックボーン エリアを設定する方法について、サンプルの設定を提供します。

最終的な設定は次のようになります。

content_copy zoom_out_map
[edit]
protocols {
    ospf {
        area 0.0.0.0 {
            interface so-0/0/0 {
                hello-interval 5;
                dead-interval 20;
            }
            interface so-0/0/1 {
                hello-interval 5;
                dead-interval 20;
            }
        }
    }
}

ショートカット

この設定全体のショートカットを作成するには、次の 2 つのコマンドを使用します。

content_copy zoom_out_map
[edit]
user@host# set protocols ospf area 0.0.0.0 interface so-0/0/0 hello-interval 5 dead-interval 20
[edit]
user@host# set protocols ospf area 0.0.0.0 interface so-0/0/1 hello-interval 5 dead-interval 20

長い設定

このセクションでは、以前の OSPF 設定を作成する場合の長い例を示します。プロセスの中で、CLI のさまざまな機能の使用法について説明します。

  1. configure コマンドを発行して設定モードにします。
    content_copy zoom_out_map
    user@host> configure 
    entering configuration mode
    [edit]
    user@host# 
    

    プロンプトがポンド記号またはハッシュ記号(#)に変わり、設定モードであることを示します。

  2. 前述の設定を作成するには、まず protocols ospf ステートメントを編集します。
    content_copy zoom_out_map
    [edit]
    user@host# edit protocols ospf
    [edit protocols ospf]
    user@host# 
    
  3. 次に OSPF エリアを追加します。
    content_copy zoom_out_map
    [edit protocols ospf]
    user@host# edit area 0.0.0.0
    [edit protocols ospf area 0.0.0.0]
    user@host# 
    
  4. 1 番目のインターフェイスを追加します。
    content_copy zoom_out_map
    [edit protocols ospf area 0.0.0.0]
    user@host# edit interface so-0/0/0
    [edit protocols ospf area 0.0.0.0 interface so-0/0/0]
    user@host# 
    

    ネスト ステートメントが 4 つできました。

  5. hello と dead の間隔を設定します。
    content_copy zoom_out_map
    [edit protocols ospf area 0.0.0.0 interface so-0/0/0]
    user@host# set hello-interval 5
    user@host# set dead-interval 20
    user@host#
  6. show コマンドを使用すると、現在のレベルの設定内容を確認できます。
    content_copy zoom_out_map
    [edit protocols ospf area 0.0.0.0 interface so-0/0/0]
    user@host# show 
    hello-interval 5;
    dead-interval 20;
    [edit protocols ospf area 0.0.0.0 interface so-0/0/0]
    user@host# 
    
  7. このレベルで終わりですから、1つ上のレベルに上がって、今までの内容を確認してください。
    content_copy zoom_out_map
    [edit protocols ospf area 0.0.0.0 interface so-0/0/0]
    user@host# up 
    [edit protocols ospf area 0.0.0.0]
    user@host# show 
    interface so-0/0/0 {
        hello-interval 5;
        dead-interval 20;
    }
    [edit protocols ospf area 0.0.0.0]
    user@host# 
    

    interface ステートメントが表示されているのは、area ステートメントに移動したためです。

  8. 2 番目のインターフェイスを追加します。
    content_copy zoom_out_map
    [edit protocols ospf area 0.0.0.0]
    user@host# edit interface so-0/0/1
    [edit protocols ospf area 0.0.0.0 interface so-0/0/1]
    user@host# set hello-interval 5
    [edit protocols ospf area 0.0.0.0 interface so-0/0/1]
    user@host# set dead-interval 20
    [edit protocols ospf area 0.0.0.0 interface so-0/0/1]
    user@host# up 
    [edit protocols ospf area 0.0.0.0]
    user@host# show 
    interface so-0/0/0 {
        hello-interval 5;
        dead-interval 20;
    }
    interface so-0/0/1 {
        hello-interval 5;
        dead-interval 20;
    }
    [edit protocols ospf area 0.0.0.0]
    user@host# 
    
  9. 最上位レベルに移動して、作業内容を確認します。
    content_copy zoom_out_map
    [edit protocols ospf area 0.0.0.0]
    user@host# top
    [edit]
    user@host# show 
    protocols {
        ospf {
            area 0.0.0.0 {
                interface so-0/0/0 {
                    hello-interval 5;
                    dead-interval 20;
                }
                interface so-0/0/1 {
                    hello-interval 5;
                    dead-interval 20;
                }
            }
        }
    }
    [edit]
    user@host# 
    

    このコンフィギュレーションには、必要なステートメントが含まれています。

  10. 設定をコミットしてアクティブにする前に、設定が正しいことを確認します。
    content_copy zoom_out_map
    [edit]
    user@host# commit check
    configuration check succeeds
    [edit]
    user@host#
    
  11. 設定をコミットして、デバイスでアクティブ化します。
    content_copy zoom_out_map
    [edit]
    user@host# commit
    commit complete
    [edit]
    user@host#
    

ルーティングプロトコルの設定を変更する

インターフェース12so-0/0/11でデッドインターバルとハローインターバルを使い分けることにしたとします。設定に変更を加えることができます。

  1. 編集したいステートメントの完全な階層パスを入力し、適切な階層レベルに直接移動します。
    content_copy zoom_out_map
    [edit]
    user@host# edit protocols ospf area 0.0.0.0 interface so-0/0/1
    [edit protocols ospf area 0.0.0.0 interface so-0/0/1]
    user@host# show 
    hello-interval 5;
    dead-interval 20;
    [edit protocols ospf area 0.0.0.0 interface so-0/0/1]
    user@host# set hello-interval 7
    [edit protocols ospf area 0.0.0.0 interface so-0/0/1]
    user@host# set dead-interval 28
    [edit protocols ospf area 0.0.0.0 interface so-0/0/1]
    user@host# top
    [edit]
    user@host# show 
    protocols {
        ospf {
            area 0.0.0.0 {
                interface so-0/0/0 {
                    hello-interval 5;
                    dead-interval 20;
                }
                interface so-0/0/1 {
                    hello-interval 7;
                    dead-interval 28;
                }
            }
        }
    }
    [edit]
    user@host# 
    
  2. 1 番目のインターフェイスで OSPF を実行しない場合は、次のようにステートメントを削除します。
    content_copy zoom_out_map
    [edit]
    user@host# edit protocols ospf area 0.0.0.0
    [edit protocols ospf area 0.0.0.0]
    user@host# delete interface so-0/0/0
    [edit protocols ospf area 0.0.0.0]
    user@host# top
    [edit]
    user@host# show 
    protocols {
        ospf {
            area 0.0.0.0 {
                interface so-0/0/1 {
                    hello-interval 7;
                    dead-interval 28;
                }
            }
        }
    }
    [edit]
    user@host# 
    

    削除したステートメント内のすべてが削除されました。最上位レベルで delete protocols ospf を入力するだけで、OSPF 設定全体を削除することもできます。

  3. 例えば、残りのインタフェースで Hello 間隔と Dead 間隔をデフォルト値で使用することにして、そのインタフェースで OSPF を実行したい場合です。その場合、hello 間隔タイマーと dead 間隔タイマーを削除してください。
    content_copy zoom_out_map
    [edit]
    user@host# edit protocols ospf area 0.0.0.0 interface so-0/0/1
    [edit protocols ospf area 0.0.0.0 interface so-0/0/1]
    user@host# delete hello-interval
    [edit protocols ospf area 0.0.0.0 interface so-0/0/1]
    user@host# delete dead-interval
    [edit protocols ospf area 0.0.0.0 interface so-0/0/1]
    user@host# top
    [edit]
    user@host# show 
    protocols {
        ospf {
            area 0.0.0.0 {
                interface so-0/0/1;
            }
        }
    }
    [edit]
    user@host# 
    

    同じ階層に属するステートメントであれば、同時に複数設定することができます。階層は、上から順にステートメントのパスで構成され、また、階層の一番下には1つ以上のステートメントがあります。複数のステートメントを同時に設定することで、入力しなければならないコマンドの数をかなり減らすことができます。

  4. so-0/0/1インタフェースの元の hello 間隔タイマーと dead 間隔タイマーに戻るには、以下を入力します。
    content_copy zoom_out_map
    [edit]
    user@host# edit protocols ospf area 0.0.0.0 interface so-0/0/1
    [edit protocols ospf area 0.0.0.0 interface so-0/0/1]
    user@host# set hello-interval 5 dead-interval 20
    [edit protocols ospf area 0.0.0.0 interface so-0/0/1]
    user@host# exit
    [edit]
    user@host# show
    protocols {
        ospf {
            area 0.0.0.0 {
                interface so-0/0/1 {
                    hello-interval 5;
                    dead-interval 20;
                }
            }
        }
    }
    [edit]
    user@host#
    
  5. また、もう一方のインターフェースも、以前のように 1 つの項目だけで再作成することができます。
    content_copy zoom_out_map
    [edit]
    user@host# set protocols ospf area 0.0.0.0 interface so-0/0/0 hello-interval 5 dead-interval 20
    [edit]
    user@host# show
    protocols {
        ospf {
            area 0.0.0.0 {
                interface so-0/0/0 {
                    hello-interval 5;
                    dead-interval 20;
                }
                interface so-0/0/1 {
                    hello-interval 5;
                    dead-interval 20;
                }
            }
        }
    }
    [edit]
    user@host#
    
footer-navigation