View the Configuration
The show
configuration mode command displays the current configuration for a
device running Junos OS.
Display the Current Configuration
To display the current configuration for a Juniper Networks device, use the
show
command in configuration mode. This command displays the
configuration at the current hierarchy level or at the specified level.
user@host# show <statement-path>
The configuration statements appear in a fixed order, interfaces appear alphabetically by type, and then in numerical order by slot number, PIC number, and port number. Note that when you configure the device, you can enter statements in any order.
You also can use the CLI operational mode show configuration
command
to display the last committed configuration, which is the configuration currently
running on the router:
user@host> show configuration
When you show a configuration, a timestamp at the top of the configuration indicates when the configuration was last changed:
## Last commit: 2018-07-18 11:21:58 PDT by echen version 8.3
If you have omitted a required statement at a specific hierarchy level, when you
issue the show
command in configuration mode, a message indicates
which statement is missing. If a mandatory statement is missing, the CLI continues
to display this message each time you issue a show
command.
For example:
[edit]
user@host# show
protocols {
pim {
interface so-0/0/0 {
priority 4;
version 2;
# Warning: missing mandatory statement(s): 'mode'
}
}
}
Unsupported statements included in the CLI configuration are displayed with the
“unsupported” text in the configuration. For example, if a statement is configured
on an unsupported platform, the CLI displays a message that the statement is ignored
in the configuration because it is configured on an unsupported platform. When you
issue the show
command with the | display xml
option, you can see the unsupported="unsupported”
attribute for
configuration that is unsupported.
The “unsupported” attribute included in text configuration or XML configuration is
provided to scripts when the unsupported="unsupported"
attribute is
included in the <get-configuration>
RPC call.
Example: Display the Current Configuration
The following example shows how you can display the current device configuration.
Set and commit a configuration:
[edit] user@host#set protocols ospf area 0.0.0.0 interface xe-0/0/0 hello-interval 5
[edit] user@host#commit
commit complete [edit] user@host#quit
exiting configuration mode
Display the current configuration:
[edit]
user@host# show
protocols {
ospf {
area 0.0.0.0 {
interface xe-0/0/0 {
hello-interval 5;
}
}
}
}
Display the configuration at a particular hierarchy:
[edit]
user@host# show protocols ospf area 0.0.0.0
interface xe-0/0/0 {
hello-interval 5;
}
Move down a level and display the configuration at that level:
[edit] user@host#edit protocols ospf area 0.0.0.0
[edit protocols ospf area 0.0.0.0] user@host#show
interface xe-0/0/0 { hello-interval 5; }
Display the last committed configuration:
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 Additional Information About the Configuration
In configuration mode only, to display additional information about the device
configuration, use the display detail
command after the pipe ( | )
in conjunction with a show
command. The additional information
includes the help string that explains each configuration statement and the
permission bits required to add and modify the configuration statement.
user@host# show <hierarchy-level> | display detail
For example:
[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;
}
}
...
Display set Commands from the Configuration
In configuration mode, you can display the configuration as a series of configuration mode commands required to re-create the configuration. This is useful if you are not familiar with how to use configuration mode commands or if you want to cut, paste, and edit the displayed configuration.
To display the configuration as a series of configuration mode commands, which are
required to re-create the configuration from the top level of the hierarchy as
set
commands, issue the show
configuration mode
command with the display set
option:
user@host# show | display set <explicit>
When you issue the show configuration
command with the | display
set
pipe option to view the configuration as set
commands,
those portions of the configuration that you do not have permissions to view are
substituted with the text ACCESS-DENIED
.
You can use the <explicit>
option with the | display
set
command, to explicitly display all the configuration statements that
the system internally creates, as a series of set commands, when you configure certain
statements from the top level of the hierarchy.
For example, assume you issue the set interfaces ge-0/0/0.0 family inet configuration mode command. You then show the resulting configuration with the show interfaces ge-0/0/0 | display set command. The output displays the same set command you entered. If you include the explicit argument, the output also shows the configuration statements needed to create the hierarchy where the family inet statement is specified. Specifically for this example, the output therefore includes the set interfaces ge-0/0/0 unit 0 statement in addition to the set interfaces ge-0/0/0.0 family inet statement.
- Example: Display set Commands from the Configuration
- Example: Display set Commands with the match Option
Example: Display set Commands from the Configuration
Display the set
commands from the configuration at the [edit
interfaces
] hierarchy level:
[edit interfaces xe-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 ge-0/0/0] user@host#show | display set
set 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 | explicit
set 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
To display the configuration as a series of configuration mode commands required to
re-create the configuration from the current hierarchy level, issue the
show
configuration mode command with the show | display
set relative
option. You can use the <explicit>
option to explicitly display, as a series of commands, all the configurations that
the system internally creates when you configure certain statements from the current
hierarchy level.
[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
Example: Display set Commands with the match Option
To display the configuration as set
commands and search for text
matching a regular expression by filtering output, specify the
match
option after the pipe ( | ):
user@host# show | display set | match regular-expression
Display IP addresses associated with an interface:
xe-2/3/0 {
unit 0 {
family inet {
address 192.107.9.106/30;
}
}
}
so-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 so-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