はじめに:CLIのクイックツアー
ネットワーク管理者は、 Junos OS Evolved CLIを使用して、設定の変更、動作モードと設定モードの切り替え、ユーザーアカウントの作成、および基本的なコマンドの実行を行うために、以下のトピックを参照してください。
Junos OS Evolved に固有の入門および概要情報については、 Junos OS Evolved の紹介を参照してください。
この Junos OS Evolved CLI ガイドは、 Junos OS Evolved の概念と動作原理を理解していることを前提にしています。
コマンドラインインターフェイスの使用開始
このトピックでは、 Junos OS Evolved CLIの起動方法、コマンド階層の表示方法、および設定を軽微に変更する方法について説明します。
開始する前に、デバイスのハードウェアがセットアップされ、 Junos OS Evolved がインストールされていることを確認してください。コンソールとデバイスを直接接続するか、SSH または Telnet を使用してネットワークにアクセスできる必要があります。デバイスがセットアップされていない場合は、先に進む前にデバイスに同梱されているインストール手順に従ってください。
デバイスにログインして CLI を起動するには、次の手順に従います。
デバイスで初めて root アカウントを使用する場合、デバイスは root に必要なパスワードなしで出荷されていることを忘れないでください。初めて設定をコミットするときは、root パスワードを設定する必要があります。Telnet セッションでは root アクセスは許可されていません。SSH 接続経由で root アクセスを有効にするには、 system services ssh root-login allow ステートメントを設定する必要があります。
CLIコマンドは、プラットフォームやソフトウェアのリリースによって異なる場合があります。CLI には、利用可能なコマンドに関するヘルプを得るための方法がいくつか用意されています。このセクションでは、ヘルプの確認方法を示す例をいくつか示します。
-
?を入力すると、動作モードで使用可能な最上位のコマンドが表示されます。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
-
file ?を入力すると、fileコマンドのすべての補完候補が表示されます。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
-
file archive ?を入力すると、file archiveコマンドのすべての補完候補が表示されます。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 Evolvedを実行しているデバイスを監視および設定する場合、モードの切り替えが必要になる場合があります。動作モードと設定モードを切り替えると、コマンド プロンプトも変化します。動作モード プロンプトは、直角ブラケット(>)です。設定モードのプロンプトは、ポンド記号またはハッシュ記号(#)です。
動作モードと設定モードを切り替えるには:
キーボードシーケンスを使用してCLIをナビゲートおよび編集する
Junos OS Evolved CLIのキーボードシーケンスを使用して、コマンドラインを移動および編集できます。また、キーボードシーケンスを使用して、最近実行されたコマンドのリストをスクロールすることもできます。次の表に、CLI キーボードシーケンスの一部を示します。これらはEmacsで使用されるものと同じです。
| キーボードシーケンス |
アクション |
|---|---|
| Ctrl+b |
カーソルを1文字戻します。 |
| Esc+bまたはAlt+b |
カーソルを1単語戻します。 |
| Ctrl+f |
カーソルを1文字進めます。 |
| Esc+fまたはAlt+f |
カーソルを1単語進めます。 |
| Ctrl+a |
カーソルをコマンドラインの先頭に移動します。 |
| Ctrl+E |
カーソルをコマンドラインの末尾に移動します。 |
| Ctrl+h、Delete、 またはバックスペース |
カーソルの前の文字を削除します。 |
| 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 |
キーボードシーケンスを実行する回数を指定します。 |
ジュニパーネットワークスデバイスでユーザーアカウントを設定する
このトピックでは、ルート アカウントを使用してジュニパーネットワークス デバイスにログインし、新しいユーザー アカウントを設定する方法について説明します。自分自身のアカウントを設定したり、テスト アカウントを作成したりできます。
デバイスに新しいユーザー アカウントを設定するには:
これで、CLIを使用してデバイスステータスを表示し、簡単な設定変更ができました。
デバイスを設定するために発行するコマンドの完全な情報(例を含む)については、 Junos OS Evolved 設定ガイドを参照してください。
設定モードでのCLIエディターの使用
このトピックでは、CLIエディターで設定モードに入るために使用できる基本的なコマンドについて説明します。また、このトピックでは、設定階層のナビゲーション、ヘルプの取得、および設定セッション中に行った変更のコミットまたは取り消しに使用するコマンドについても説明します。
タスク |
コマンド/ステートメント |
例文 |
|---|---|---|
| 設定の編集 | ||
構成モードにします。 CLIを起動すると、デバイスは動作モードになります。設定モードを明示的に入力する必要があります。これを行うと、CLI プロンプトが |
configure |
user@host> [edit] user@host# |
ステートメント階層を作成します。
|
edit hierarchy-level value |
[edit]
user@host#[edit security zones security-zone myzone] user@host# |
ステートメント階層を作成し、識別子値を設定します。
|
set hierarchy-level value |
[edit]
user@host#[edit] user@host# |
| 階層の移動 | ||
既存の階層レベルに下がります。 |
edit hierarchy-level |
[edit]
user@host#[edit security zones] user@host# |
階層の1レベル上に移動します。 |
up |
[edit security zones]
user@host#[edit security] user@host# |
階層の最上位に移動します。 |
top |
[edit security zones]
user@host#[edit] user@host# |
| 変更のコミットまたは取り消し | ||
設定をコミットします。 |
commit |
[edit]
user@host# commit complete |
現在のセッションから変更がロールバックされます。
|
rollback |
[edit]
user@host# load complete |
| 設定モードの終了 | ||
設定をコミットし、設定モードを終了します。 |
commit and-quit |
[edit] user@host# commit and-quit user@host> |
設定をコミットせずに、設定モードを終了します。 設定モードを終了する前に、 |
exit |
[edit]
user@host# The configuration has been changed but not committed Exit with uncommitted changes? [yes,no] (yes) |
| サポートを得る | ||
現在の階層レベルで有効なオプションのリストを表示します。 |
? |
[edit ]
user@host#Possible completions: <[Enter]> Execute this command > functional-zone Functional zone > security-zone Security zones | Pipe through a command [edit] |
ジュニパーネットワークス デバイスの状態を確認する
動作モードでは、 show コマンドを使用してデバイスの状態を確認し、デバイスのアクティビティを監視できます。
showコマンドに慣れるには、次の手順に従います。
show ?を入力して、ルーターの監視に使用できるshowコマンドのリストを表示します。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 informationshow chassis routing-engineコマンドを使用して、ルーティングエンジンステータスを表示します。root@>
show chassis routing-engineRouting 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コマンドを使用して、デバイスで使用可能なストレージを表示します。root@>
show system storageFilesystem Size Used Avail Capacity Mounted on /dev/root 33M 33M 0 100% /run/initramfs /dev/vda2 16G 1.2G 14G 8% /soft /dev/vda5 3.0G 32M 2.8G 2% /data /dev/vda7 16G 4.5G 11G 31% /var /dev/loop0 2.3G 3.6M 2.2G 1% /data/var/external devtmpfs 7.7G 0 7.7G 0% /dev /tmp 7.7G 0 7.7G 0% /run/initramfs/uswitch/tmp /dev/loop1 4.2M 4.2M 0 100% /run/initramfs/uswitch/data/hashes/2fe9eb9ec67b489f02706e8d527937dbb2c0654b /dev/loop2 29M 29M 0 100% /run/initramfs/uswitch/data/hashes/ce7ca7504fda6e5a4ebb5476d1afaaee21ccd40a /dev/loop3 36M 36M 0 100% /run/initramfs/uswitch/data/hashes/b1e137c20a6c197bb5e32473ac59b4e79ed9feef /dev/loop4 602M 602M 0 100% /run/initramfs/uswitch/data/hashes/4c4d7a56fb4e27b41dbc4c994decbb0e4c3bf732 /dev/loop5 12M 12M 0 100% /run/initramfs/uswitch/data/hashes/3a20f9d431928916ad4651e5106dc88400c62de4 /dev/loop6 51M 51M 0 100% /run/initramfs/uswitch/data/hashes/e9da1c4dfa20207a83b1d1d930f372d5239452ab /dev/loop7 9.8M 9.8M 0 100% /run/initramfs/uswitch/data/hashes/bc5da75f89c534aac7b7c085001607fb630522b4 /dev/loop8 59M 59M 0 100% /run/initramfs/uswitch/data/hashes/048c311a16be258ee61e9f5d7620a697e14eeec5 /dev/loop9 6.4M 6.4M 0 100% /run/initramfs/uswitch/data/hashes/7eccac8ea0accc0caee8806515e165c1ccc688a4 /dev/loop10 34M 34M 0 100% /run/initramfs/uswitch/data/hashes/20ed997fccd04026da26c9138397b4908921a207 /dev/loop11 8.2M 8.2M 0 100% /run/initramfs/uswitch/data/hashes/93c46df17bc4ff252d945b3f54545d169ae9db99 /dev/loop12 33M 33M 0 100% /run/initramfs/uswitch/data/hashes/b0f7d08ed2bf60f4d1de1638d3a99ef33e34a6da /dev/loop13 7.2M 7.2M 0 100% /run/initramfs/uswitch/data/hashes/b5bcf77cdf5fda2b7fdefe785430901b9495959a /dev/loop14 4.8M 4.8M 0 100% /run/initramfs/uswitch/data/hashes/4b8707670eb7a3419fd16d4a743ce868e0b6c646 /dev/loop15 8.0K 8.0K 0 100% /run/initramfs/uswitch/data/hashes/0293de3480e2b1d19dce284adeeb84937e7738aa /dev/loop16 147M 147M 0 100% /run/initramfs/uswitch/data/hashes/092a08988fac0a35f755e3324633b032dc3541a1 uswitchd 4.2M 4.2M 0 100% / /dev/vda1 189M 5.3M 170M 4% /boot /dev/vda6 984M 1.3M 916M 1% /data/config /tmp 7.7G 48K 7.7G 1% /tmp tmpfs 7.7G 6.6M 7.7G 1% /run tmpfs 7.7G 236M 7.5G 3% /dev/shm tmpfs 7.7G 0 7.7G 0% /sys/fs/cgroup tmpfs 1.6G 0 1.6G 0% /run/user/928
関連項目
設定変更のロールバック
このトピックでは、 rollback コマンドを使用して、コミットされていないが改訂されたコンフィギュレーションを、最後にコミットされた Junos OS Evolved コンフィギュレーションの状態に戻す方法について説明します。 rollback コマンドは、設定を変更した後、それを保持しないことを決定した場合に便利です。
次の手順は、ジュニパーネットワークスデバイスでSNMPヘルスモニターを設定し、ヘルスモニターを含まない、最近コミットされた設定に戻る方法を示しています。SNMP正常性監視が設定されている場合、デバイスのファイルシステムの使用率、CPUの使用率、メモリ使用率に関する事前定義された監視情報がネットワーク管理システム(NMS)に提供されます。
設定モードにします。
user@host>
configureentering configuration mode [edit] user@host#SNMP の現在の設定があれば、それを表示します。
[edit] user@host#
show snmpデバイスでSNMPが設定されていないため、
snmpステートメントは表示されません。正常性モニターを設定します。
[edit] user@host#
set snmp health-monitor新しい設定を表示します。
[edit] user@host#
show snmphealth-monitor;health-monitorステートメントは、SNMP正常性監視がデバイスで設定されていることを示します。rollback設定モード コマンドを入力して、直近のコミットされた設定に戻します。[edit] user@host#
rollbackload complete再度設定を表示して、変更がなくなったことを確認します。
[edit] user@host#
show snmpsnmp設定ステートメントは表示されません。正常性モニターは設定されていません。commitコマンドを入力して、ロールバックした設定をアクティブにします。[edit] user@host#
commit設定モードを終了します。
[edit] user@host#
exitExiting configuration mode
rollbackコマンドを使用して、以前の設定に戻すこともできます。