設定を表示
show設定モードコマンドは、Junos OS Evolvedを実行しているデバイスの現在の設定を表示します。
現在の設定を表示する
ジュニパーネットワークスデバイスの現在の設定を表示するには、設定モードで show コマンドを使用します。このコマンドは、現在の階層レベルまたは指定したレベルの設定を表示します。
user@host# show <statement-path>
設定ステートメントは決まった順序で表示され、インターフェイスはタイプ別のアルファベット順、次にスロット番号、PIC番号、ポート番号の番号順に表示されます。デバイスを設定する際、ステートメントは任意の順序で入力できることに注意してください。
また、CLI動作モード show configuration コマンドを使用して、最後にコミットされた設定を表示することもできます。これは、ルーターで現在実行されている設定です。
user@host> show configuration
設定を表示する場合、設定の最上部にあるタイムスタンプは、設定が最後に変更された日時を示します。
## Last commit: 2018-07-18 11:21:58 PDT by echen version 8.3
特定の階層レベルで必須ステートメントを省略した場合、設定モードで show コマンドを発行すると、欠落しているステートメントを示すメッセージが表示されます。必須のステートメントが欠落している場合、 show コマンドを発行するたびにこのメッセージがCLIに表示され続けます。
CLI設定に含まれるサポートされていないステートメントは、設定に「unsupported」のテキストで表示されます。例えば、サポートされていないプラットフォームでステートメントが設定されている場合、CLIは、そのステートメントがサポートされていないプラットフォームで設定されているため、設定で無視されるというメッセージを表示します。| display xmlオプションを付けてshowコマンドを発行すると、サポートされていない設定のunsupported="unsupported”属性を確認できます。
テキスト構成または XML 構成に含まれる "unsupported" 属性は、<get-configuration> RPC 呼び出しに unsupported="unsupported" 属性が含まれている場合にスクリプトに提供されます。
例:現在の設定を表示する
次の例は、現在のデバイスの設定を表示する方法を示しています。
設定の設定とコミット:
[edit] user@host#set protocols ospf area 0.0.0.0 interface xe-0/0/0 hello-interval 5[edit] user@host#commitcommit complete [edit] user@host#quitexiting configuration mode
現在の設定を表示します。
[edit]
user@host# show
protocols {
ospf {
area 0.0.0.0 {
interface xe-0/0/0 {
hello-interval 5;
}
}
}
}
特定の階層での設定の表示:
[edit]
user@host# show protocols ospf area 0.0.0.0
interface xe-0/0/0 {
hello-interval 5;
}
レベルを下に移動し、そのレベルの設定を表示します。
[edit] user@host#edit protocols ospf area 0.0.0.0[edit protocols ospf area 0.0.0.0] user@host#showinterface xe-0/0/0 { hello-interval 5; }
最後にコミットされた設定を表示します。
user@host> show configuration
## Last commit: 2018-08-10 11:21:58 PDT by user
version 8.3
protocols {
ospf {
area 0.0.0.0 {
interface xe-0/0/0 {
hello-interval 5;
}
}
}
}
設定に関する追加情報を表示します
設定モードでのみ、デバイス設定に関する追加情報を表示するには、 display detail コマンドをパイプ( | )の後に show コマンドと組み合わせて使用します。追加情報には、各設定ステートメントや、設定ステートメントの追加と変更に必要な許可ビットについて説明したヘルプ文字列が含まれます。
user@host# show <hierarchy-level> | display detail
例えば:
[edit]
user@host# show | display detail
##
## version: Software version information
## require: system
##
version 21.3-202107190949.0;
system {
##
## host-name: Host name for this router
## match: ^[[:alnum:]._-]+$
## require: system
##
}
host-name router-name;
##
## domain-name: Domain name for this router
## match: ^[[:alnum:]._-]+$
## require: system
##
domain-name isp.net;
##
## backup-router: Address of router to use while booting
##
backup-router 192.168.100.1;
root-authentication {
##
## encrypted-password: Encrypted password string
##
encrypted-password "$ABC123"; # SECRET-DATA
}
##
## name-server: DNS name servers
## require: system
##
name-server {
##
## name-server: DNS name server address
##
208.197.1.0;
}
login {
##
## class: User name (login)
## match: ^[[:alnum:]_-]+$
##
class super-user {
##
## permissions: Set of permitted operation categories
##
permissions all;
}
...
##
## services: System services
## require: system
##
services {
## services: Service name
##
ftp;
##
## services: Service name
##
telnet;
##
}
syslog {
##
## file-name: File to record logging data
##
file messages {
##
## Facility type
## Level name
##
any notice;
##
## Facility type
## Level name
##
authorization info;
}
}
}
chassis {
alarm {
sonet {
##
## lol: Loss of light
## alias: loss-of-light
##
lol red;
}
}
}
interfaces {
##
## Interface name
##
xe-2/1/1 {
atm-options {
##
## vpi: Virtual path index
## range: 0 .. 255
## maximum-vcs: Maximum number of virtual circuits on this VP
##
vpi 0 maximum-vcs 512;
}
##
## unit: Logical unit number
## range: 0 .. 16384
##
unit 0 {
##
## vci: ATM point-to-point virtual circuit identifier ([vpi.]vci)
}
##
vci 0.128;
}
}
...
コンフィギュレーションからセットコマンドを表示する
設定モードでは、設定を再作成するのに必要な一連の設定モード コマンドとして設定を表示できます。これは、設定モード コマンドの使用方法に精通していない場合や、表示された設定を切り取り、貼り付け、編集する場合に役立ちます。
階層の最上位レベルからsetコマンドとして設定を再作成するのに必要な一連の設定モードコマンドとして設定を表示するには、display setオプションを使用してshow設定モードコマンドを発行します。
user@host# show | display set <explicit>
| display setパイプオプションを付けてshow configurationコマンドを発行し、設定をsetコマンドとして表示する場合、表示する権限がない設定部分はテキストACCESS-DENIEDに置き換えられます。
階層のトップレベルから特定のステートメントを設定する際、| display setコマンドで<explicit>オプションを使用すると、システムが内部的に作成するすべての設定ステートメントを一連のセットコマンドとして明示的に表示することができます。
例えば、set interfaces ge-0/0/0.0 family inet 設定モード コマンドを発行するとします。次に、結果の設定をshow interfaces ge-0/0/0 |display set コマンドを使用します。出力には、入力した同じ設定コマンドが表示されます。explicit argumentを含める場合、出力には、ファミリーinetステートメントが指定されている階層を作成するために必要な設定ステートメントも表示されます。この例では特に、そのため、出力にはset interfaces ge-0/0/0.0ファミリーinetステートメントに加えて、set interfaces ge-0/0/0 unit 0ステートメントが含まれます。
例:設定からセットコマンドを表示する
[edit interfaces]階層レベルの設定からsetコマンドを表示します。
[edit interfaces xe-0/0/0] user@host#showunit 0 { family inet { address 192.107.1.230/24; } family iso; family mpls; } inactive: unit 1 { family inet { address 10.0.0.1/8; } } [edit interfaces ge-0/0/0] user@host#show | display setset interfaces ge-0/0/0 unit 0 family inet address 192.107.1.230/24 set interfaces xe-0/0/0 unit 1 family inet address 10.0.0.1/8 deactivate interfaces xe-0/0/0 unit 1 [edit interfaces ge-0/0/0] user@host#show | display set | explicitset interfaces ge-0/0/0 unit 0 family inet address 192.107.1.230/24 set interfaces xe-0/0/0 unit 0 family iso set interfaces xe-0/0/0 unit 0 family mpls set interfaces ge-0/0/0 unit 0 family inet set interfaces ge-0/0/0 unit 0 set interfaces xe-0/0/0 unit 1 family inet address 10.0.0.1/8 deactivate interfaces xe-0/0/0 unit 1
現在の階層レベルからコンフィグレーションを再作成するために必要な一連のコンフィギュレーション モード コマンドとして設定を表示するには、show | display set relative オプションを付けて show コンフィギュレーション モード コマンドを発行します。<explicit>オプションを使用すると、現在の階層レベルから特定のステートメントを設定する際、システムが内部に作成するすべての設定を一連のコマンドとして明示的に表示することができます。
[edit interfaces fe-0/0/0]
user@host# show
unit 0 {
family inet {
address 192.107.1.230/24;
}
family iso;
family mpls;
}
inactive: unit 1 {
family inet {
address 10.0.0.1/8;
}
}
[edit interfaces xe-0/0/0]
user@host# show | display set relative
set unit 0 family inet address 192.107.1.230/24
set unit 0 family iso
set unit 0 family mpls
set unit 1 family inet address 10.0.0.1/8
deactivate unit 1
user@host# show | display set relative | explicit
set unit 0 family inet address 192.168.1.230/24
set unit 0 family inet
set unit 0 family iso
set unit 0 family mpls
set unit 0
set unit 1 family inet address 10.0.0.1/8
set unit 1 family inet
deactivate unit 1
例:セット 一致オプション付きコマンドを表示する
設定を set コマンドとして表示し、出力をフィルタリングして正規表現に一致するテキストを検索するには、パイプ( | )の後に match オプションを指定します。
user@host# show | display set | match regular-expression
インターフェイスに関連付けられたIPアドレスを表示します。
xe-2/3/0 {
unit 0 {
family inet {
address 192.107.9.106/30;
}
}
}
et-5/1/0 {
unit 0 {
family inet {
address 192.107.9.15/32 {
destination 192.107.9.192;
}
}
}
}
lo0 {
unit 0 {
family inet {
address 127.0.0.1/32;
}
}
}
user@host# show interfaces | display set | match address
set interfaces xe-2/3/0 unit 0 family inet address 192.168.9.106/30
set interfaces et-5/1/0 unit 0 family inet address 192.168.9.15/32 destination 192.168.9.192
set interfaces lo0 unit 0 family inet address 127.0.0.1/32