Junos Cli PDF
Junos Cli PDF
Release
13.1
Modified: 2016-06-13
Juniper Networks assumes no responsibility for any inaccuracies in this document. Juniper Networks reserves the right to change, modify,
transfer, or otherwise revise this publication without notice.
®
Junos OS CLI User Guide
13.1
Copyright © 2016, Juniper Networks, Inc.
All rights reserved.
The information in this document is current as of the date on the title page.
Juniper Networks hardware and software products are Year 2000 compliant. Junos OS has no known time-related limitations through the
year 2038. However, the NTP application is known to have some difficulty in the year 2036.
The Juniper Networks product that is the subject of this technical documentation consists of (or is intended for use with) Juniper Networks
software. Use of such software is subject to the terms and conditions of the End User License Agreement (“EULA”) posted at
http://www.juniper.net/support/eula.html. By downloading, installing or using such software, you agree to the terms and conditions of
that EULA.
Part 1 Overview
Chapter 1 CLI Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Introducing the Junos OS Command-Line Interface . . . . . . . . . . . . . . . . . . . . . . . . . 3
Key Features of the CLI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Understanding the Junos OS CLI Modes, Commands, and Statement
Hierarchies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Junos OS CLI Command Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
CLI Command Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Configuration Statement Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Moving Among Hierarchy Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Other Tools to Configure and Monitor Devices Running Junos OS . . . . . . . . . . . . . . 7
Commands and Configuration Statements for Junos-FIPS . . . . . . . . . . . . . . . . . . . 8
Chapter 2 CLI Online Help Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Getting Online Help from the Junos OS Command-Line Interface . . . . . . . . . . . . . 9
Getting Help About Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Getting Help About a String in a Statement or Command . . . . . . . . . . . . . . . 10
Getting Help About Configuration Statements . . . . . . . . . . . . . . . . . . . . . . . . . 11
Getting Help About System Log Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Junos OS CLI Online Help Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Help for Omitted Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Using CLI Command Completion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Using Command Completion in Configuration Mode . . . . . . . . . . . . . . . . . . . . 12
Displaying Tips About CLI Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Part 2 Configuration
Chapter 9 Getting Started with Junos OS Configuration . . . . . . . . . . . . . . . . . . . . . . . . . 61
Entering and Exiting the Junos OS CLI Configuration Mode . . . . . . . . . . . . . . . . . . 61
Displaying the Current Junos OS Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Example: Displaying the Current Junos OS Configuration . . . . . . . . . . . . . . . . . . . 64
Displaying set Commands from the Junos OS Configuration . . . . . . . . . . . . . . . . 65
Example: Displaying set Commands from the Configuration . . . . . . . . . . . . . 66
Example: Displaying Required set Commands at the
Current Hierarchy Level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Example: Displaying set Commands with the match Option . . . . . . . . . . . . . 67
Displaying Users Currently Editing the Configuration . . . . . . . . . . . . . . . . . . . . . . . 67
Displaying Additional Information About the Configuration . . . . . . . . . . . . . . . . . 68
Using the configure exclusive Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Updating the configure private Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Getting Started with the Junos OS Command-Line Interface . . . . . . . . . . . . . . . . 72
Switching Between Junos OS CLI Operational and Configuration Modes . . . . . . . 74
Configuring a User Account on a Device Running Junos OS . . . . . . . . . . . . . . . . . . 76
Chapter 10 Updating the Junos OS Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Adding Junos Configuration Statements and Identifiers . . . . . . . . . . . . . . . . . . . . 79
Deleting a Statement from a Junos Configuration . . . . . . . . . . . . . . . . . . . . . . . . . 81
Example: Deleting a Statement from the Junos Configuration . . . . . . . . . . . . . . . 82
Copying a Junos Statement in the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Example: Copying a Statement in the Junos Configuration . . . . . . . . . . . . . . . . . . 84
Issuing Relative Junos Configuration Mode Commands . . . . . . . . . . . . . . . . . . . . 84
Renaming an Identifier in a Junos Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Example: Renaming an Identifier in a Junos Configuration . . . . . . . . . . . . . . . . . . 85
Inserting a New Identifier in a Junos Configuration . . . . . . . . . . . . . . . . . . . . . . . . . 85
Example: Inserting a New Identifier in a Junos Configuration . . . . . . . . . . . . . . . . 86
Deactivating and Reactivating Statements and Identifiers in a Junos
Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Examples: Deactivating and Reactivating Statements and Identifiers in a Junos
Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Adding Comments in a Junos Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Example: Including Comments in a Junos Configuration . . . . . . . . . . . . . . . . . . . . 91
replace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
rollback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
run . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
save . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
server (Batch Commits) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
show . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
show configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
show | display inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
show | display omit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
show | display set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
show | display set relative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
show groups junos-defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
top . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
traceoptions (Batch Commits) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
unprotect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
when . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
wildcard delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Part 3 Administration
Chapter 21 Routine Monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Checking the Status of a Device Running Junos OS . . . . . . . . . . . . . . . . . . . . . . . 229
Example: Configuring a Routing Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Shortcut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Longer Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Making Changes to a Routing Protocol Configuration . . . . . . . . . . . . . . . . . . 234
Monitoring Who Uses the Junos OS CLI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Viewing Files and Directories on a Device Running Junos OS . . . . . . . . . . . . . . . . 237
Directories on the Router or Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Listing Files and Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Specifying Filenames and URLs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Displaying Junos OS Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Managing Programs and Processes Using Junos OS Operational Mode
Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Showing Software Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Restarting a Junos OS Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Stopping the Junos OS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Rebooting the Junos OS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Using the Junos OS CLI Comment Character # for Operational Mode
Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Example: Using Comments in Junos OS Operational Mode Commands . . . . . . 248
Chapter 22 Managing the CLI Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Controlling the Junos OS CLI Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Setting the Terminal Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Setting the CLI Prompt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Part 4 Troubleshooting
Chapter 26 Troubleshooting Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Returning to the Most Recently Committed Junos Configuration . . . . . . . . . . . . 301
Returning to a Previously Committed Junos OS Configuration . . . . . . . . . . . . . . . 301
Returning to a Configuration Prior to the One Most Recently Committed . . 302
Displaying Previous Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Comparing Configuration Changes with a Prior Version . . . . . . . . . . . . . . . . 303
Part 5 Index
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Part 2 Configuration
Chapter 11 Committing a Junos OS Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Figure 7: Confirm a Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Chapter 12 Loading a Junos OS Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Figure 8: Overriding the Current Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Figure 9: Using the replace Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Figure 10: Using the merge Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Figure 11: Using a Patch File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Figure 12: Using the set Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Chapter 19 CLI Advanced Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Figure 13: Replacement by Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Part 3 Administration
Chapter 21 Routine Monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Figure 14: Restarting a Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Part 1 Overview
Chapter 1 CLI Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Table 3: CLI Configuration Mode Navigation Commands . . . . . . . . . . . . . . . . . . . . . 7
Chapter 3 CLI Operational Mode Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Table 4: Commonly Used Operational Mode Commands . . . . . . . . . . . . . . . . . . . . 17
Table 5: Common Regular Expression Operators in Operational Mode
Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Chapter 4 CLI Configuration Mode Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Table 6: Summary of Configuration Mode Commands . . . . . . . . . . . . . . . . . . . . . 34
Table 7: Configuration Mode Top-Level Statements . . . . . . . . . . . . . . . . . . . . . . . 36
Table 8: Forms of the configure Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Table 9: CLI Configuration Input Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Chapter 5 CLI Advanced Features Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Table 10: CLI Keyboard Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Table 11: Wildcard Characters for Specifying Interface Names . . . . . . . . . . . . . . . 49
Part 3 Administration
Chapter 21 Routine Monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Table 12: Directories on the Router . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Table 13: show system process extensive Command Output Fields . . . . . . . . . . 245
Chapter 22 Managing the CLI Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Table 14: Commonly Used Operational Mode Commands . . . . . . . . . . . . . . . . . 255
Chapter 23 CLI Advanced Features Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
Table 15: Common Regular Expressions to Use with the replace Command . . . 259
Table 16: Replacement Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
If the information in the latest release notes differs from the information in the
documentation, follow the product Release Notes.
Juniper Networks Books publishes books by Juniper Networks engineers and subject
matter experts. These books go beyond the technical documentation to explore the
nuances of network architecture, deployment, and administration. The current list can
be viewed at http://www.juniper.net/books.
Supported Platforms
For the features described in this document, the following platforms are supported:
• ACX Series
• M Series
• MX Series
• T Series
• J Series
• PTX Series
If you want to use the examples in this manual, you can use the load merge or the load
merge relative command. These commands cause the software to merge the incoming
configuration into the current candidate configuration. The example does not become
active until you commit the candidate configuration.
If the example configuration contains the top level of the hierarchy (or multiple
hierarchies), the example is a full example. In this case, use the load merge command.
If the example configuration does not start at the top level of the hierarchy, the example
is a snippet. In this case, use the load merge relative command. These procedures are
described in the following sections.
1. From the HTML or PDF version of the manual, copy a configuration example into a
text file, save the file with a name, and copy the file to a directory on your routing
platform.
For example, copy the following configuration to a file and name the file ex-script.conf.
Copy the ex-script.conf file to the /var/tmp directory on your routing platform.
system {
scripts {
commit {
file ex-script.xsl;
}
}
}
interfaces {
fxp0 {
disable;
unit 0 {
family inet {
address 10.0.0.1/24;
}
}
}
}
2. Merge the contents of the file into your routing platform configuration by issuing the
load merge configuration mode command:
[edit]
user@host# load merge /var/tmp/ex-script.conf
load complete
Merging a Snippet
To merge a snippet, follow these steps:
1. From the HTML or PDF version of the manual, copy a configuration snippet into a text
file, save the file with a name, and copy the file to a directory on your routing platform.
For example, copy the following snippet to a file and name the file
ex-script-snippet.conf. Copy the ex-script-snippet.conf file to the /var/tmp directory
on your routing platform.
commit {
file ex-script-snippet.xsl; }
2. Move to the hierarchy level that is relevant for this snippet by issuing the following
configuration mode command:
[edit]
user@host# edit system scripts
[edit system scripts]
3. Merge the contents of the file into your routing platform configuration by issuing the
load merge relative configuration mode command:
For more information about the load command, see the CLI User Guide.
Documentation Conventions
Caution Indicates a situation that might result in loss of data or hardware damage.
Laser warning Alerts you to the risk of personal injury from a laser.
Table 2 on page xviii defines the text and syntax conventions used in this guide.
Bold text like this Represents text that you type. To enter configuration mode, type the
configure command:
user@host> configure
Fixed-width text like this Represents output that appears on the user@host> show chassis alarms
terminal screen.
No alarms currently active
Italic text like this • Introduces or emphasizes important • A policy term is a named structure
new terms. that defines match conditions and
• Identifies guide names. actions.
• Junos OS CLI User Guide
• Identifies RFC and Internet draft titles.
• RFC 1997, BGP Communities Attribute
Italic text like this Represents variables (options for which Configure the machine’s domain name:
you substitute a value) in commands or
configuration statements. [edit]
root@# set system domain-name
domain-name
Text like this Represents names of configuration • To configure a stub area, include the
statements, commands, files, and stub statement at the [edit protocols
directories; configuration hierarchy levels; ospf area area-id] hierarchy level.
or labels on routing platform • The console port is labeled CONSOLE.
components.
< > (angle brackets) Encloses optional keywords or variables. stub <default-metric metric>;
# (pound sign) Indicates a comment specified on the rsvp { # Required for dynamic MPLS only
same line as the configuration statement
to which it applies.
[ ] (square brackets) Encloses a variable for which you can community name members [
substitute one or more values. community-ids ]
GUI Conventions
Bold text like this Represents graphical user interface (GUI) • In the Logical Interfaces box, select
items you click or select. All Interfaces.
• To cancel the configuration, click
Cancel.
> (bold right angle bracket) Separates levels in a hierarchy of menu In the configuration editor hierarchy,
selections. select Protocols>Ospf.
Documentation Feedback
• Online feedback rating system—On any page of the Juniper Networks TechLibrary site
at http://www.juniper.net/techpubs/index.html, simply click the stars to rate the content,
and use the pop-up form to provide us with information about your experience.
Alternately, you can use the online feedback form at
http://www.juniper.net/techpubs/feedback/.
Technical product support is available through the Juniper Networks Technical Assistance
Center (JTAC). If you are a customer with an active J-Care or Partner Support Service
support contract, or are covered under warranty, and need post-sales technical support,
you can access our tools and resources online or open a case with JTAC.
• JTAC hours of operation—The JTAC centers have resources available 24 hours a day,
7 days a week, 365 days a year.
• Find solutions and answer questions using our Knowledge Base: http://kb.juniper.net/
To verify service entitlement by product serial number, use our Serial Number Entitlement
(SNE) Tool: https://tools.juniper.net/SerialNumberEntitlementSearch/
Overview
• CLI Overview on page 3
• CLI Online Help Overview on page 9
• CLI Operational Mode Overview on page 15
• CLI Configuration Mode Overview on page 33
• CLI Advanced Features Overview on page 47
• CLI Commit Operations Overview on page 51
• Configuration Groups Overview on page 55
• Configuration Management Overview on page 57
CLI Overview
The Junos OS CLI is a Juniper Networks-specific command shell that runs on top of a
FreeBSD UNIX-based operating system kernel. By leveraging industry-standard tools
and utilities, the CLI provides a powerful set of commands that you can use to monitor
and configure devices running Junos OS (see Figure 1 on page 3). The CLI is a
straightforward command interface. You type commands on a single line, and the
commands are executed when you press Enter.
• Consistent command names—Commands that provide the same type of function have
the same name, regardless of the portion of the software on which they are operating.
For example, all show commands display software information and statistics, and all
clear commands erase various types of system information.
If you have typed the mandatory arguments for executing a command in the operational
or configuration mode the CLI displays <[Enter]> as one of the choices when you type
a question mark (?). This indicates that you have entered the mandatory arguments
and can execute the command at that level without specifying any further options.
Likewise, the CLI also displays <[Enter]> when you have reached a specific hierarchy
level in the configuration mode and do not have to enter any more mandatory
arguments or statements.
• Use regular expression matching to locate and replace values and identifiers in a
configuration, filter command output, or examine log file entries.
• Use Emacs-based key sequences to move around on a command line and scroll
through the recently executed commands and command output.
• Exit from the CLI environment and create a UNIX C shell or Bourne shell to navigate
the file system, manage router processes, and so on.
Related • Understanding the Junos OS CLI Modes, Commands, and Statement Hierarchies on
Documentation page 5
The Junos OS command-line interface (CLI) commands and statements are organized
under two command modes and various hierarchies. The following sections provide you
an overview of the Junos OS CLI command modes and commands and statements
hierarchies:
• Operational mode—This mode displays the current status of the device. In operational
mode, you enter commands to monitor and troubleshoot the Junos OS, devices, and
network connectivity.
When you enter configuration mode, you are actually viewing and changing a file called
the candidate configuration. The candidate configuration file enables you to make
configuration changes without causing operational changes to the current operating
configuration, called the active configuration. The router or switch does not implement
the changes you added to the candidate configuration file until you commit them, which
activates the configuration on the router or switch (see Figure 2 on page 5). Candidate
configurations enable you to alter your configuration without causing potential damage
to your current network operations.
To execute a command, you enter the full command name, starting at the top level of
the hierarchy. For example, to display a brief view of the routes in the routing table, use
the command show route brief.
Figure 3 on page 6 illustrates a part of the hierarchy tree. The protocols statement is a
top-level statement at the trunk of the configuration tree. The ospf, area, and interface
statements are all subordinate container statements of a higher statement (they are
branches of the hierarchy tree), and the hello-interval statement is a leaf on the tree.
exit Moves up the hierarchy to the previous level where you were working. This
command is, in effect, the opposite of the edit command. Alternatively, you
can use the quit command. The exit and quit commands are interchangeable.
Apart from the command-line interface, Junos OS also supports the following applications,
scripts, and utilities that enable you to configure and monitor devices running Junos OS:
• Junos XML management protocol—Application programmers can use the Junos XML
management protocol to monitor and configure Juniper Networks routers. Juniper
Networks provides a Perl module with the API to help you more quickly and easily
develop custom Perl scripts for configuring and monitoring routers. For more
information, see the Junos XML Management Protocol Developer Guide.
• Junos OS commit scripts and self-diagnosis features—You can define scripts to enforce
custom configuration rules, use commit script macros to provide simplified aliases for
frequently used configuration statements, and configure diagnostic event policies and
actions associated with each policy. For more information, see the Junos OS
Configuration and Operations Automation Guide.
Related • Junos Secure Configuration Guide for Common Criteria and Junos-FIPS
Documentation
• IPsec Requirements for Junos-FIPS
The Junos OS command-line interface (CLI) has a context-sensitive online help feature
that enables you to access information about commands and statements from the Junos
OS CLI. This topic contains the following sections:
• If you type the question mark at the command-line prompt, the CLI lists the available
commands and options. For example, to view a list of top-level operational mode
commands, type a question mark (?) at the command-line prompt.
user@host> ?
Possible completions:
clear Clear information in the system
configure Manipulate software configuration information
file Perform file operations
help Provide help information
mtrace Trace mtrace packets from source to receiver.
monitor Real-time debugging
ping Ping a remote target
quit Exit the management session
request Make system-level requests
restart Restart a software process
set Set CLI properties, date, time, craft display text
show Show information about the system
ssh Open a secure shell to another host
start Start a software process
telnet Telnet to another host
test Diagnostic debugging commands
• If you type the question mark after entering the complete name of a command or
command option, the CLI lists the available commands and options and then redisplays
the command names and options that you typed.
user@host> clear ?
Possible completions:
arp Clear address-resolution information
bgp Clear BGP information
chassis Clear chassis information
firewall Clear firewall counters
igmp Clear IGMP information
interfaces Clear interface information
ilmi Clear ILMI statistics information
isis Clear IS-IS information
ldp Clear LDP information
log Clear contents of a log file
mpls Clear MPLS information
msdp Clear MSDP information
multicast Clear Multicast information
ospf Clear OSPF information
pim Clear PIM information
rip Clear RIP information
route Clear routing table information
rsvp Clear RSVP information
snmp Clear SNMP information
system Clear system status
vrrp Clear VRRP statistics information
user@host> clear
• If you type the question mark in the middle of a command name, the CLI lists possible
command completions that match the letters you have entered so far. It then redisplays
the letters that you typed. For example, to list all operational mode commands that
start with the letter c, type the following:
user@host> c?
Possible completions:
clear Clear information in the system
configure Manipulate software configuration information
user@host> c
• For introductory information on using the question mark or the help command, you
can also type help and press Enter:
user@host> help
string is a text string about which you want to get help. This string is used to match
statement or command names as well as to match the help strings that are displayed
for the statements or commands.
If the string contains spaces, enclose it in quotation marks (" " ). You can also specify a
regular expression for the string, using standard UNIX-style regular expression syntax.
In configuration mode, this command displays statement names and help text that match
the string specified. In operational mode, this command displays command names and
help text that match the string specified.
The help topic command displays usage guidelines for the statement based on information
that appears in the Junos OS configuration guides. The help reference command displays
summary information about the statement based on the summary descriptions that
appear in the Junos OS configuration guides.
The help syslog command displays the contents of a system log message.
The Junos OS CLI online help provides the following features for ease of use and error
prevention:
protocols {
pim {
interface so-0/0/0 {
priority 4;
version 2;
# Warning: missing mandatory statement(s): 'mode'
}
}
}
• To display all possible command or option completions, type the partial command
followed immediately by a question mark.
• To complete a command or option that you have partially typed, press Tab or the
Spacebar. If the partially typed letters begin a string that uniquely identifies a command,
the complete command name appears. Otherwise, a prompt indicates that you have
entered an ambiguous command, and the possible completions are displayed.
Command completion also applies to other strings, such as filenames, interface names,
and usernames. To display all possible values, type a partial string followed immediately
by a question mark. To complete a string, press Tab.
Command completion also applies to identifiers, with one slight difference. To display
all possible identifiers, type a partial string followed immediately by a question mark. To
complete an identifier, you must press Tab. This scheme allows you to enter identifiers
with similar names; then press the Spacebar when you are done typing the identifier
name.
You can also enter help tip cli number to associate a tip with a number. This enables you
to recall the tip at a later time. For example:
user@host>
This topic provides an overview of Junos OS CLI operational mode commands and
contains the following sections:
• Commands for controlling the CLI environment—Some set commands in the set
hierarchy configure the CLI display screen. For information about these commands,
see “Understanding the Junos OS CLI Modes, Commands, and Statement Hierarchies”
on page 5.
• test—Test the configuration and application of policy filters and autonomous system
(AS) path regular expressions.
• Commands for connecting to other network systems—The ssh command opens Secure
Shell connections, and the telnet command opens telnet sessions to other hosts on
the network. For information about these commands, see the CLI Explorer.
• Commands for copying files—The copy command copies files from one location on
the router or switch to another, from the router or switch to a remote system, or from
a remote system to the router or switch. For information about these commands, see
the CLI Explorer.
• A command—start—to exit the CLI and start a UNIX shell. For information about this
command, see the CLI Explorer.
• A command—quit—to exit the CLI. For information about this command, see the CLI
Explorer.
• For more information about the CLI operational mode commands, see the CLI Explorer
and the CLI Explorer.
NOTE: The QFX3500 switch does not support the IS-IS, OSPF, BGP, MPLS,
and RSVP protocols.
Software version Versions of software running on the router or switch show version
Log files and their contents and recent user logins show log
Manipulate files List of files and directories on the router or switch file list
Routing table information Information about entries in the routing tables show route
Forwarding table Information about data in the kernel’s forwarding table show route forwarding-table
information
OSPF Display standard information about OSPF neighbors show ospf neighbor
Configured LSPs on the router or switch, as well as all ingress, show mpls lsp
transit, and egress LSPs
Related • Junos OS Operational Mode Commands That Combine Other Commands on page 18
Documentation
• Understanding the Brief, Detail, Extensive, and Terse Options of Junos OS Operational
Commands on page 19
In some cases, some Junos OS operational commands are created from a combination
of other operational commands. These commands can be useful shortcuts for collecting
information about the device, as shown in Figure 4 on page 18.
Understanding the Brief, Detail, Extensive, and Terse Options of Junos OS Operational
Commands
The Junos OS operational mode commands can include brief, detail, extensive, or terse
options. You can use these options to control the amount of information you want to
view.
1. Use the ? prompt to list options available for the command. For example:
2. Choose the option you wish to use with the command. (See Figure 5 on page 19.)
The Junos OS CLI operational commands include options that you can use to identify
specific components on a device running Junos OS. For example:
1. Type the show interfaces command to display information about all interfaces on the
router.
---(more)---
user@host>
• all-lcc—All T640 routers (in a routing matrix based on a TX Matrix router) or all T1600
routers or T4000 routers (in a routing matrix based on a TX Matrix Plus router).
If you specify none of these options, then the command applies by default to the whole
routing matrix.
Related • Interface Naming Conventions Used in the Junos OS Operational Commands on page 165
Documentation
• Using the Junos OS CLI Comment Character # for Operational Mode Commands on
page 248
The Junos OS enables you to filter command output by adding the pipe ( | ) symbol when
you enter a command.
For example:
The following example lists the filters that can be used with the pipe symbol ( | ):
For the show configuration command only, an additional compare filter is available:
You can enter any of the pipe filters in conjunction. For example:
NOTE: This topic describes only the filters that can be used for operational
mode command output. For information about filters that can be used in
configuration mode, see the Junos OS System Basics Configuration Guide.
Using Regular Expressions with the Pipe ( | ) Symbol to Filter Junos Command Output
The except, find, and match filters used with the pipe symbol employ regular expressions
to filter output. Juniper Networks uses the regular expressions as defined in POSIX 1003.2.
If the regular expressions contain spaces, operators, or wildcard characters, enclose the
expression in quotation marks.
| Indicates that a match can be one of the two terms on either side of
the pipe.
12
22
321
4
12
22
321
22
4
Related • Using the Pipe ( | ) Symbol to Filter Junos Command Output on page 23
Documentation
• Pipe ( | ) Filter Functions in the Junos OS command-line interface on page 25
This topic describes the pipe ( | ) filter functions that are supported in the Junos OS
command-line interface (CLI):
Comparing Configurations
The compare filter compares the candidate configuration with either the current
committed configuration or a configuration file and displays the differences between
the two configurations. To compare configurations, enter compare after the pipe ( | )
symbol:
[edit]
user@host# show | compare [filename| rollback n]
n is the index into the list of previously committed configurations. The most recently
saved configuration is 0. If you do not specify arguments, the candidate configuration is
compared against the active configuration file (/config/juniper.conf).
• Statements that are only in the candidate configuration are prefixed with a plus sign
(+).
• Statements that are only in the comparison file are prefixed with a minus sign (–).
• Statements that are unchanged are prefixed with a single blank space ( ).
For example:
[edit system]
+ host-name nutmeg;
+ backup-router 192.168.71.254;
- ports {
- console log-out-on-disconnect;
- }
[edit system name-server]
+ 172.17.28.11;
172.17.28.101 { ... }
[edit system name-server]
172.17.28.101 { ... }
+ 172.17.28.100;
+ 172.17.28.10;
[edit system]
- scripts {
- commit {
- allow-transients;
- }
- }
+ services {
+ ftp;
+ rlogin;
+ rsh;
+ telnet;
+ }
Starting with Junos OS Release 8.3, output from the show | compare command has been
enhanced to more accurately reflect configuration changes. This includes more intelligent
handling of order changes in lists. For example, consider names in a group that are
reordered as follows:
groups { groups {
group_xmp; group_xmp;
group_cmp; group_grp:
group_grp; group_cmp;
} }
In previous releases, output from the show | compare command looked like the following:
[edit groups]
- group_xmp;
- group_cmp;
- group_grp;
+ group_xmp;
+ group_grp;
+ group_cmp;
Now, output from the show | compare command looks like the following:
[edit groups]
group_xmp {...}
! group_grp {...}
The following example displays the show cli directory command output as XML tags:
The following example displays the RPC tags for the show route command:
The following example displays all users who are logged in to the router, except for the
user root:
common regular expression operators, see “Using Regular Expressions with the Pipe ( |
) Symbol to Filter Junos Command Output” on page 24.
The following example displays the routes in the routing table starting at IP address
208.197.169.0:
The following example displays the first CCC entry in the forwarding table:
This filter is useful when you want to scroll or search through output.
This filter is useful for viewing log files in which the end of the file contains the most recent
entries.
NOTE: When the number of lines requested is less than the number of lines
that the screen length setting permits you to display, Junos returns as many
lines as permitted by the screen length setting. That is, if your screen length
is set to 20 lines and you have requested only the last 10 lines, Junos returns
the last 19 lines instead of the last 10 lines.
The following example matches all the Asynchronous Transfer Mode (ATM) interfaces
in the configuration:
To prevent the output from being paginated, enter no-more after the pipe symbol ( | ).
The following example displays output from the show configuration command all at once:
This feature is useful, for example, if you want to copy the entire output and paste it into
an e-mail.
If you are troubleshooting your router and, for example, talking with a customer service
representative on the phone, you can use the request message command to send your
representative the command output you are currently viewing on your terminal.
The following example sends the output from the show interfaces command you enter
on your terminal to the terminal of the user root@ttyp1:
The user root@ttyp1 sees the following output appear on the terminal screen:
Resolving IP Addresses
In operational mode only, if the output of a command displays an unresolved IP address,
you can enter | resolve after the command to display the name associated with the IP
address. The resolve filter enables the system to perform a reverse DNS lookup of the IP
address. If DNS is not enabled, the lookup fails and no substitution is performed.
The following example performs a DNS lookup on any unresolved IP addresses in the
output from the show ospf neighbors command:
To save command output to a file, enter save filename after the pipe symbol ( | ).
The following example saves the output from the request support information command
to a file named my-support-info.txt:
The following example displays output from the show system storage command, filtering
out the first 10 columns:
Related • Using Regular Expressions with the Pipe ( | ) Symbol to Filter Junos Command Output
Documentation on page 24
You can configure all properties of Junos OS, including interfaces, general routing
information, routing protocols, and user access, as well as several system hardware
properties.
You can create the hierarchy interactively or you can create an ASCII text file that is
loaded onto the router or switch and then committed.
activate Remove the inactive: tag from a statement, effectively reading the
statement or identifier to the configuration. Statements or identifiers
that have been activated take effect when you next issue the commit
command.
commit Commit the set of changes to the database and cause the changes
to take operational effect.
edit Move inside the specified statement hierarchy. If the statement does
not exist, it is created.
exit Exit the current level of the statement hierarchy, returning to the
level prior to the last edit command, or exit from configuration mode.
The quit and exit commands are synonyms.
quit Exit the current level of the statement hierarchy, returning to the
level prior to the last edit command, or exit from configuration mode.
The quit and exit commands are synonyms.
save Save the configuration to an ASCII file. The contents of the current
level of the statement hierarchy (and below) are saved, along with
the statement hierarchy containing it. This allows a section of the
configuration to be saved, while fully specifying the statement
hierarchy.
set Create a statement hierarchy and set identifier values. This is similar
to edit except that your current level in the hierarchy does not
change.
the name of an interface or a username, which enables you and the CLI to differentiate
among a collection of statements.
NOTE: The QFX3500 switch does not support the IS-IS, OSPF, BGP, LDP,
MPLS, and RSVP protocols.
accounting-options Configure accounting statistics data collection for interfaces and firewall
filters. For information about the statements in this hierarchy, see the Network
Management Configuration Guide.
chassis Configure properties of the router chassis, including conditions that activate
alarms and SONET/SDH framing and concatenation properties. For
information about the statements in this hierarchy, see the Junos OS System
Basics Configuration Guide.
firewall Define filters that select packets based on their contents. For information
about the statements in this hierarchy, see the Routing Policy Configuration
Guide.
forwarding-options Define forwarding options, including traffic sampling options. For information
about the statements in this hierarchy, see the Junos® OS Network Interfaces.
policy-options Define routing policies, which allow you to filter and set properties in incoming
and outgoing routes. For information about the statements in this hierarchy,
see the Routing Policy Configuration Guide.
protocols Configure routing protocols, including BGP, IS-IS, LDP, MPLS, OSPF, RIP, and
RSVP. For information about the statements in this hierarchy, see the chapters
that discuss how to configure the individual routing protocols in the Junos OS
Routing Protocols Configuration Guide and the Junos OS MPLS Applications
Configuration Guide.
routing-instances Configure multiple routing instances. For information about the statements
in this hierarchy, see the Junos OS Routing Protocols Configuration Guide.
security Configure IP Security (IPsec) services. For information about the statements
in this hierarchy see the Junos OS System Basics Configuration Guide.
snmp Configure SNMP community strings, interfaces, traps, and notifications. For
information about the statements in this hierarchy, see the Network
Management Configuration Guide.
Each statement at the top level of the configuration hierarchy resides at the trunk (or
root level) of a hierarchy tree. The top-level statements are container statements,
containing other statements that form the tree branches. The leaf statements are the
leaves of the hierarchy tree. An individual hierarchy of statements, which starts at the
trunk of the hierarchy tree, is called a statement path. Figure 6 on page 37 illustrates the
hierarchy tree, showing a statement path for the portion of the protocol configuration
hierarchy that configures the hello interval on an interface in an OSPF area.
The protocols statement is a top-level statement at the trunk of the configuration tree.
The ospf, area, and interface statements are all subordinate container statements of a
higher statement (they are branches of the hierarchy tree); and the hello-interval
statement is a leaf on the tree which in this case contains a data value: the length of the
hello interval, in seconds.
protocols {
ospf {
area 0.0.0.0 {
interface so-0/0/0 {
hello-interval 5;
}
interface so-0/0/1 {
hello-interval 5;
}
}
}
}
The CLI indents each level in the hierarchy to indicate each statement’s relative position
in the hierarchy and generally sets off each level with braces, using an open brace at the
beginning of each hierarchy level and a closing brace at the end. If the statement at a
hierarchy level is empty, the braces are not printed.
Each leaf statement ends with a semicolon. If the hierarchy does not extend as far as a
leaf statement, the last statement in the hierarchy ends with a semicolon.
The configuration hierarchy can also contain “oneliners” at the last level in the hierarchy.
Oneliners remove one level of braces in the syntax and display the container statement,
its identifiers, the child or leaf statement and its attributes all on one line. For example,
in the following sample configuration hierarchy, the line level 1 metric 10 is a oneliner
because the level container statement with identifier 1, its child statement metric, and
its corresponding attribute 10 all appear on a single line in the hierarchy:
[edit protocols]
isis {
interface ge-0/0/0.0 {
level 1 metric 10;
}
}
}
[edit forwarding-options]
user@host# show
dhcp-relay {
dynamic-profile dynamic-profile-name aggregate-clients;
}
Related • Entering and Exiting the Junos OS CLI Configuration Mode on page 61
Documentation
• edit—Moves to a particular hierarchy level. If that hierarchy level does not exist, the
edit command creates it. The edit command has the following syntax:
edit <statement-path>
• set—Creates a configuration statement and sets identifier values. After you issue a set
command, you remain at the same level in the hierarchy. The set command has the
following syntax:
statement-path is the hierarchy to the configuration statement and the statement itself.
If you have already moved to the statement’s hierarchy level, you can omit the
statement path. statement is the configuration statement itself. identifier is a string
that identifies an instance of a statement.
You cannot use the edit command to change the value of identifiers. You must use the
set command.
Up to 32 users can be in configuration mode simultaneously, and they all can be making
changes to the configuration. All changes made by all users are visible to everyone editing
the configuration—the changes become visible as soon as the user presses the Enter key
at the end of a command that changes the configuration, such as set, edit, or delete.
When any of the users editing the configuration issues a commit command, all changes
made by all users are checked and activated.
If you enter configuration mode with the configure private command, each user has a
private candidate configuration to edit somewhat independently of other users. When
you commit the configuration, only your own changes get committed. To synchronize
your copy of the configuration after other users have committed changes, you can run
the update command in configuration mode. A commit operation also updates all of the
private candidate configurations. For example, suppose user X and user Y are both in
configure private mode, and user X commits a configuration change. When user Y performs
a subsequent commit operation and then views the new configuration, the new
configuration seen by user Y includes the changes made by user X.
If you enter configuration mode with the configure exclusive command, you lock the
candidate configuration for as long as you remain in configuration mode, allowing you
to make changes without interference from other users. Other users can enter and exit
configuration mode, but they cannot commit the configuration. This is true even if the
other users entered configuration mode before you enter the configure exclusive command.
For example, suppose user X is already in the configure private or configure mode. Then
suppose user Y enters the configure exclusive mode. User X cannot commit any changes
to the configuration, even if those changes were entered before user Y logged in. If user
Y exits configure exclusive mode, user X can then commit the changes made in configure
private or configure mode.
The Junos OS supports three forms of the configure command: configure, configure
private, and configure exclusive. These forms control how users edit and commit
configurations and can be useful when multiple users configure the software. See
Table 8 on page 41.
configure • No one can lock the • No one can lock the configuration. All users
configuration. All users can commit all changes to the
can make configuration configuration.
changes. • If you and another user make changes and
When you enter the other user commits changes, your
configuration mode, the changes are committed as well.
CLI displays the
following information:
• A list of other users
editing the
configuration.
• Hierarchy levels the
users are viewing or
editing.
• Whether the
configuration has
been changed, but
not committed.
• When multiple users
enter conflicting
configurations, the
most recent change
to be entered takes
precedence.
configure exclusive • One user locks the configuration and makes changes without interference
from other users.
• Other users can enter and exit configuration mode, but they cannot
commit the configuration.
• If you enter configuration mode while another user has locked the
configuration (with the configure exclusive command), the CLI displays
the user and the hierarchy level the user is viewing or editing.
• If you enter configuration mode while another user has locked the
configuration, you can forcibly log out that user with the request system
logout operational mode command. For details, see the CLI Explorer.
configure private • Multiple users can edit • When you commit the configuration, the
the configuration at the router verifies that the operational
same time. (running) configuration has not been
• Each user has a private modified by another user before accepting
candidate configuration your private candidate configuration as the
to edit independently of new operational configuration.
other users. • If the configuration has been modified by
• When multiple users another user, you can merge the
enter conflicting modifications into your private candidate
configurations, the first configuration and attempt to commit
commit operation takes again.
precedence over
subsequent commit
operations.
This topic provides more detailed information about CLI container and leaf statements
so that you can better understand how you must specify them when creating ASCII
configuration files. It also describes how the CLI performs type checking to verify that
the data you entered is in the correct format.
Specifying Statements
Statements are shown one of two ways, either with braces or without:
• Statement name and identifier, with one or more lower level statements enclosed in
braces:
statement-name1 identifier-name {
statement-name2;
additional-statements;
}
When specifying a statement, you must specify either a statement name or an identifier
name, or both, depending on the statement hierarchy.
The following examples illustrate how statements and identifiers are specified in the
configuration:
protocol { # Top-level statement (statement-name).
ospf { # Statement under "protocol" (statement-name).
area 0.0.0.0 { # OSPF area "0.0.0.0" (statement-name identifier-name),
interface so-0/0/0 { # which contains an interface named "so-0/0/0."
hello-interval 25; # Identifier and value (identifier-name value).
priority 2; # Identifier and value (identifier-name value).
disable; # Flag identifier (identifier-name).
}
interface so-0/0/1; # Another instance of "interface," named so-0/0/1,
} # this instance contains no data, so no braces
} # are displayed.
}
policy-options { # Top-level statement (statement-name).
term term1 { # Statement under "policy-options"
# (statement-name value).
from { # Statement under "term" (statement-name).
route-filter 10.0.0.0/8 orlonger reject; # One identifier ("route-filter")
with
route-filter 127.0.0.0/8 orlonger reject; # multiple values.
route-filter 128.0.0.0/16 orlonger reject;
route-filter 149.20.64.0/24 orlonger reject;
route-filter 172.16.0.0/12 orlonger reject;
route-filter 191.255.0.0/16 orlonger reject;
}
then { # Statement under "term" (statement-name).
next term; # Identifier (identifier-name).
}
}
}
When you create an ASCII configuration file, you can specify statements and identifiers
in one of the following ways. However, each statement has a preferred style, and the CLI
uses that style when displaying the configuration in response to a configuration mode
show command.
statement-name {
identifier-name;
[...]
identifier-name value;
[...]
}
• For some repeating identifiers, you can use one set of braces for all the statements:
statement-name {
identifier-name value1;
identifier-name value2;
Incorrect: so-0/0/1
Sample translations:
OSPF area identifier 0xhex-bytesoctet<.octet<.octet.< octet Correct: 54, 0.0.0.54, 0x01020304, 1.2.3.4
(ID) >>> decimal-number
Sample translations:
54 becomes 0.0.0.54
Related • Entering and Exiting the Junos OS CLI Configuration Mode on page 61
Documentation
• Using Keyboard Sequences to Move Around and Edit the Junos OS CLI on page 47
• Using Wildcard Characters in Interface Names on page 49
• Using Global Replace in a Junos Configuration on page 49
Using Keyboard Sequences to Move Around and Edit the Junos OS CLI
You can use keyboard sequences in the Junos OS command-line interface (CLI) to move
around and edit the command line. You can also use keyboard sequences to scroll through
a list of recently executed commands. Table 10 on page 47 lists some of the CLI keyboard
sequences. They are the same as those used in Emacs.
You can use wildcard characters in the Junos OS operational commands to specify groups
of interface names without having to type each name individually. Table 11 on page 49
lists the available wildcard characters. You must enclose all wildcard characters except
the asterisk (*) in quotation marks (“ ”).
"[!character1-character2]" Match all characters that are not in the specified range
of characters. For example, so-”[!0-3]”* matches all
SONET/SDH interfaces in slots 4, 5, 6, and 7.
Related • Using Keyboard Sequences to Move Around and Edit the Junos OS CLI on page 47
Documentation
• Using Global Replace in a Junos Configuration on page 49
You can make global changes to variables and identifiers in a Junos configuration by
using the replace configuration mode command. This command replaces a pattern in a
configuration with another pattern. For example, you can use this command to find and
replace all occurrences of an interface name when a PIC is moved to another slot in the
router.
pattern pattern1 is a text string or regular expression that defines the identifiers and values
you want to replace in the configuration.
pattern2 is a text string or regular expression that replaces the identifiers and values
located with pattern1.
Juniper Networks uses standard UNIX-style regular expression syntax (as defined in
POSIX 1003.2). If the regular expression contains spaces, operators, or wildcard characters,
enclose the expression in quotation marks. Greedy qualifiers (match as much as possible)
are supported. Lazy qualifiers (match as little as possible) are not.
The upto n option specifies the number of objects replaced. The value of n controls the
total number of objects that are replaced in the configuration (not the total number of
times the pattern occurs). Objects at the same hierarchy level (siblings) are replaced
first. Multiple occurrences of a pattern within a given object are considered a single
replacement. For example, if a configuration contains a 010101 text string, the command
replace pattern 01 with pattern 02 upto 2 replaces 010101 with 020202 (instead of 020201).
Replacement of 010101 with 020202 is considered a single replacement (n = 1), not three
separate replacements (n =3).
If you do not specify an upto option, all identifiers and values in the configuration that
match pattern1 are replaced.
The replace command is available in configuration mode at any hierarchy level. All
matches are case-sensitive.
Related • Common Regular Expressions to Use with the replace Command on page 259
Documentation
• Example: Using Global Replace in a Junos Configuration—Using the \n Back Reference
on page 171
• Using Keyboard Sequences to Move Around and Edit the Junos OS CLI on page 47
The router or switch configuration is saved using a commit model: that is, a candidate
configuration is modified as desired and then committed to the system. Once a
configuration has been committed, the router or switch checks the configuration for
syntax errors, and if no errors are found, the configuration is saved as juniper.conf.gz and
activated. The former active configuration file is saved as the first rollback configuration
file (juniper.conf.1.gz), and all other rollback configuration files are incremented by 1. For
example, juniper.conf.1.gz is incremented to juniper.conf.2.gz, making it the second rollback
configuration file. The router or switch can have a maximum of 49 rollback configurations
(1–49) saved on the system.
On the router or switch, the active configuration file and the first three rollback files
(juniper.conf.gz.1, juniper.conf.gz.2, juniper.conf.gz.3 ) are located in the /config directory.
If the file rescue.conf.gz is saved on the system, this file should also be saved in the /config
directory. The factory default files are located in the /etc/config directory.
There are two mechanisms used to propagate the configurations between Routing
Engines within a router or switch:
To synchronize configurations, use the commit synchronize CLI command. If one of the
Routing Engines is locked, the synchronization fails. If synchronization fails because of
a locked configuration file, you can use the commit synchronize force command. This
command overrides the lock and synchronizes the configuration files.
NOTE: When you use the commit synchronize force CLI command on a
multichassis platform, the forced synchronization of the configuration files
does not affect the distribution of the configuration file across the routing
plane. If a configuration file is locked on a router or switch remote from the
router or switch where the command was issued, the synchronization fails
on the remote router or switch. You need to clear the lock and reissue the
synchronization command.
Related • Configuring Junos OS for the First Time on a Router or Switch with a Single Routing Engine
Documentation
Up to 32 users can be in configuration mode simultaneously, and they all can be making
changes to the configuration. All changes made by all users are visible to everyone editing
the configuration—the changes become visible as soon as the user presses the Enter key
at the end of a command that changes the configuration, such as set, edit, or delete.
When any of the users editing the configuration issues a commit command, all changes
made by all users are checked and activated.
If you enter configuration mode with the configure private command, each user has a
private candidate configuration to edit somewhat independently of other users. When
you commit the configuration, only your own changes get committed. To synchronize
your copy of the configuration after other users have committed changes, you can run
the update command in configuration mode. A commit operation also updates all of the
private candidate configurations. For example, suppose user X and user Y are both in
configure private mode, and user X commits a configuration change. When user Y performs
a subsequent commit operation and then views the new configuration, the new
configuration seen by user Y includes the changes made by user X.
If you enter configuration mode with the configure exclusive command, you lock the
candidate configuration for as long as you remain in configuration mode, allowing you
to make changes without interference from other users. Other users can enter and exit
configuration mode, but they cannot commit the configuration. This is true even if the
other users entered configuration mode before you enter the configure exclusive command.
For example, suppose user X is already in the configure private or configure mode. Then
suppose user Y enters the configure exclusive mode. User X cannot commit any changes
to the configuration, even if those changes were entered before user Y logged in. If user
Y exits configure exclusive mode, user X can then commit the changes made in configure
private or configure mode.
Batches are prioritized by the commit server based on priority of the batch specified by
the user or the time when the batch job is added. When one batch commit is complete,
the next set of configuration changes are aggregated and loaded into the batch queue
for the next session of the batch commit operation. Batches are created until there are
no commit entries left in the queue directory.
When compared to the regular commit operation where all commits are independently
committed sequentially, batch commits save time and system resources by committing
multiple small configuration edits in a single commit operation.
Batch commits are performed from the [edit batch] configuration mode. The commit
server properties can be configured at the [edit system commit server] hierarchy level.
For example, if there are five commit jobs (commit-1, commit-2, commit-3, commit-4, and
commit-5) being aggregated, and commit-3 encounters an error while loading, commit-3
is discarded and commit-1, commit-2, commit-4, and commit-5 are aggregated and
committed.
If there is an error during the commit operation when two or more jobs are aggregated
and committed, the aggregation is discarded and each of those jobs is committed
individually like a regular commit operation.
For example, if there are five commit jobs (commit-1, commit-2, commit-3, commit-4, and
commit-5) that are aggregated and if there is a commit error caused because of commit-3,
the aggregation is discarded, commit-1, commit-2, commit-3, commit-4, and commit-5
are committed individually, and the CLI reports a commit error for commit-3.
This topic provides you an overview of the configuration groups feature and the inheritance
model in Junos OS, and contains the following sections:
You can also use wildcards in a configuration group to allow configuration data to be
inherited by any object that matches a wildcard expression.
The configuration group mechanism is separate from the grouping mechanisms used
elsewhere in the configuration, such as BGP groups. Configuration groups provide a
generic mechanism that can be used throughout the configuration but that are known
only to Junos OS command-line interface (CLI). The individual software processes that
perform the actions directed by the configuration receive the expanded form of the
configuration; they have no knowledge of configuration groups.
Inheritance Model
Configuration groups use true inheritance, which involves a dynamic, ongoing relationship
between the source of the configuration data and the target of that data. Data values
changed in the configuration group are automatically inherited by the target. The target
need not contain the inherited information, although the inherited values can be overridden
in the target without affecting the source from which they were inherited.
This inheritance model allows you to see only the instance-specific information without
seeing the inherited details. A command pipe in configuration mode allows you to display
the inherited data.
To configure configuration groups and inheritance, you can include the groups statement
at the [edit] hierarchy level:
[edit]
groups {
group-name {
configuration-data;
}
}
When you edit a configuration, you work in a copy of the current configuration to create
a candidate configuration. The changes you make to the candidate configuration are
visible in the CLI immediately, so if multiple users are editing the configuration at the
same time, all users can see all changes.
To have a candidate configuration take effect, you commit the changes. At this point,
the candidate file is checked for proper syntax, activated, and marked as the current,
operational software configuration file. If multiple users are editing the configuration,
when you commit the candidate configuration, all changes made by all the users take
effect.
In addition to saving the current configuration, the CLI saves the current operational
version and the previous 49 versions of committed configurations. The most recently
committed configuration is version 0, which is the current operational version and the
default configuration that the system returns to if you roll back to a previous configuration.
The oldest saved configuration is version 49.
The currently operational Junos OS configuration is stored in the file juniper.conf and the
last three committed configurations are stored in the files juniper.conf.1, juniper.conf.2,
and juniper.conf.3. These four files are located in the directory /config, which is on the
switch’s hard disk. The remaining 46 previous versions of committed configurations, the
files juniper.conf.4 through juniper.conf.49, are stored in the directory /var/db/config on
the hard disk.
Related • Returning to the Most Recently Committed Junos Configuration on page 301
Documentation
• Returning to a Previously Committed Junos OS Configuration on page 301
Configuration
• Getting Started with Junos OS Configuration on page 61
• Updating the Junos OS Configuration on page 79
• Committing a Junos OS Configuration on page 99
• Loading a Junos OS Configuration on page 125
• Synchronizing the Junos OS Configuration on page 131
• Creating and Applying Junos OS Configuration Groups on page 135
• CLI Online Help on page 161
• CLI Operational Mode on page 165
• CLI Configuration Mode on page 167
• Controlling the CLI Environment on page 169
• CLI Advanced Features on page 171
• Configuration Statements and Commands on page 177
When you enter configuration mode, the following configuration mode commands are
available:
user@host>configure
entering configuration mode
[edit]
user@host#?
possible completions:
<[Enter]> Execute this command
activate Remove the inactive tag from a statement
annotate Annotate the statement with a comment
commit Commit current set of changes
copy Copy a statement
deactivate Add the inactive tag to a statement
delete Delete a data element
edit Edit a sub-element
Users must have configure permission to view and use the configure command. When
in configuration mode, a user can view and modify only those statements for which
they have access privileges set. For more information, see the Junos OS System Basics
Configuration Guide.
• If you enter configuration mode and another user is also in configuration mode, a
message shows the user’s name and what part of the configuration the user is viewing
or editing:
user@host> configure
Entering configuration mode
Users currently editing the configuration:
root terminal d0 (pid 4137) on since 2008-04-09 23:03:07 PDT, idle 7w6d 08:22
[edit]
The configuration has been changed but not committed
[edit]
user@host#
Up to 32 users can be in configuration mode simultaneously, and they all can make
changes to the configuration at the same time.
[edit]
user@host# exit
exiting configuration mode
user@host>
If you try to exit from configuration mode using the exit command and the configuration
contains changes that have not been committed, you see a message and prompt:
[edit]
user@host# exit
• To exit with uncommitted changes without having to respond to a prompt, use the exit
configuration-mode command. This command is useful when you are using scripts to
perform remote configuration.
[edit]
user@host# exit configuration-mode
The configuration has been changed but not committed
Exiting configuration mode
user@host>
To display the current configuration for a device running Junos OS, use the show
configuration mode command. This command displays the configuration at the current
hierarchy level or at the specified level.
You also can use the CLI operational mode show configuration command to display the
last committed current configuration, which is the configuration currently running on the
router:
When you show a configuration, a timestamp at the top of the configuration indicates
when the configuration was last changed:
If you have omitted a required statement at a particular hierarchy level, when you issue
the show command in configuration mode, a message indicates which statement is
missing. As long as 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'
}
}
}
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.
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 following example shows how you can display the current Junos configuration. To
display the entire configuration:
[edit]
user@host# set protocols ospf area 0.0.0.0 interface so-0/0/0 hello-interval 5
[edit]
user@host# show
protocols {
ospf {
area 0.0.0.0 {
interface so-0/0/0 {
hello-interval 5;
}
}
}
[edit]
user@host# show protocols ospf area 0.0.0.0
interface so-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# show
interface so-0/0/0 {
hello-interval 5;
}
[edit]
user@host# set protocols ospf area 0.0.0.0 interface so-0/0/0 hello-interval 5
[edit]
user@host# commit
commit complete
[edit]
user@host# quit
exiting configuration mode
user@host> show configuration
## Last commit: 2006-08-10 11:21:58 PDT by user
version 8.3
protocols {
ospf {
area 0.0.0.0 {
interface so-0/0/0 {
hello-interval 5;
}
}
}
}
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.
}
}
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
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 ( | ):
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
To display the users currently editing the configuration, use the status configuration mode
command:
user@host# status
Users currently editing the configuration:
The system displays who is editing the configuration (rchen), where the user is logged in
(terminal p0), the date and time the user logged in (2006-03-01 13:17:25 PST), and what
level of the hierarchy the user is editing ([edit interfaces]).
If you issue the status configuration mode command and a user has scheduled a candidate
configuration to become active for a future time, the system displays who scheduled the
commit (root), where the user is logged in (terminal d0), the date and time the user
logged in (2002-10-31 14:55:15 PST), and that a commit is pending (commit at).
[edit]
user@host# status
Users currently editing the configuration:
root terminal d0 (pid 767) on since 2002-10-31 14:55:15 PST, idle 00:03:09
commit at
For information about how to schedule a commit, see “Scheduling a Junos Commit
Operation” on page 111.
If you issue the status configuration mode command and a user is editing the configuration
in configure exclusive mode, the system displays who is editing the configuration (root),
where the user is logged in (terminal d0), the date and time the user logged in (2002-11-01
13:05:11 PST), and that a user is editing the configuration in configure exclusive mode
(exclusive [edit]).
[edit]
user@host# status
Users currently editing the configuration:
root terminal d0 (pid 2088) on since 2002-11-01 13:05:11 PST
exclusive [edit]
For example:
[edit]
user@host# show | display detail
##
## version: Software version information
## require: system
##
version "3.4R1 [tlim]";
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 "$1$BYJQE$/ocQof8pmcm7MSGK0"; # 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
##
at-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;
}
}
...
If you enter configuration mode with the configure exclusive command, you lock the
candidate global configuration (also known as the shared configuration or shared
configuration database) for as long as you remain in configuration mode, allowing you to
make changes without interference from other users. Other users can enter and exit
configuration mode, but they cannot commit the configuration.
If another user has locked the configuration, and you need to forcibly log the person out,
enter the operational mode command request system logout pid pid_number.
If you enter configuration mode and another user is also in configuration mode and has
locked the configuration, a message identifies the user and the portion of the configuration
that the user is viewing or editing:
user@host> configure
Entering configuration mode
Users currently editing the configuration:
root terminal p3 (pid 1088) on since 2000-10-30 19:47:58 EDT, idle 00:00:44
exclusive [edit interfaces so-3/0/0 unit 0 family inet]
In configure exclusive mode, any uncommitted changes are discarded when you exit:
When you use the yes option to exit configure exclusive mode, Junos OS discards your
uncommitted changes and rolls backs your configuration. The no option allows you to
continue editing or to commit your changes in configure exclusive mode.
When a user exits from configure exclusive mode while another user is in configure private
mode, Junos OS will roll back any uncommitted changes.
When you are in configure private mode, you must work with a copy of the most recently
committed shared configuration. If the global configuration changes, you can issue the
update command to update your private candidate configuration. When you do this, your
private candidate configuration contains a copy of the most recently committed
configuration with your private changes merged in. For example:
[edit]
user@host# update
[edit]
user@host#
NOTE: Merge conflicts can occur when you issue the update command.
You can also issue the rollback command to discard your private candidate configuration
changes and obtain the most recently committed configuration:
[edit]
user@host# rollback
[edit]
user@host#
NOTE:
• The instructions and examples in this topic are based on sample M Series
and T Series routers. You can use them as a guideline for entering
commands on your devices running Junos OS.
• Before you begin, make sure your device hardware is set up and Junos OS
is installed. You must have a direct console connection to the device or
network access using SSH or Telnet. If your device is not set up, follow the
installation instructions provided with the device before proceeding.
1. Log in as root.
The root login account has superuser privileges, with access to all commands and
statements.
root# cli
root@>
The > command prompt shows you are in operational mode. Later, when you enter
configuration mode, the prompt will change to #.
NOTE: If you are using the root account for the first time on the device,
remember that the device ships with no password required for root, but the
first time you commit a configuration with Junos OS Release 7.6 or later, you
must set a root password. Root access is not allowed over a telnet session.
To enable root access over an SSH connection, you must configure the system
services ssh root-login allow statement.
The CLI includes several ways to get help about commands. This section shows some
examples of how to get help:
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. Type file ? to show all possible completions for the file command.
root@> file ?
Possible completions:
<[Enter]> Execute this command
archive Archives files from the system
checksum Calculate file checksum
compare Compare files
3. Type file archive ? to show all possible completions for the file archive command.
Related • Getting Online Help from the Junos OS Command-Line Interface on page 9
Documentation
• Switching Between Junos OS CLI Operational and Configuration Modes on page 74
When you monitor and configure a device running Junos OS, you may need to switch
between operational mode and configuration mode. When you change to configuration
mode, the command prompt also changes. The operational mode prompt is a right angle
bracket (>) and the configuration mode prompt is a pound sign (#).
1. When you log in to the router and type the cli command, you are automatically in
operational mode:
--- JUNOS 9.2B1.8 built 2008-05-09 23:41:29 UTC
% cli
user@host>
2. To enter configuration mode, type the configure command or the edit command from
the CLI operation mode. For example:
user@host> configure
Entering configuration mode
[edit]
user@host#
The CLI prompt changes from user@host> to user@host# and a banner appears to
indicate the hierarchy level.
[edit]
user@host# commit and-quit
commit complete
Exiting configuration mode
user@host>
[edit]
user@host# exit
Exiting configuration mode
user@host>
When you exit configuration mode, the CLI prompt changes from user@host# to
user@host> and the banner no longer appears. You can enter or exit configuration
mode as many times as you wish without committing your changes.
[edit]
user@host# run operational-mode-command
For example, to display the currently set priority value of the Virtual Router Redundancy
Protocol (VRRP) primary router while you are modifying the VRRP configuration for
a backup router:
Related • Understanding the Junos OS CLI Modes, Commands, and Statement Hierarchies on
Documentation page 5
This topic describes how to log on to a device running Junos OS using a root account and
configure a new user account. You can configure an account for your own use or create
a test account.
root@host> configure
[edit]
root@host#
The prompt in brackets ([edit]), also known as a banner, shows that you are in
configuration edit mode at the top of the hierarchy.
[edit]
root@host# edit system login
[edit system login]
root@host#
The prompt in brackets changes to [edit system login] to show that you are at a new
level in the hierarchy.
NOTE: In Junos OS Release 12.2 and later, user account names can contain
a period (.) in the name. For example, you can have a user account named
nathan.chen. However, the username cannot begin or end with a period.
4. Configure a full name for the account. If the name includes spaces, enclose the entire
name in quotation marks (" " ):
5. Configure an account class. The account class sets the user access privileges for the
account:
When the new password prompt appears, enter a clear-text password that the system
can encrypt, and then confirm the new password.
Configuration changes are not activated until you commit the configuration. If the
commit is successful, a commit complete message appears.
root@host> exit
% logout Connection closed.
10. To test your changes, log back in with the user account and password you just
configured:
login: nchen
Password: password
--- Junos 8.3-R1.1 built 2005-12-15 22:42:19 UTC
nchen@host>
When you log in, you should see the new username at the command prompt.
You have successfully used the CLI to view the device status and perform a simple
configuration change. See the related topics listed in this section for more information
about the Junos OS CLI features.
• Displaying the Junos OS CLI Command and Word History on page 163
All properties of a device running Junos OS are configured by including statements in the
configuration. A statement consists of a keyword, which is fixed text, and, optionally, an
identifier. An identifier is an identifying name which you define, such as the name of an
interface or a username, and which allows you and the CLI to discriminate among a
collection of statements.
For example, the following list shows the statements available at the top level of
configuration mode:
user@host# set?
Possible completions:
> accounting-options Accounting data configuration
+ apply-groups Groups from which to inherit configuration data
> chassis Chassis configuration
> class-of-service Class-of-service configuration
> firewall Define a firewall configuration
> forwarding-options Configure options to control packet sampling
> groups Configuration groups
> interfaces Interface configuration
> policy-options Routing policy option configuration
> protocols Routing protocol configuration
> routing-instances Routing instance configuration
> routing-options Protocol-independent routing option configuration
> snmp Simple Network Management Protocol
> system System parameters
An angle bracket ( > ) before the statement name indicates that it is a container statement
and that you can define other statements at levels below it. If there is no angle bracket
( > ) before the statement name, the statement is a leaf statement; you cannot define
other statements at hierarchy levels below it.
A plus sign (+) before the statement name indicates that it can contain a set of values.
To specify a set, include the values in brackets. For example:
[edit]
user@host# set policy-options community my-as1-transit members [65535:10 65535:11]
In some statements, you can include an identifier. For some identifiers, such as interface
names, you must specify the identifier in a precise format. For example, the interface
name so-0/0/0 refers to a SONET/SDH interface that is on the Flexible PIC Concentrator
(FPC) in slot 0, in the first PIC location, and in the first port on the Physical Interface Card
(PIC). For other identifiers, such as interface descriptive text and policy and firewall term
names, you can specify any name, including special characters, spaces, and tabs.
You must enclose in quotation marks (double quotes) identifiers and any strings that
include a space or tab character or any of the following characters:
()[]{}!@#$%^&|'=?
If you do not type an option for a statement that requires one, a message indicates the
type of information required. In this example, you need to type an area number to complete
the command:
[edit]
user@host# set protocols ospf area<Enter>
^
syntax error, expecting <identifier>
To delete a statement or identifier from a Junos configuration, use the delete configuration
mode command. Deleting a statement or an identifier effectively "unconfigures" the
functionality associated with that statement or identifier, returning that functionality to
its default condition.
When you delete a statement, the statement and all its subordinate statements and
identifiers are removed from the configuration.
For statements that can have more than one identifier, when you delete one identifier,
only that identifier is deleted. The other identifiers in the statement remain.
To delete the entire hierarchy starting at the current hierarchy level, do not specify a
statement or an identifier in the delete command. When you omit the statement or
identifier, you are prompted to confirm the deletion:
[edit]
user@host# delete
Delete everything under this level? [yes, no] (no)
Possible completions:
no Don't delete everything under this level
yes Delete everything under this level
Delete everything under this level? [yes, no] (no)
system {
host-name host-211;
domain-name domain-122;
backup-router 192.168.71.254;
arp;
authentication-order [ radius password tacplus ];
}
The following example shows how to delete the ospf statement, effectively unconfiguring
OSPF on the router:
[edit]
user@host# set protocols ospf area 0.0.0.0 interface so-0/0/0 hello-interval 5
[edit]
user@host# show
protocols {
ospf {
area 0.0.0.0 {
interface so-0/0/0 {
hello-interval 5;
}
}
}
}
[edit]
user@host# delete protocols ospf
[edit]
user@host# show
[edit]
user@host#
[edit]
user@host# edit protocols ospf area 0.0.0.0
[edit protocols ospf area 0.0.0.0]
user@host# set interface so-0/0/0 hello-interval 5
[edit protocols ospf area 0.0.0.0]
user@host# delete
Delete everything under this level? [yes, no] (no) yes
[edit protocols ospf area 0.0.0.0]
user@host# show
[edit]
user@host#
[edit]
user@host# set interfaces so-3/0/0 speed 100mb
[edit]
user@host# show
interfaces {
so-3/0/0 {
speed 100mb;
}
}
[edit]
user@host# delete interfaces so-3/0/0 speed
[edit]
user@host# show
interfaces {
so-3/0/0;
}
When you have many similar statements in a Junos configuration, you can add one
statement and then make copies of that statement. Copying a statement duplicates
that statement and the entire hierarchy of statements configured under that statement.
Copying statements is useful when you are configuring many physical or logical interfaces
of the same type.
To make a copy of an existing statement in the configuration, use the configuration mode
copy command:
Immediately after you have copied a portion of the configuration, the configuration might
not be valid. You must check the validity of the new configuration, and if necessary,
modify either the copied portion or the original portion for the configuration to be valid.
The following example shows how you can create one virtual connection (VC) on an
interface, and then copy its configuration to create a second VC:
[edit interfaces]
user@host# show
at-1/0/0 {
description "PAIX to MAE West"
encapsulation atm-pvc;
unit 61 {
point-to-point;
vci 0.61;
family inet {
address 10.0.1.1/24;
}
}
}
[edit interfaces]
user@host# edit at-1/0/0
[edit interfaces at-1/0/0]
user@host# copy unit 61 to unit 62
[edit interfaces at-1/0/0]
user@host# show
description "PAIX to MAE West"
encapsulation atm-pvc;
unit 61 {
point-to-point;
vci 0.61;
family inet {
address 10.0.1.1/24;
}
}
unit 62 {
point-to-point;
vci 0.61;
family inet {
address 10.0.1.1/24;
}
}
To issue configuration mode commands from the top of the hierarchy, use the top
command; then specify a configuration command. For example:
To issue configuration mode commands from a location higher up in the hierarchy, use
the up configuration mode command; specify the number of levels you want to move up
the hierarchy and then specify a configuration command. For example:
When modifying a Junos configuration, you can rename an identifier that is already in the
configuration. You can do this either by deleting the identifier (using the delete command)
and then adding the renamed identifier (using the set and edit commands), or you can
rename the identifier using the rename configuration mode command:
This example shows how you can change the Network Time Protocol (NTP) server
address to 10.0.0.6 using the rename configuration mode command:
[edit]
user@host# rename system network-time server 10.0.0.7 to server 10.0.0.6
When configuring a device running Junos OS, you can enter most statements and
identifiers in any order. Regardless of the order in which you enter the configuration
statements, the CLI always displays the configuration in a strict order. However, there
are a few cases where the ordering of the statements matters because the configuration
statements create a sequence that is analyzed in order.
For example, in a routing policy or firewall filter, you define terms that are analyzed
sequentially. Also, when you create a named path in dynamic MPLS, you define an ordered
list of the transit routers in the path, starting with the first transit router and ending with
the last one.
To modify a portion of the configuration in which the statement order matters, use the
insert configuration mode command:
If you do not use the insert command, but instead simply configure the identifier, it is
placed at the end of the list of similar identifiers.
Insert policy terms in a routing policy configuration. Note that if you do not use the insert
command, but rather just configure another term, the added term is placed at the end
of the existing list of terms. Also note that you must create the term, as shown in this
example, before you can place it with the insert command.
[edit]
user@host# show
policy-options {
policy-statement statics {
term term1 {
from {
route-filter 192.168.0.0/16 orlonger;
route-filter 224.0.0.0/3 orlonger;
}
then reject;
}
term term2 {
from protocol direct;
then reject;
}
term term3 {
from protocol static;
then reject;
}
term term4 {
then accept;
}
}
}
[edit]
In a Junos configuration, you can deactivate statements and identifiers so that they do
not take effect when you issue the commit command. Any deactivated statements and
identifiers are marked with the inactive: tag. They remain in the configuration, but are not
activated when you issue a commit command.
In both commands, the statement and identifier you specify must be at the current
hierarchy level.
NOTE: In Junos OS Release 10.3 and later, you can only deactivate identifiers
or complete one-liner statements. You cannot deactivate just parts of a
one-liner, such as only child or leaf statements. For example, in the following
configuration:
[edit forwarding-options]
dhcp-relay {
dynamic-profile dynamic-profile-name aggregate-clients;
}
In some portions of the configuration hierarchy, you can include a disable statement to
disable functionality. One example is disabling an interface by including the disable
statement at the [edit interface interface-name] hierarchy level. When you deactivate a
statement, that specific object or property is completely ignored and is not applied at all
when you issue a commit command. When you disable a functionality, it is activated
when you issue a commit command but is treated as though it is down or administratively
disabled.
[edit interfaces]
user@host# show
at-5/2/0 {
traceoptions {
traceflag all;
}
atm-options {
vpi 0 maximum-vcs 256;
}
unit 0 {
...
[edit interfaces]
user@host# deactivate at-5/2/0
[edit interfaces]
user@host# show
inactive: at-5/2/0 {
traceoptions {
traceflag all;
}
...
}
}
}
[edit interfaces]
user@host# activate at-5/2/0
[edit interfaces]
user@host# show
at-5/2/0 {
traceoptions {
traceflag all;
}
...
}
You can include comments in a Junos configuration to describe any statement in the
configuration. You can add comments interactively in the CLI and by editing the ASCII
configuration file.
When you add comments in configuration mode, they are associated with a statement
at the current level. Each statement can have one single-line comment associated with
it. Before you can associate a comment with a statement, the statement must exist. The
comment is placed on the line preceding the statement.
statement is the configuration statement to which you are attaching the comment; it
must be at the current hierarchy level. If a comment for the specified statement already
exists, it is deleted and replaced with the new comment.
comment-string is the text of the comment. The comment text can be any length, and
you must type it on a single line. If the comment contains spaces, you must enclose it in
quotation marks. In the comment string, you can include the comment delimiters /* */
or #. If you do not specify any, the comment string is enclosed with the /* */ comment
delimiters.
When you edit the ASCII configuration file and add comments, they can be one or more
lines and must precede the statement they are associated with. If you place the comments
in other places in the file, such as on the same line following a statement or on a separate
line following a statement, they are removed when you use the load command to open
the configuration into the CLI.
When you include comments in the configuration file directly, you can format comments
in the following ways:
• Start the comment with a /* and end it with a */. The comment text can be on a single
line or can span multiple lines.
• Start the comment with a # and end it with a new line (carriage return).
If you add comments with the annotate command, you can view the comments within
the configuration by entering the show configuration mode command or the show
configuration operational mode command.
When configuring interfaces, you can add comments about the interface by including
the description statement at the [edit interfaces interface-name] hierarchy level. Any
comments you include appear in the output of the show interfaces commands. For more
information about the description statement, see the Junos® OS Network Interfaces.
[edit protocols]
isis {
interface ge-0/0/0.0 {
level 1 metric 10;
}
}
}
[edit]
user@host# show
protocols {
ospf {
area 0.0.0.0 {
interface so-0/0/0 {
hello-interval 5;
}
}
}
}
[edit]
user@host# edit protocols ospf
[edit protocols ospf]
user@host# set area 0.0.0.0
user@host# annotate area 0.0.0.0 "Backbone area configuration added June 15, 1998"
[edit protocols ospf]
user@host# edit area 0.0.0.0
[edit protocols ospf area 0.0.0.0]
user@host# annotate interface so0 "Interface from router sj1 to router sj2"
[edit protocols ospf area 0.0.0.0]
user@host# top
[edit]
user@host# show
protocols {
ospf {
/* Backbone area configuration added June 15, 1998 */
area 0.0.0.0 {
/* Interface from router sj1 to router sj2 */
interface so-0/0/0 {
hello-interval 5;
}
}
}
}
[edit]
user@host#
The following excerpt from a configuration example illustrates how to enter comments
in a configuration file:
The Junos OS command-line interface (CLI) enables you to delete related configuration
items simultaneously, such as channelized interfaces or static routes, by using a single
command and regular expressions. Deleting a statement or an identifier effectively
“unconfigures” the functionality associated with that statement or identifier, returning
that functionality to its default condition.
You can only delete certain parts of the configuration where you normally put multiple
items, for example, interfaces. However, you cannot delete "groups" of different items;
for example:
When you delete a statement, the statement and all its subordinate statements and
identifiers are removed from the configuration.
To delete related configuration items, issue the wildcard configuration mode command
with the delete option and specify the statement path, the items to be summarized with
a regular expression, and the regular expression.
NOTE: When you use the wildcard command to delete related configuration
items, the regular expression must be the final statement.
If the Junos OS matches more than eight related items, the CLI displays only
the first eight items.
Deleting Interfaces Delete multiple T1 interfaces in the range from t1-0/0/0:0 through t1-0/0/0:23:
from the Configuration
user@host# wildcard delete interfaces t1-0/0/0:.*
matched: t1-0/0/0:0
matched: t1-0/0/0:1
matched: t1-0/0/0:2
Delete 3 objects? [yes,no] (no) no
Deleting Routes from Delete static routes in the range from 172.0.0.0 to 172.255.0.0:
the Configuration
user@host# wildcard delete routing-options static route 172.*
matched: 172.16.0.0/12
matched: 172.16.14.0/24
matched: 172.16.100.0/24
matched: 172.16.128.0/19
matched: 172.16.160.0/24
matched: 172.17.12.0/23
matched: 172.17.24.0/23
matched: 172.17.28.0/23
...
Delete 13 objects? [yes,no] (no)
• Requirements on page 94
• Overview on page 94
• Configuration on page 95
• Verification on page 97
Requirements
This example uses the following hardware and software components:
Overview
The range option with the wildcard command enables you to specify ranges in activate,
deactivate, delete, protect, set, show, and unprotect commands. You can use ranges to
specify a range of interfaces, logical units, VLANs, and other numbered elements. The
wildcard range option expands the command you entered into multiple commands, each
of which corresponds to one item in the range.
The wildcard range option enables you to configure multiple configuration statements
using a single set command, instead of configuring each of them individually. For example,
to configure 24 Gigabit Ethernet interfaces with different port numbers, you can use a
single wildcard range set command instead of 24 individual set interfaces commands.
Similarly, to deactivate a group of 30 logical interfaces, you can use the wildcard range
deactivate command instead of deactivating each logical interface individually.
You can use wildcard range with the active, deactivate, delete, protect, set, show, and
unprotect configuration commands:
You can also specify all configuration hierarchy levels and their child configuration
statements in the CLI by using wildcard range with the set option:
Possible completions:
> > access Network access configuration
> > access-profile Access profile for this instance
> > accounting-options Accounting data configuration
> > applications Define applications by protocol characteristics
...
Configuration
The following examples show how to configure multiple configuration statements in a
single step by using the range option with the wildcard configuration command:
• Using the Range Option for Configuring a Series of Named Identifiers for a Configuration
Statement on page 95
• Specifying Multiple Ranges in the Syntax on page 95
• Specifying a Range and Unique Numbers In the Syntax on page 96
• Excluding Some Values from a Range on page 96
• Specifying a Range with a Step Number on page 96
Using the Range Option for Configuring a Series of Named Identifiers for a
Configuration Statement
Step-by-Step You can configure a series of identifiers for a configuration statement, by specifying a
Procedure numerical range of values for the identifiers.
• To configure a series of the same type of interface with different port numbers (0
through 23), specify the range for the port numbers by using the following format:
[edit]
user@host# wildcard range set interfaces ge-0/0/[0-23] unit 0 family vpls
Results Expands to 24 different set commands to configure interfaces with port numbers ranging
from 0 through 23:
[edit]
user@host# set interfaces ge-0/0/0 unit 0 family vpls
user@host# set interfaces ge-0/0/1 unit 0 family vpls
user@host# set interfaces ge-0/0/2 unit 0 family vpls
...
user@host# set interfaces ge-0/0/23 unit 0 family vpls
Step-by-Step You can have multiple ranges specified in a wildcard range command. Each range must
Procedure be separated by a comma. You can also have overlapping ranges.
• To specify more than one range in the syntax, include the minimum and maximum
values for each range, separated by a comma.
[edit]
user@host# wildcard range protect event-options policy p[1-3,5-7,6-9]
[edit]
user@host# set protect event-options policy p1
user@host# set protect event-options policy p2
user@host# set protect event-options policy p3
user@host# set protect event-options policy p5
Step-by-Step You can also specify a combination of a range and unique numbers in the syntax of the
Procedure wildcard range command.
[edit]
user@host# wildcard range protect event-options policy p[1-3,5,7,10]
[edit]
user@host# set protect event-options policy p1
user@host# set protect event-options policy p2
user@host# set protect event-options policy p3
user@host# set protect event-options policy p5
user@host# set protect event-options policy p7
user@host# set protect event-options policy p10
Step-by-Step You can exclude certain values from a range by marking the numbers or the range of
Procedure numbers to be excluded by using an exclamation mark.
• To exclude certain values from a range, include the portion to be excluded with ! in
the syntax.
[edit]
user@host# wildcard range protect event-options policy p[1-5,!3-4]
[edit]
user@host# set protect event-options policy p1
user@host# set protect event-options policy p2
user@host# set protect event-options policy p5
Step-by-Step You can provide a step number for a range to have a constant interval in the range.
Procedure
• To provide a step, include the step value in the syntax preceded by a forward slash
(/).
[edit]
user@host# wildcard range protect event-options policy p[1-10/2]
[edit]
user@host# set protect event-options policy p1
user@host# set protect event-options policy p3
user@host# set protect event-options policy p5
user@host# set protect event-options policy p7
user@host# set protect event-options policy p9
Verification
Confirm that the configuration is working properly.
Purpose Check the configuration created using the wildcard range option. The following sample
shows output for the configuration described in “Using the Range Option for Configuring
a Series of Named Identifiers for a Configuration Statement” on page 95.
Meaning The output indicates that 24 Gigabit Ethernet interfaces ranging from ge-0/0/0 through
ge-0/0/23 are created.
To verify that the syntax of a Junos configuration is correct, use the configuration mode
commit check command:
[edit]
user@host# commit check
configuration check succeeds
[edit]
user@host#
If the commit check command finds an error, a message indicates the location of the
error.
This example shows how to use the protect and unprotect commands in the configuration
mode to protect and unprotect the CLI configuration.
Requirements
This example uses the following hardware and software components:
Overview
The Junos OS enables you to protect the device configuration from being modified or
deleted by other users. This can be accomplished by using the protect command in the
configuration mode of the CLI. Likewise, you can also unprotect a protected configuration
by using the unprotect command.
These commands can be used at any level of the configuration hierarchy—a top-level
parent hierarchy or a configuration statement or an identifier within the lowest level of
the hierarchy.
For example, if you want to protect the entire [edit access] hierarchy level, issue the
following command:
[edit]
user@host# protect access
NOTE:
• If you issue the protect command for a hierarchy that is not used in the
configuration, the Junos OS CLI displays the following error message:
[edit]
user@host# protect access
warning: statement not found
For example, if you want to protect the [edit system syslog console] hierarchy level,
use the following command at the [edit system syslog] hierarchy level.
For example, if you want to protect the host-name statement under the [edit system]
hierarchy level, issue the following command:
[edit system]
user@host# protect host-name
• To protect all the addresses for the address statement, issue the following command
at the [edit] level:
[edit]
user@host# protect system login deny-sources address
Results All the addresses ([172.17.28.19 172.17.28.20 172.17.28.21 172.17.28.22]) for the address
statement are protected.
• To protect one or more individual addresses for the name-server statement, issue
the following command at the [edit] level:
[edit]
user@host# protect groups test1 system name-server 10.1.2.1
user@host# protect groups test1 system name-server 10.1.2.4
Unprotecting a Configuration
Step-by-Step Suppose you have the following configuration at the [edit system] hierarchy level:
Procedure
protect: system {
host-name bigping;
domain-search 10.1.2.1;
login {
deny-sources {
protect: address [ 172.17.28.19 172.17.28.173 172.17.28.0 174.0.0.0 ];
}
}
}
• To unprotect the entire [edit system] hierarchy level, issue the following command
at the [edit] level:
[edit]
user@host# unprotect system
Verification
Action In the configuration mode, issue the show command at the [edit] hierarchy level to see
all the configuration hierarchies and configuration statements that are protected.
...
protect: system {
host-name bigping;
domain-search 10.1.2.1;
login {
deny-sources {
protect: address [ 172.17.28.19 172.17.28.173 172.17.28.0 174.0.0.0 ];
}
}
}
...
Purpose To verify that a configuration is protected by trying to modify the configuration using the
activate, copy, insert, rename, and delete commands.
1. Try using the activate, copy, insert, rename, and delete commands for a top-level
hierarchy or a child-level hierarchy or a statement within the hierarchy.
protect: system {
host-name a;
inactive: domain-search [ a b ];
}
2. To verify that the hierarchy is protected, try issuing the activate command for the
domain-search statement:
[edit system]
Purpose To check if the protected hierarchies or statements are also displayed in the XML.
Protected hierarchies, statements, or identifiers are displayed with the protect="protect"
attribute in the XML.
1. Navigate to the hierarchy you want to view and issue the show command with the
pipe symbol and option | display xml:
[edit system]
\jnpr
</message>
<class>
<name>a</name>
<allow-commands>commit-synchronize</allow-commands>
<deny-commands>commit</deny-commands>
</class>
<deny-sources>
<address protect="protect">172.17.28.19</address>
<address protect="protect">172.17.28.173</address>
<address protect="protect">172.17.28.0</address>
<address protect="protect">174.0.0.0</address>
</deny-sources>
</login>
<syslog>
<archive>
</archive>
</syslog>
</system>
</configuration>
<cli>
<banner>[edit]</banner>
</cli>
</rpc-reply>
<protocols unprotect="unprotect">
<ospf>
<area>
<name>0.0.0.0</name>
<interface>
<name>all</name>
</interface>
</area>
</ospf>
</protocols>
[edit]
user@host# commit
commit complete
[edit]
user@host#
When you enter the commit command, the configuration is first checked for syntax errors
(commit check). Then, if the syntax is correct, the configuration is activated and becomes
the current, operational router configuration.
You can issue the commit command from any hierarchy level.
• The configuration includes incorrect syntax, which causes the commit check to fail.
• The candidate configuration that you are trying to commit is larger than 700 MB.
• The configuration is locked by a user who entered the configure exclusive command.
If the configuration contains syntax errors, a message indicates the location of the error,
and the configuration is not activated. The error message has the following format:
[edit edit-path]
‘offending-statement;’
error-message
For example:
You must correct the error before recommitting the configuration. To return quickly to
the hierarchy level where the error is located, copy the path from the first line of the error
and paste it at the configuration mode prompt at the [edit] hierarchy level.
view the file size from configuration mode by entering the command run file list /var/rundb
detail. You can simplify the configuration and reduce the file size by creating configuration
groups with wildcards or defining less specific match policies in your firewall filters.
When you commit a configuration, you commit the entire configuration in its current form.
If more than one user is modifying the configuration, committing it saves and activates
the changes of all the users.
NOTE:
• If you are using Junos OS in a Common Criteria environment, system log
messages are created whenever a secret attribute is changed (for example,
password changes or changes to the RADIUS shared secret). These changes
are logged during the following configuration load operations:
load merge
load replace
load override
load update
For more information, see the Secure Configuration Guide for Common
Criteria and Junos-FIPS.
Related • Committing a Junos Configuration and Exiting Configuration Mode on page 109
Documentation
• Activating a Junos Configuration but Requiring Confirmation on page 110
• Backing Up the Committed Configuration on the Alternate Boot Drive on page 114
To save Junos OS configuration changes, activate the configuration on the device and
exit configuration mode, using the commit and-quit configuration mode command. This
command succeeds only if the configuration contains no errors.
[edit]
user@host# commit and-quit
commit complete
exiting configuration mode
user@host>
When you commit the current candidate configuration, you can require an explicit
confirmation for the commit to become permanent. This is useful if you want to verify
that a configuration change works correctly and does not prevent access to the router.
If the change prevents access or causes other errors, the router automatically returns to
the previous configuration and restores access after the rollback confirmation timeout
passes. This feature is called automatic rollback.
To commit the current candidate configuration but require an explicit confirmation for
the commit to become permanent, use the commit confirmed configuration mode
command:
[edit]
user@host# commit confirmed
commit confirmed will be automatically rolled back in 10 minutes unless confirmed
commit complete
#commit confirmed will be rolled back in 10 minutes
[edit]
user@host#
Once you have verified that the change works correctly, you can keep the new
configuration active by entering a commit or commit check command within 10 minutes
of the commit confirmed command. For example:
[edit]
user@host# commit check
commit confirmed will be automatically rolled back in 10 minutes unless confirmed
commit complete
#commit confirmed will be rolled back in 10 minutes
[edit]
user@host#
If the commit is not confirmed within a certain time (10 minutes by default), Junos OS
automatically rolls back to the previous configuration and a broadcast message is sent
to all logged-in users.
To show when a rollback is scheduled after a commit confirmed command, enter the
show system commit command. For example:
0 2005-01-05 15:00:37 PST by root via cli commit confirmed, rollback in 3mins
Like the commit command, the commit confirmed command verifies the configuration
syntax and reports any errors. If there are no errors, the configuration is activated and
begins running on the router.
Figure 7 on page 111 illustrates how the commit confirmed command works.
To change the amount of time before you have to confirm the new configuration, specify
the number of minutes when you issue the command:
[edit]
user@host# commit confirmed minutes
commit complete
[edit]
user@host#
In Junos OS Release 11.4 and later, you can also use the commit confirmed command in
the [edit private] configuration mode.
You can schedule when you want your candidate configuration to become active. To
save Junos OS configuration changes and activate the configuration on the router at a
future time or upon reboot, use the commit at configuration mode command, specifying
reboot or a future time at the [edit] hierarchy level:
[edit]
user@host # commit at string
Where string is reboot or the future time to activate the configuration changes. You can
specify time in two formats:
• A time value in the form hh:mm[:ss] hours, minutes, and optionally seconds)—Commit
the configuration at the specified time, which must be in the future but before 11:59:59
PM on the day the commit at configuration mode command is issued. Use 24-hour
time for the hh value; for example, 04:30:00 is 4:30:00 AM, and 20:00 is 8:00 PM. The
time is interpreted with respect to the clock and time zone settings on the router.
• A date and time value in the form yyyy-mm-dd hh:mm[:ss] (year, month, date, hours,
minutes, and, optionally, seconds)—Commit the configuration at the specified day and
time, which must be after the commit at command is issued. Use 24-hour time for the
hh value. For example, 2003-08-21 12:30:00 is 12:30 PM on August 21, 2003. The time
is interpreted with respect to the clock and time zone settings on the router.
Enclose the string value in quotation marks (" "). For example, commit at "18:00:00". For
date and time, include both values in the same set of quotation marks. For example,
commit at "2005-03-10 14:00:00".
A commit check is performed immediately when you issue the commit at configuration
mode command. If the result of the check is successful, then the current user is logged
out of configuration mode, and the configuration data is left in a read-only state. No other
commit can be performed until the scheduled commit is completed.
NOTE: If Junos OS fails before the configuration changes become active, all
configuration changes are lost.
You cannot enter the commit at configuration command after you issue the
request system reboot command.
You cannot enter the request system reboot command once you schedule a
commit operation for a specific time in the future.
To monitor the Junos commit process, use the display detail command after the pipe
with the commit command:
For example:
[edit]
user@host# commit | display detail
2003-09-22 15:39:39 PDT: exporting juniper.conf
You can include a comment that describes changes to the committed configuration. To
do so, include the commit comment statement. The comment can be as long as 512 bytes
and you must type it on a single line.
[edit]
user@host# commit comment comment-string
NOTE: You cannot include a comment with the commit check command.
To add a comment to the commit command, include the comment statement after the
commit command:
[edit]
user@host# commit comment "add user joe"
commit complete
[edit]
user@host#
To add a comment to the commit confirmed command, include the comment statement
after the commit confirmed command:
[edit]
user@host# commit confirmed comment "add customer to port 27"
commit confirmed will be automatically rolled back in 10 minutes unless confirmed
commit complete
[edit]
user@host#
To view these commit comments, issue the show system commit operational mode
command.
In Junos OS Release 11.4 and later, you can also use the commit confirmed command in
the [edit private] configuration mode.
After you commit the configuration and are satisfied that it is running successfully, you
should issue the request system snapshot command to back up the new software onto
the /altconfig file system. If you do not issue the request system snapshot command, the
configuration on the alternate boot drive will be out of sync with the configuration on the
primary boot drive.
The request system snapshot command backs up the root file system to /altroot, and
/config to /altconfig. The root and /config file systems are on the router’s flash drive, and
the /altroot and /altconfig file systems are on the router’s hard disk (if available).
NOTE: To back up the file system on a J Series Services Router, you must
specify a media type (primary compact flash drive, removable compact flash
drive, or USB storage device) for backup. For more information about the
request system snapshot command, see the CLI Explorer.
NOTE: For more information about backing up the file system on an ACX
Series Universal Access Router, see Understanding System Snapshot on an
ACX Series Router.
After you issue the request system snapshot command, you cannot return to the previous
version of the software because the running and backup copies of the software are
identical.
Batches are prioritized by the commit server based on priority of the batch specified by
the user or the time when the batch job is added. When one batch commit is complete,
the next set of configuration changes are aggregated and loaded into the batch queue
for the next session of the batch commit operation. Batches are created until there are
no commit entries left in the queue directory.
When compared to the regular commit operation where all commits are independently
committed sequentially, batch commits save time and system resources by committing
multiple small configuration edits in a single commit operation.
Batch commits are performed from the [edit batch] configuration mode. The commit
server properties can be configured at the [edit system commit server] hierarchy level.
When there is a load-time error in one of the aggregated jobs, the commit job that
encounters the error is discarded and the remaining jobs are aggregated and committed.
For example, if there are five commit jobs (commit-1, commit-2, commit-3, commit-4, and
commit-5) being aggregated, and commit-3 encounters an error while loading, commit-3
is discarded and commit-1, commit-2, commit-4, and commit-5 are aggregated and
committed.
If there is an error during the commit operation when two or more jobs are aggregated
and committed, the aggregation is discarded and each of those jobs is committed
individually like a regular commit operation.
For example, if there are five commit jobs (commit-1, commit-2, commit-3, commit-4, and
commit-5) that are aggregated and if there is a commit error caused because of commit-3,
the aggregation is discarded, commit-1, commit-2, commit-3, commit-4, and commit-5
are committed individually, and the CLI reports a commit error for commit-3.
Requirements
Overview
You can control how the batch commit queue is handled by the commit server by
configuring the server properties at the [edit system commit server] hierarchy level. This
enables you to control how many commit jobs are aggregated or merged into a single
batch commit, the maximum number of jobs that can be added to the queue, days to
keep batch commit error logs, interval between two batch commits, and tracing operations
for batch commit operations.
Configuration
CLI Quick To quickly configure this section of the example, copy the following commands, paste
Configuration them into a text file, remove any line breaks, change any details necessary to match your
network configuration, and then copy and paste the commands into the CLI at the [edit]
hierarchy level. You can configure the commit server properties from either the regular
[edit] mode or the [edit batch] mode.
In this example, the number of commit transactions is set to 4 indicating that four
different commit jobs are aggregated into a single commit before the commit
operation is initiated.
This limits the number of commits jobs that are added to the queue.
3. (Optional) Configure the time (in seconds) to wait before starting the next batch
commit operation.
In this example, the filename for logging batch commit events is commitd_nov, and
all traceoption flags are set.
Results From configuration mode, confirm your configuration by entering the show system commit
server command. If the output does not display the intended configuration, repeat the
instructions in this example to correct the configuration.
Step-by-Step To commit the configuration from the [edit batch] mode, do one of the following:
Procedure
• Log in to the device and enter commit.
[edit batch]
user@R0# commit
Added to commit queue request-id: 1000
• To assign a higher priority to a batch commit job, issue the commit command with
the priority option.
[edit batch]
user@R0# commit priority
Added to commit queue request-id: 1001
[edit batch]
user@R0# commit atomic
Added to commit queue request-id: 1002
[edit batch]
user@R0# commit atomic priority
Added to commit queue request-id: 1003
Verification
By default, the status of the commit server is Not running. The commit server starts
running only when a batch commit job is added to the queue.
When a batch commit job is added to the queue, the status of the commit server changes
to Running.
Meaning The Jobs in process field lists the commit IDs of jobs that are in process.
Purpose Check the commit server queue for the status of the batch commits.
Pending commits:
Id: 1005
Last Modified: Tue Nov 1 23:56:43 2011
Completed commits:
Id: 1000
Last Modified: Tue Nov 1 22:46:43 2011
Status: Successfully committed 1000
Id: 1002
Last Modified: Tue Nov 1 22:50:35 2011
Status: Successfully committed 1002
Id: 1004
Last Modified: Tue Nov 1 22:51:48 2011
Status: Successfully committed 1004
Id: 1007
Last Modified: Wed Nov 2 01:08:04 2011
Status: Successfully committed 1007
Id: 1009
Last Modified: Wed Nov 2 01:16:45 2011
Status: Successfully committed 1009
Id: 1010
Last Modified: Wed Nov 2 01:19:25 2011
Status: Successfully committed 1010
Id: 1011
Last Modified: Wed Nov 2 01:28:16 2011
Status: Successfully committed 1011
Error commits:
Id: 1008
Last Modified: Wed Nov 2 01:08:18 2011
Status: Error while commiting 1008
Meaning Pending commits displays commit jobs that are added to the commit queue but are not
committed yet. Completed commits displays the list of commit jobs that are successful.
Error commits are commits that failed because of an error.
Purpose View the timestamps, patch files, and the status of each of the commit jobs. Patch files
show the configuration changes that occur in each commit operation that is added to
the batch commit queue.
Action 1. Issue the show system commit server queue patch command to view the patches for
all commit operations.
Completed commits:
Id: 1000
Last Modified: Tue Nov 1 22:46:43 2011
Status: Successfully committed 1000
Patch:
[edit groups]
re1 { ... }
+ GRP-DHCP-POOL-NOACCESS {
+ access {
+ address-assignment {
+ pool <*> {
+ family inet {
+ dhcp-attributes {
+ maximum-lease-time 300;
+ grace-period 300;
+ domain-name verizon.net;
+ name-server {
+ 4.4.4.1;
+ 4.4.4.2;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
Id: 1002
Last Modified: Tue Nov 1 22:50:35 2011
Status: Successfully committed 1002
Patch:
[edit]
+ snmp {
+ community abc;
+ }
Id: 1010
Last Modified: Wed Nov 2 01:19:25 2011
Status: Successfully committed 1010
Patch:
[edit system syslog]
file test { ... }
+ file j {
+ any any;
+ }
Error commits:
Id: 1008
Last Modified: Wed Nov 2 01:08:18 2011
Status: Error while commiting 1008
Patch:
[edit system]
+ radius-server {
+ 10.1.1.1 port 222;
+ }
The output shows the changes in configuration for each commit job ID.
2. To view the patch for a specific commit job ID, issue the show system commit server
queue patch id <id-number> command.
Patch:
[edit system]
+ radius-server {
+ 192.168.69.162 secret teH.bTc/RVbPM;
+ 192.168.64.10 secret teH.bTc/RVbPM;
+ 192.168.60.52 secret teH.bTc/RVbPM;
+ 192.168.60.55 secret teH.bTc/RVbPM;
+ 192.168.4.240 secret teH.bTc/RVbPM;
+ }
Meaning The output shows the patch created for a commit job. The + or - sign indicates the changes
in the configuration for a specific commit job.
Purpose View the trace files for batch commit operations. You can use the trace files for
troubleshooting purposes.
Action • Issue the file show /var/log/<filename> command to view all entries in the log file.
• To view log entries only for successful batch commit operations, issue the file show
/var/log/<filename> command with the | match committed pipe option.
• To view log entries only for failed batch commit operations, issue the file show
/var/log/<filename> command with the | match “Error while” pipe option.
• To view log entries only for commit server events, issue the file show
/var/log/<filename> command with the | match “commit server” pipe option.
You can create a file, copy the file to the local router, and then load the file into the CLI.
After you have loaded the file, you can commit it to activate the configuration on the
router, or you can edit the configuration interactively using the CLI and commit it at a
later time.
You can also create a configuration while typing at the terminal and then load it. Loading
a configuration from the terminal is generally useful when you are cutting existing portions
of the configuration and pasting them elsewhere in the configuration.
To load an existing configuration file that is located on the router, use the load
configuration mode command:
[edit]
user@host# load (factory-default | merge | override | patch | replace | set | update)
filename <relative>
For information about specifying the filename, see “Specifying Filenames and URLs” on
page 240.
To load a configuration from the terminal, use the following version of the load
configuration mode command. Press Ctrl-d to end input.
[edit]
user@host# load (factory-default | merge | override | patch | replace | set | update)
terminal <relative>
To replace an entire configuration, specify the override option at any level of the hierarchy.
A load override operation completely replaces the current candidate configuration with
the file you are loading. Thus, if you saved a complete configuration, use this option.
An override operation discards the current candidate configuration and loads the
configuration in filename or the configuration that you type at the terminal. When you
use the override option and commit the configuration, all system processes reparse the
configuration. For an example, see Figure 8 on page 128.
To replace portions of a configuration, specify the replace option. The load replace
operation looks for replace: tags that you added to the loaded file, and replaces the parts
of the candidate configuration with whatever is specified after the tag. This is useful
when you want more control over exactly what is being changed. For this operation to
work, you must include replace: tags in the file or configuration you type at the terminal.
The software searches for the replace: tags, deletes the existing statements of the same
name, if any, and replaces them with the incoming configuration. If there is no existing
statement of the same name, the replace operation adds to the configuration the
statements marked with the replace: tag. For an example, see Figure 9 on page 128.
If, in an override or merge operation, you specify a file or type text that contains replace:
tags, the replace: tags are ignored and the override or merge operation is performed.
If you are performing a replace operation and the file you specify or text you type does
not contain any replace: tags, the replace operation is effectively equivalent to a merge
operation. This might be useful if you are running automated scripts and cannot know in
advance whether the scripts need to perform a replace or a merge operation. The scripts
can use the replace operation to cover either case.
The load merge operation adds the saved file to the existing candidate configuration.
This is useful if you are adding new configuration sections. For example, suppose that
you are adding a BGP configuration to the [edit protocols] hierarchy level, where there
was no BGP configuration before, you can use the load merge operation to combine the
saved file configuration to the existing candidate configuration. If the existing configuration
and the incoming configuration contain conflicting statements, the statements in the
incoming configuration override those in the existing configuration.
To replace only the configuration that has changed, specify the update option at any
level of the hierarchy. The load update operation compares the candidate configuration
and the file you are loading, and only changes the parts of the candidate configuration
that are different from the new configuration. You would use this, for example, if there
is an existing BGP configuration and the file you are loading changes it in some way.
To change part of the configuration with a patch file, specify the patch option. The load
patch operation loads a file or terminal input that contains configuration changes. First,
on a device that already has the configuration changes, you type the show | compare
command to output the differences between two configurations. Then you can load the
differences on another router. The advantage of the load patch command is that it saves
you from having to copy snippets from different hierarchy levels into a text file prior to
loading them into the target device. This might be a useful time saver if you are configuring
several devices with the same options. For example, suppose that you configure a routing
policy on Device router1 and you want to replicate the policy configuration on Device
router2, router3, and router4, you can use the load patch operation.
Copy the output of the show | compare command to the clipboard, making sure to include
the hierarchy levels. On Device router2, router3, and router4, type load patch terminal and
paste the output. Press Enter and then press Ctrl-d to end the operation. If the patch
input specifies different values for an existing statement, the patch input overrides the
existing statement.
To use the merge, replace, set, or update option without specifying the full hierarchy level,
specify the relative option. For example:
[edit system]
user@host# show static-host-mapping
bob sysid 987.654.321ab
[edit system]
user@host# load replace terminal relative
[Type ^D at a new line to end input]
replace: static-host-mapping {
bob sysid 0123.456.789bc;
}
load complete
[edit system]
user@host# show static-host-mapping
bob sysid 0123.456.789bc;
To load a configuration that contains the set configuration mode command, specify the
set option. This option executes the configuration instructions line by line as they are
stored in a file or from a terminal. The instructions can contain any configuration mode
command, such as set, edit, exit, and top. For an example, see Figure 12 on page 129.
To copy a configuration file from another network system to the local router, you can
use the SSH and Telnet utilities, as described in the CLI Explorer.
load merge
load replace
load override
load update
For more information, see the Secure Configuration Guide for Common Criteria
and Junos-FIPS.
If your router has two Routing Engines, you can manually direct one Routing Engine to
synchronize its configuration with the other by issuing the commit synchronize command.
The Routing Engine on which you execute this command (requesting Routing Engine)
copies and loads its candidate configuration to the other (responding Routing Engine).
Both Routing Engines then perform a syntax check on the candidate configuration file
being committed. If no errors are found, the configuration is activated and becomes the
current operational configuration on both Routing Engines.
The commit synchronize command does not work if the responding Routing Engine has
uncommitted configuration changes. However, you can enforce commit synchronization
on the Routing Engines by using the force option. When you issue the commit synchronize
command with the force option from one Routing Engine, the configuration sessions on
the other Routing Engine will be terminated and its configuration synchronized with that
on the Routing Engine from which you issued the command.
NOTE: We recommend that you use the force option only if you are unable
to resolve the issues that caused the commit synchronize command to fail.
For example, if you are logged in to re1 (requesting Routing Engine) and you want re0
(responding Routing Engine) to have the same configuration as re1, issue the commit
synchronize command on re1. re1 copies and loads its candidate configuration to re0.
Both Routing Engines then perform a syntax check on the candidate configuration file
being committed. If no errors are found, re1's candidate configuration is activated and
becomes the current operational configuration on both Routing Engines.
NOTE: When you issue the commit synchronize command, you must use the
groups re0 and re1. For information about how to use the apply-groups
statement, see “Applying a Junos Configuration Group” on page 137.
To synchronize a Routing Engine's current operational configuration file with the other,
log in to the Routing Engine from which you want to synchronize and issue the commit
synchronize command:
[edit]
user@host# commit synchronize
commit complete
[edit]
user@host#
NOTE: You can also add the commit synchronize statement at the [edit
system] hierarchy level so that a commit command automatically invokes a
commit synchronize command by default. For more information, see the Junos
OS System Basics Configuration Guide.
To enforce a commit synchronize on the Routing Engines, log in to the Routing Engine
from which you want to synchronize and issue the commit synchronize command with
the force option:
[edit]
user@host# commit synchronize force
re0:
re1:
commit complete
re0:
commit complete
[edit]
user@host#
NOTE:
• If you have nonstop routing enabled on your router, you must enter the
commit synchronize command from the master Routing Engine after you
make any changes to the configuration. If you enter this command on the
backup Routing Engine, the Junos OS displays a warning and commits the
configuration.
For the commit synchronization process, the master Routing Engine commits the
configuration and sends a copy of the configuration to the backup Routing Engine. Then
the backup Routing Engine loads and commits the configuration. So, the commit
synchronization between the master and backup Routing Engines takes place one Routing
Engine at a time. If the configuration has a large text size or many apply-groups, commit
times can be longer than desired.
You can use the commit fast-synchronize statement to have the synchronization between
the master and backup Routing Engines occur simultaneously instead of sequentially.
This can reduce the time needed for synchronization because the commits on the master
and backup Routing Engines occur in parallel.
Include the fast-synchronize statement at the [edit system] hierarchy level to have
synchronize occur simultaneously between the master and the backup Routing Engines:
[edit system]
commit fast-synchronize
NOTE:
• If commit fails on either Routing Engine, the commit process is rolled back
on the other Routing Engine as well. This ensures that both Routing Engines
have the same configuration.
• Ensure that the Junos OS software version running on both the Routing
Engines is same.
Related • Configuring the Junos OS to Support Redundancy on Routers Having Multiple Routing
Documentation Engines or Switching Boards
• Configuring Junos OS for the First Time on a Device with Dual Routing Engines
To create a configuration group, include the groups statement at the [edit] hierarchy
level:
[edit]
groups {
group-name {
configuration-data;
}
lccn-re0 {
configuration-data;
}
lccn-re1 {
configuration-data;
}
}
group-name is the name of a configuration group. You can configure more than one
configuration group by specifying multiple group-name statements. However, you cannot
use the prefix junos- in a group name because it is reserved for use by Junos OS. Similarly,
the configuration group juniper-ais is reserved exclusively for Juniper Advanced Insight
Solutions (AIS)-related configuration. For more information on the juniper-ais configuration
group, see the Juniper Networks Advanced Insight Solutions Guide.
One reason for the naming restriction is a configuration group called junos-defaults. This
preset configuration group is applied to the configuration automatically. You cannot
modify or remove the junos-defaults configuration group. For more information about
the Junos default configuration group, see “Using Junos OS Defaults Groups” on page 157.
On routers that support multiple Routing Engines, you can also specify two special group
names:
The configuration specified in group re0 is only applied if the current Routing Engine is in
slot 0; likewise, the configuration specified in group re1 is only applied if the current Routing
Engine is in slot 1. Therefore, both Routing Engines can use the same configuration file,
each using only the configuration statements that apply to it. Each re0 or re1 group
contains at a minimum the configuration for the hostname and the management interface
(fxp0). If each Routing Engine uses a different management interface, the group also
should contain the configuration for the backup router and static routes.
In addition, the TX Matrix router supports group names for the Routing Engines in each
T640 router attached to the routing matrix. Providing special group names for all Routing
Engines in the routing matrix allows you to configure the individual Routing Engines in
each T640 router differently. Parameters that are not configured at the [edit groups]
hierarchy level apply to all Routing Engines in the routing matrix.
The group names for Routing Engines on the TX Matrix router have the following formats:
n identifies the T640 router and can be from 0 through 3. For example, to configure
Routing Engine 1 properties for lcc3, you include statements at the [edit groups lcc3–re1]
hierarchy level. For information about the TX Matrix router and routing matrix, see the
Junos OS System Basics Configuration Guide.
NOTE: The management Ethernet interface used for the TX Matrix Plus
router, T1600 or T4000 routers in a routing matrix, and PTX Series Packet
Transport Switches, is em0. Junos OS automatically creates the router’s
management Ethernet interface, em0.
To have a Junos configuration inherit the statements from a configuration group, include
the apply-groups statement:
apply-groups [ group-names ];
If you specify more than one group name, list them in order of inheritance priority. The
configuration data in the first group takes priority over the data in subsequent groups.
For routers that support multiple Routing Engines, you can specify re0 and re1 group
names. The configuration specified in group re0 is only applied if the current Routing
Engine is in slot 0; likewise, the configuration specified in group re1 is only applied if the
current Routing Engine is in slot 1. Therefore, both Routing Engines can use the same
configuration file, each using only the configuration statements that apply to it. Each re0
or re1 group contains at a minimum the configuration for the hostname and the
management interface (fxp0). If each Routing Engine uses a different management
interface, the group also should contain the configuration for the backup router and static
routes.
NOTE: The management Ethernet interface used for the TX Matrix Plus
router, T1600 or T4000 routers in a routing matrix, and PTX Series Packet
Transport Switches, is em0.
You can include only one apply-groups statement at each specific level of the configuration
hierarchy. The apply-groups statement at a specific hierarchy level lists the configuration
groups to be added to the containing statement’s list of configuration groups.
Values specified at the specific hierarchy level override values inherited from the
configuration group.
Groups listed in nested apply-groups statements take priority over groups in outer
statements. In the following example, the BGP neighbor 10.0.0.1 inherits configuration
data from group one first, then from groups two and three. Configuration data in group
one overrides data in any other group. Data from group ten is used only if a statement is
not contained in any other group.
When you configure a group defined for the root level—that is, in the default logical
system–you cannot successfully apply that group to a nondefault logical system under
the [edit logical-systems logical-system-name] hierarchy level. Although the router accepts
the commit if you apply the group, the configuration group does not take effect for the
nondefault logical system. You can instead create an additional configuration group at
the root level and apply it within the logical system. Alternatively, you can modify the
original group so that it includes configuration for both the default and nondefault logical
system hierarchy levels.
Related • Example: Configuring and Applying Junos Configuration Groups on page 138
Documentation
• Disabling Inheritance of a Junos OS Configuration Group on page 141
In this example, the SNMP configuration is divided between the group basic and the
normal configuration hierarchy.
In addition, setting a contact for a specific box is now possible because the group data
would be hidden by the router-specific data.
[edit]
groups {
basic { # User-defined group name
snmp { # This group contains some SNMP data
contact "My Engineering Group";
community BasicAccess {
authorization read-only;
}
}
}
}
apply-groups basic; # Enable inheritance from group "basic"
snmp { # Some normal (non-group) configuration
location "West of Nowhere";
}
[edit]
snmp {
location "West of Nowhere";
contact "My Engineering Group";
community BasicAccess {
authorization read-only;
}
}
For information about how to disable inheritance of a configuration group, see “Disabling
Inheritance of a Junos OS Configuration Group” on page 141.
Related • Example: Creating and Applying Configuration Groups on a TX Matrix Router on page 139
Documentation
• Example: Configuring Interfaces Using Junos OS Configuration Groups on page 149
• Example: Referencing the Preset Statement From the Junos defaults Group on page 159
• Example: Viewing Default Statements That Have Been Applied to the Configuration
on page 159
• Example: Configuring a Consistent IP Address for the Management Interface on page 152
The following example shows how to configure and apply configuration groups on a TX
Matrix Router:
[edit]
groups {
re0 { # Routing Engine 0 on TX Matrix router
system {
host-name hostname;
backup-router ip-address;
}
interfaces {
fxp0 {
unit 0 {
family inet {
address ip-address;
}
}
}
}
}
re1 { # Routing Engine 1 on TX Matrix router
system {
host-name hostname;
backup-router ip-address;
}
interfaces {
fxp0 {
unit 0 {
family inet {
address ip-address;
}
}
}
}
}
lcc0-re0 { # Routing Engine 0 on T640 router numbered 0
system {
host-name hostname;
backup-router ip-address;
}
interfaces {
fxp0 {
unit 0 {
family inet {
address ip-address;
}
}
}
}
}
lcc0-re1 { # Routing Engine 1 on T640 router numbered 0
system {
host-name hostname;
backup-router ip-address;
}
interfaces {
fxp0 {
unit 0 {
family inet {
address ip-address;
}
}
}
}
}
}
apply-groups [ re0 re1 lcc0-re0 lcc0-re1 ];
Related • Example: Configuring and Applying Junos Configuration Groups on page 138
Documentation
• Creating a Junos Configuration Group on page 135
To disable inheritance of a configuration group at any level except the top level of the
hierarchy, include the apply-groups-except statement:
apply-groups-except [ group-names ];
This statement is useful when you use the apply-group statement at a specific hierarchy
level but also want to override the values inherited from the configuration group for a
specific parameter.
Example: Disabling In the following example, the apply-groups statement is applied globally at the interfaces
Inheritance on level. The apply-groups-except statement is also applied at interface so-1/1/0 so that it
Interface so-1/1/0 uses the default values for the hold-time and link-mode statements.
[edit]
groups { # "groups" is a top-level statement
global { # User-defined group name
interfaces {
<*> {
hold-time down 640;
link-mode full-duplex;
}
}
}
}
apply-groups global;
interfaces {
so-1/1/0 {
apply-groups-except global; # Disables inheritance from group "global"
# so-1/1/0 uses default value for “hold-time”
# and "link-mode"
}
}
For information about applying a configuration group, see “Applying a Junos Configuration
Group” on page 137.
Configuration groups can add some confusion regarding the actual values used by the
router, because configuration data can be inherited from configuration groups. To view
the actual values used by the router, use the display inheritance command after the pipe
( | ) in a show command. This command displays the inherited statements at the level
at which they are inherited and the group from which they have been inherited.
[edit]
user@host# show | display inheritance
snmp {
[edit]
user@host# show | display inheritance | except ##
snmp {
location "West of Nowhere";
contact "My Engineering Group";
community BasicAccess {
authorization read-only;
}
}
NOTE: Using the display inheritance | except ## option removes all the lines
with ##. Therefore, you might also not be able to view information about
passwords and other important data where ## is used. To view the complete
configuration details with all the information without just the comments
marked with ##, use the no-comments option with the display inheritance
command:
[edit]
user@host# show | display inheritance no-comments
snmp {
location "West of Nowhere";
contact "My Engineering Group";
community BasicAccess {
authorization read-only;
}
}
You can use wildcards to identify names and allow one statement to provide data for a
variety of statements. For example, grouping the configuration of the sonet-options
statement over all SONET/SDH interfaces or the dead interval for OSPF over all
Asynchronous Transfer Mode (ATM) interfaces simplifies configuration files and eases
their maintenance.
Using wildcards in normal configuration data is done in a style that is consistent with
that used with traditional UNIX shell wildcards. In this style, you can use the following
metacharacters:
• Close bracket ( ] )—Indicates the end of a character class. If the close bracket is missing,
the open bracket matches a [ rather than introduce a character class.
• A character class matches any of the characters between the square brackets. Within
a configuration group, an interface name that includes a character class must be
enclosed in quotation marks.
Wildcarding in configuration groups follows the same rules, but any term using a wildcard
pattern must be enclosed in angle brackets <pattern> to differentiate it from other
wildcarding in the configuration file.
[edit]
groups {
sonet-default {
interfaces {
<so-*> {
sonet-options {
payload-scrambler;
rfc-2615;
}
}
}
}
}
Wildcard expressions match (and provide configuration data for) existing statements in
the configuration that match their expression only. In the previous example, the expression
<so-*> passes its sonet-options statement to any interface that matches the expression
so-*.
[edit]
groups {
gigabit-ethernet-interfaces {
interfaces {
"<ge-1/2/[5-8]>" {
description "These interfaces reserved for Customer ABC";
}
}
}
}
Angle brackets allow you to pass normal wildcarding through without modification. In
any matching within the configuration, whether it is done with or without wildcards, the
first item encountered in the configuration that matches is used. In the following example,
data from the wildcarded BGP groups is inherited in the order in which the groups are
listed. The preference value from <*a*> overrides the preference in <*b*>, just as the p
value from <*c*> overrides the one from <*d*>. Data values from any of these groups
override the data values from abcd.
[edit]
user@host# show
groups {
one {
protocols {
bgp {
group <*a*> {
preference 1;
}
group <*b*> {
preference 2;
}
group <*c*> {
out-delay 3;
}
group <*d*> {
out-delay 4;
}
group abcd {
preference 10;
hold-time 10;
out-delay 10;
}
}
}
}
}
protocols {
bgp {
group abcd {
apply-groups one;
}
}
}
[edit]
user@host# show | display inheritance
protocols {
bgp {
group abcd {
##
## ’1’ was inherited from group ’one’
##
preference 1;
##
## ’10’ was inherited from group ’one’
##
hold-time 10;
##
## ’3’ was inherited from group ’one’
##
out-delay 3;
}
}
}
You can configure a group to be applied based on the type of chassis, model, or
routing-engine, virtual chassis member, cluster node, and start and optional end time of
day or date.
For example, you could use the when statement to create a generic configuration group
for each type of node and then apply the configuration based on certain node properties,
such as chassis or model.
Requirements
No special configuration beyond device initialization is required before you configure this
example.
Overview
You can configure your group configuration data at the [edit groups group-name] hierarchy
level, then use the when statement to have the group applied based on conditions
including: type of chassis, model, or routing-engine, virtual chassis member, cluster node,
and start and optional end time of day or date.
If you specify multiple conditions in a single configuration group, all conditions must be
met before the configuration group is applied.
You can specify the start time or the time duration for the configuration group to be
applied. If only the start time is specified, the configuration group is applied at the specified
time and it remains in effect until the time is changed. If the end time is specified, then
on each day, the applied configuration group is started and stopped at the specified
times.
This example sets conditions in a configuration group, test1, such that this group is applied
only when all of the following conditions are met: the router is a model MX240 router
with chassis type LCC0, with a Routing Engine operating as RE0, is member0 of the virtual
chassis on node0, and the configuration group will only be in effect from 9:00 a.m. until
5:00 p.m. each day. The configuration data has not yet been added to the test1 group in
this example.
Configuration
CLI Quick To quickly configure this example, copy the following commands, paste them into a text
Configuration file, remove any line breaks, change any details necessary to match your network
configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy
level.
Step-by-Step The following example requires you to navigate various levels in the configuration
Procedure hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration
Mode in the CLI User Guide.
3. Set the condition that identifies the Routing Engine operating as RE0.
6. Set the condition that applies the group only between the hours of 9:00 a.m. and
5:00 p.m. daily.
NOTE: The syntax for specifying the time is: time <start-time> [to
<end-time>] using the time format yyyy-mm-dd.hh:mm, hh:mm, or hh.
Results From configuration mode, confirm your configuration by entering the show groups
command. If the output does not display the intended configuration, repeat the
instructions in this example to correct the configuration.
Verification
Purpose Verify that conditional data from a configuration group is inherited when applied.
Action The show | display inheritance operational command can be issued with the when data
to display the conditional inheritance. Using this example, you could issue one of these
commands to determine that the conditional data was inherited:
When sets of statements exist in configuration groups, all values are inherited. For
example:
[edit]
user@host# show
groups {
basic {
snmp {
interface so-1/1/1.0;
}
}
}
apply-groups basic;
snmp {
interface so-0/0/0.0;
}
[edit]
user@host# show | display inheritance
snmp {
##
## ’so-1/1/1.0’ was inherited from group ’basic’
##
interface [ so-0/0/0.0 so-1/1/1.0 ];
}
For sets that are not displayed within brackets, all values are also inherited. For example:
[edit]
user@host# show
groups {
worldwide {
system {
name-server {
10.0.0.100;
10.0.0.200;
}
}
}
}
apply-groups worldwide;
system {
name-server {
10.0.0.1;
10.0.0.2;
}
}
[edit]
user@host# show | display inheritance
system {
name-server {
##
## ’10.0.0.100’ was inherited from group ’worldwide’
##
10.0.0.100;
##
## ’10.0.0.200’ was inherited from group ’worldwide’
##
10.0.0.200;
10.0.0.1;
10.0.0.2;
}
}
You can use configuration groups to separate the common interface media parameters
from the interface-specific addressing information. The following example places
configuration data for ATM interfaces into a group called atm-options:
[edit]
user@host# show
groups {
atm-options {
interfaces {
<at-*> {
atm-options {
vpi 0 maximum-vcs 1024;
}
unit <*> {
encapsulation atm-snap;
point-to-point;
family iso;
}
}
}
}
}
apply-groups atm-options;
interfaces {
at-0/0/0 {
unit 100 {
vci 0.100;
family inet {
address 10.0.0.100/30;
}
}
unit 200 {
vci 0.200;
family inet {
address 10.0.0.200/30;
}
}
}
}
[edit]
user@host# show | display inheritance
interfaces {
at-0/0/0 {
##
## "atm-options" was inherited from group "atm-options"
##
atm-options {
##
## "1024" was inherited from group "atm-options"
##
vpi 0 maximum-vcs 1024;
}
unit 100 {
##
## "atm-snap" was inherited from group "atm-options"
##
encapsulation atm-snap;
##
## "point-to-point" was inherited from group "atm-options"
##
point-to-point;
vci 0.100;
family inet {
address 10.0.0.100/30;
}
##
## "iso" was inherited from group "atm-options"
##
family iso;
}
unit 200 {
##
## "atm-snap" was inherited from group "atm-options"
##
encapsulation atm-snap;
##
## "point-to-point" was inherited from group "atm-options"
##
point-to-point;
vci 0.200;
family inet {
address 10.0.0.200/30;
}
##
## "iso" was inherited from group "atm-options"
##
family iso;
}
}
}
[edit]
user@host# show | display inheritance | except ##
interfaces {
at-0/0/0 {
atm-options {
vpi 0 maximum-vcs 1024;
}
unit 100 {
encapsulation atm-snap;
point-to-point;
vci 0.100;
family inet {
address 10.0.0.100/30;
}
family iso;
}
unit 200 {
encapsulation atm-snap;
point-to-point;
vci 0.200;
family inet {
address 10.0.0.200/30;
}
family iso;
}
}
}
• Interface Naming Conventions Used in the Junos OS Operational Commands on page 165
• Example: Configuring a Consistent IP Address for the Management Interface on page 152
On routers with multiple Routing Engines, each Routing Engine is configured with a
separate IP address for the management interface (fxp0). To access the master Routing
Engine, you must know which Routing Engine is active and use the appropriate IP address.
Optionally, for consistent access to the master Routing Engine, you can configure an
additional IP address and use this address for the management interface regardless of
which Routing Engine is active. This additional IP address is active only on the
management interface for the master Routing Engine. During switchover, the address
moves to the new master Routing Engine.
In the following example, address 10.17.40.131 is configured for both Routing Engines and
includes a master-only statement. With this configuration, the 10.17.40.131 address is
active only on the master Routing Engine. The address remains consistent regardless of
which Routing Engine is active. Address 10.17.40.132 is assigned to fxp0 on re0, and
10.17.40.133 is assigned to fxp0 on re1.
This feature is available on all routers that include dual Routing Engines. On a routing
matrix composed of the TX Matrix router, this feature is applicable to the switch-card
chassis (SCC) only. Likewise, on a routing matrix composed of a TX Matrix Plus router,
this feature is applicable to the switch-fabric chassis (SFC) only.
NOTE:
• If you configure the same IP address for a management interface or internal
interface such as fxp0 and an external physical interface such as ge-0/0/1,
when graceful Routing Engine switchover (GRES) is enabled, the CLI
displays an appropriate commit error message that identical addresses
have been found on the private and public interfaces. In such cases, you
must assign unique IP addresses for the two interfaces that have duplicate
addresses.
• The management Ethernet interface used for the TX Matrix Plus router,
T1600 routers in a routing matrix, and PTX Series Packet Transport
Switches, is em0. Junos OS automatically creates the router’s management
Ethernet interface, em0.
In this example, we create a group some-isp that contains configuration data relating to
another Internet service provider (ISP). We can then insert apply-group statements at
any point to allow any location in the configuration hierarchy to inherit this data.
[edit]
user@host# show
groups {
some-isp {
interfaces {
<xe-*> {
gigether-options {
flow-control;
}
}
}
protocols {
bgp {
group <*> {
neighbor <*> {
remove-private;
}
}
}
pim {
interface <*> {
version 1;
}
}
}
}
}
interfaces {
xe-0/0/0 {
apply-groups some-isp;
unit 0 {
family inet {
address 10.0.0.1/24;
}
}
}
}
protocols {
bgp {
group main {
neighbor 10.254.0.1 {
apply-groups some-isp;
}
}
}
pim {
interface xe-0/0/0.0 {
apply-groups some-isp;
}
}
}
[edit]
user@host# show | display inheritance
interfaces {
xe-0/0/0 {
##
## "gigether-options" was inherited from group "some-isp"
##
gigether-options {
##
## "flow-control" was inherited from group "some-isp"
##
flow-control;
}
unit 0 {
family inet {
address 10.0.0.1/24;
}
}
}
}
protocols {
bgp {
group main {
neighbor 10.254.0.1 {
##
## "remove-private" was inherited from group "some-isp"
##
remove-private;
}
}
}
pim {
interface xe-0/0/0.0 {
##
## "1" was inherited from group "some-isp"
##
version 1;
}
}
}
In this example, one group is populated with configuration data that is standard
throughout the company, while another group contains regional deviations from this
standard:
[edit]
user@host# show
groups {
standard {
interfaces {
<t3-*> {
t3-options {
compatibility-mode larscom subrate 10;
idle-cycle-flag ones;
}
}
}
}
northwest {
interfaces {
<t3-*> {
t3-options {
long-buildout;
compatibility-mode kentrox;
}
}
}
}
}
apply-groups standard;
interfaces {
t3-0/0/0 {
apply-groups northwest;
}
}
[edit]
user@host# show | display inheritance
interfaces {
t3-0/0/0 {
##
## "t3-options" was inherited from group "northwest"
##
t3-options {
##
## "long-buildout" was inherited from group "northwest"
##
long-buildout;
##
## "kentrox" was inherited from group "northwest"
##
compatibility-mode kentrox;
##
## "ones" was inherited from group "standard"
##
idle-cycle-flag ones;
}
}
}
You can combine wildcarding and thoughtful use of names in statements to tailor
statement values:
[edit]
user@host# show
groups {
mpls-conf {
protocols {
mpls {
label-switched-path <*-major> {
retry-timer 5;
bandwidth 155m;
optimize-timer 60;
}
label-switched-path <*-minor> {
retry-timer 15;
bandwidth 64k;
optimize-timer 120;
}
}
}
}
}
apply-groups mpls-conf;
protocols {
mpls {
label-switched-path metro-major {
to 10.0.0.10;
}
label-switched-path remote-minor {
to 10.0.0.20;
}
}
}
[edit]
user@host# show | display inheritance
protocols {
mpls {
label-switched-path metro-major {
to 10.0.0.10;
##
## "5" was inherited from group "mpls-conf"
##
retry-timer 5;
## "155m" was inherited from group "mpls-conf"
##
bandwidth 155m;
##
## "60" was inherited from group "mpls-conf"
##
optimize-timer 60;
}
label-switched-path remote-minor {
to 10.0.0.20;
##
## "15" was inherited from group "mpls-conf"
##
retry-timer 15;
##
## "64k" was inherited from group "mpls-conf"
##
bandwidth 64k;
##
## "120" was inherited from group "mpls-conf"
##
optimize-timer 120;
}
}
}
To view the full set of available preset statements from the Junos defaults group, issue
the show groups junos-defaults configuration mode command at the top level of the
configuration. The following example displays a partial list of Junos defaults groups:
To reference statements available from the junos-defaults group, include the selected
junos- default-name statement at the applicable hierarchy level.
• Example: Viewing Default Statements That Have Been Applied to the Configuration
on page 159
Example: Referencing the Preset Statement From the Junos defaults Group
The following example is a preset statement from the Junos defaults group that is
available for FTP in a stateful firewall:
[edit]
groups {
junos-defaults {
applications {
application junos-ftp {# Use FTP default configuration
application-protocol ftp;
protocol tcp;
destination-port 21;
}
}
}
To reference a preset Junos default statement from the Junos defaults group, include
the junos-default-name statement at the applicable hierarchy level. For example, to
reference the Junos default statement for FTP in a stateful firewall, include the junos-ftp
statement at the [edit services stateful-firewall rule my-rule term my-term from
applications] hierarchy level:
[edit]
services {
stateful-firewall {
rule my-rule {
term my-term {
from {
applications junos-ftp; #Reference predefined statement, junos-ftp
}
}
}
}
}
Related • Example: Viewing Default Statements That Have Been Applied to the Configuration
Documentation on page 159
Example: Viewing Default Statements That Have Been Applied to the Configuration
To view the Junos defaults that have been applied to the configuration, issue the show
| display inheritance defaults command. For example, to view the inherited Junos defaults
at the [edit system ports] hierarchy level:
If you choose not to use existing Junos default statements, you can create your own
configuration groups manually.
To view the complete configuration information without the comments marked with ##,
use the no-comments option with the display inheritance command.
[edit]
user@host# edit protocols
List all commands that start with a particular letter or string:
[edit]
user@host# edit routing-options a
List all configured Asynchronous Transfer Mode (ATM) interfaces:
[edit]
user@host# edit interfaces at?
<interface_name> Interface name
at-0/2/0 Interface name
at-0/2/1 Interface name
[edit]
user@host# edit interfaces at
Possible completions:
<policy_name> Name to identify a policy filter
[edit]
user@host# show policy-options policy-statement
Related • Examples: Using the Junos OS CLI Command Completion on page 163
Documentation
• Displaying the Junos OS CLI Command and Word History on page 163
The following examples show how you can use the command completion feature in
Junos OS. Issue the show interfaces command:
user@host>
Display a list of all log files whose names start with the string “messages,” and then
display the contents of one of the files:
Related • Displaying the Junos OS CLI Command and Word History on page 163
Documentation
To display a list of recent commands that you issued, use the show cli history command:
You can press Esc+. (period) or Alt+. (period) to insert the last word of the previous
command. Repeat Esc+. or Alt+. to scroll backwards through the list of recently entered
words. For example:
user@host> <Esc>
user@host> fe-0/0/0
If you scroll completely to the beginning of the list, pressing Esc+. or Alt+. again restarts
scrolling from the last word entered.
• Interface Naming Conventions Used in the Junos OS Operational Commands on page 165
This topic explains the interface naming conventions used in the Junos OS operational
commands, and contains the following sections:
• On J Series and SRX devices, the unique name of each network interface has the
following format to identify the physical device that corresponds to a single physical
network connector:
type-slot/pim-or-ioc/port
• On other platforms, when you display information about an interface, you specify the
interface type, the slot in which the Flexible PIC Concentrator (FPC) is installed, the
slot on the FPC in which the PIC is located, and the configured port number.
In the physical part of the interface name, a hyphen (-) separates the media type from
the FPC number, and a slash (/) separates the FPC, PIC, and port numbers:
type-fpc/pic/port
type-slot/pim-or-ioc/port:channel.unit
• Other platforms:
type-fpc/pic/port.logical
A colon (:) separates the physical and virtual parts of the interface name:
type-slot/pim-or-ioc/port:channel
type-slot/pim-or-ioc/port:channel:channel
type-slot/pim-or-ioc/port:channel:channel:channel
• Other platforms:
type-fpc/pic/port:channel
type-fpc//pic/port:channel:channel
type-fpc/pic/port:channel:channel:channel
Related • Example: Configuring Interfaces Using Junos OS Configuration Groups on page 149
Documentation
• Junos® OS Network Interfaces
If, when you enter configuration mode, another user is also in configuration mode, a
message shows who the user is and what part of the configuration that user is viewing
or editing:
user@host> configure
Entering configuration mode
Current configuration users:
root terminal p3 (pid 1088) on since 1999-05-13 01:03:27 EDT
[edit interfaces so-3/0/0 unit 0 family inet]
The configuration has been changed but not committed
[edit]
user@host#
If, when you enter configuration mode, the configuration contains changes that have not
been committed, a message appears:
user@host> configure
Entering configuration mode
The configuration has been changed but not committed
[edit]
user@host#
The following example shows you how to change the default CLI environment:
Related • Setting the Junos OS CLI Screen Length and Width on page 256
Documentation
• Controlling the Junos OS CLI Environment on page 251
The following example shows how you can use the \n back reference to replace a pattern:
[edit]
user@host# show interfaces
xe-0/0/0 {
unit 0;
}
fe-3/0/1 {
vlan-tagging;
unit 0 {
description "inet6 configuration. IP: 2000::c0a8::1bf5";
vlan-id 100;
family inet {
address 17.10.1.1/24;
}
family inet6 {
address 2000::c0a8:1bf5/3;
}
}
}
[edit]
user@host# replace pattern "(.*):1bf5" with "\11bf5"
[edit]
user@host# show interfaces
xe-0/0/0 {
unit 0;
}
fe-3/0/1 {
vlan-tagging;
unit 0 {
description "inet6 configuration. IP: 2000::c0a8:1bf5";
vlan-id 100;
family inet {
address 17.10.1.1/24;
}
family inet6 {
address 2000::c0a8:1bf5/3;
}
}
}
The following example shows how you can replace an interface name in a configuration:
[edit]
user@host# show
protocols {
ospf {
area 0.0.0.0 {
interface so-0/0/0 {
hello-interval 5;
}
}
}
}
[edit]
user@host# replace so-0/0/0 with so-1/1/0
[edit]
user@host# show
protocols {
ospf {
area 0.0.0.0 {
interface so-1/1/0 {
hello-interval 5;
}
}
}
}
Related • Example: Using Global Replace in a Junos Configuration—Using the upto Option on
Documentation page 173
Consider the hierarchy shown in Figure 13 on page 173. The text string 010101 appears in
three places: the description sections of ge-0/0/0, ge-0/0/0.0, and fe-0/0/1. These three
instances are three objects. The following example shows how you can use the upto
option to perform replacements in a JUNOS configuration:
An upto 2 option in the replace command converts 01 to 02 for two object instances. The
objects under the main interfaces ge-0/0/0 and fe-0/0/1 will be replaced first (since
these are siblings in the hierarchy level). Because of the upto 2 restriction, the replace
command replaces patterns in the first and second instance in the hierarchy (siblings),
but not the third instance (child of the first instance).
instance)
unit 0 {
family inet {
address 200.200.20.2/24;
}
}
}
[edit]
user@host# replace pattern 01 with 02 upto 2
[edit]
user@host# commit
commit complete
[edit]
user@host# show interfaces
ge-0/0/0 {
description "mkt 020202"; #First instance in the hierarchy
unit 0 {
description "mkt 010101"; #Third instance in the hierarchy (child of the first
instance)
}
}
fe-0/0/1 {
description "mkt 020202"; #second instance in the hierarchy (sibling of the first
instance)
unit 0 {
family inet {
address 200.200.20.2/24;
}
}
}
The output of show configuration operational mode command and show configuration
mode commands can be configured to display configuration breadcrumbs that indicate
the exact location in the hierarchy of the output being viewed.
Before enabling the configuration breadcrumbs feature, check the output of the show
configuration command.
...
}
}
}
}
}
fe-4/1/2 {
description "FA4/1/2: mxxj1-mr6 (64.12.137.160/27) (T=bblan, bbmail,
bbowmtc)";
unit 0 {
family inet {
filter {
output 151mj;
}
address 64.12.137.187/27 {
vrrp-group 1 {
virtual-address 64.12.137.189;
---(more 18%)-----------------------------------------------------
In the output, there is no clear indication about the section of the configuration being
viewed.
2. Add a user to the defined login class to enable the breadcrumbs output view when
this user enters the show configuration operational mode command.
[edit]
user@host# commit
On enabling configuration breadcrumbs in the CLI, User1 (the user added to the login
class) can verify the feature in the output by entering the show configuration command.
...
}
}
}
}
}
fe-4/1/2 {
description "FA4/1/2: mxxj1-mr6 (64.12.137.160/27) (T=bblan, bbmail,
bbowmtc)";
unit 0 {
family inet {
filter {
output 151mj;
}
address 64.12.137.187/27 {
vrrp-group 1 {
virtual-address 64.12.137.189;
---(more 18%)---[groups main interfaces fe-4/1/2 unit 0 family inet address
64.12.137.187/27 vrrp-group 1]---
The new output indicates the exact location of the configuration hierarchy being
viewed. User1 is currently viewing the interface configuration of a group.
NOTE: If you are enabling configuration breadcrumbs for your own user
account, you should log out and log in again to see the changes.
Related • class
Documentation
• configuration-breadcrumbs on page 189
• save
• server (Batch Commits) on page 208
• set
• show
• show configuration
• show | display inheritance
• show | display omit
• show | display set
• show | display set relative
• show groups junos-defaults
• status
• top
• traceoptions (Batch Commits) on page 221
• unprotect
• up
• update
• when on page 225
• wildcard delete
apply-groups
You can specify more than one group name. You must list them in order of inheritance
priority. The configuration data in the first group takes priority over the data in subsequent
groups.
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
apply-groups-except
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
groups
Syntax groups {
group-name {
configuration-data;
when {
chassis chassis-id;
member member-id;
model model-id;
node node-id;
routing-engine routing-engine-id;
time <start-time> [to <end-time>];
}
conditional-data;
}
lccn-re0 {
configuration-data;
}
lccn-re1 {
configuration-data;
}
}
Options —
On routers that support multiple Routing Engines, you can also specify two special
group names:
The configuration specified in group re0 is applied only if the current Routing Engine
is in slot 0; likewise, the configuration specified in group re1 is applied only if the
current Routing Engine is in slot 1. Therefore, both Routing Engines can use the same
configuration file, each using only the configuration statements that apply to it. Each
re0 or re1 group contains at a minimum the configuration for the hostname and the
(Routing matrix only) The TX Matrix router supports group names for the Routing
Engines in each connected T640 router in the following formats:
NOTE: The management Ethernet interface used for the TX Matrix Plus
router, T1600 routers in a routing matrix, and PTX Series Packet Transport
Switches, is em0. Junos OS automatically creates the router’s
management Ethernet interface, em0.
activate
Description Remove the inactive: tag from a statement, effectively adding the statement or identifier
back to the configuration. Statements or identifiers that have been activated take effect
when you next issue the commit command.
Options identifier—Identifier from which you are removing the inactive tag. It must be an identifier
at the current hierarchy level.
statement—Statement from which you are removing the inactive tag. It must be a
statement at the current hierarchy level.
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
annotate
Description Add comments to a configuration. You can add comments only at the current hierarchy
level.
Any comments you add appear only when you view the configuration by entering the
show command in configuration mode or the show configuration command in operational
mode.
[edit protocols]
isis {
interface ge-0/0/0.0 {
level 1 metric 10;
}
}
}
Options comment-string—Text of the comment. You must enclose it in quotation marks. In the
comment string, you can include the comment delimiters /* */ or #. If you do not specify
any, the comment string is enclosed with the /* */ comment delimiters. If a comment
for the specified statement already exists, it is deleted and replaced with the new
comment.
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
commit
Description Commit the set of changes to the database and cause the changes to take operational
effect.
string is reboot or the future time to activate the configuration changes. Enclose the string
value (including reboot) in quotation marks (“ ”). You can specify time in two formats:
• A time value in the form hh:mm[:ss] (hours, minutes, and optionally seconds)— Commit
the configuration at the specified time, which must be in the future but before 11:59:59
PM on the day the commit at configuration command is issued. Use 24-hour time for
the hh value; for example, 04:30:00 is 4:30:00 AM, and 20:00 is 8:00 PM. The time is
interpreted with respect to the clock and time zone settings on the router.
• A date and time value in the form yyyy-mm-dd hh:mm[:ss] (year, month, date, hours,
minutes, and, optionally, seconds)—Commit the configuration at the specified day and
time, which must be after the commit at command is issued. Use 24-hour time for the
hh value. For example, 2003-08-21 12:30:00 is 12:30 PM on August 21, 2003. The time
is interpreted with respect to the clock and time zone settings on the router.
For example, commit at “18:00:00". For date and time, include both values in the same
set of quotation marks. For example, commit at "2005-03-10 14:00:00".
A commit check is performed when you issue the commit at configuration mode command.
If the result of the check is successful, then the current user is logged out of configuration
mode, and the configuration data is left in a read-only state. No other commit can be
performed until the scheduled commit is completed.
NOTE: If Junos OS fails before the configuration changes become active, all
configuration changes are lost.
You cannot enter the request system reboot command once you schedule a
commit operation for a specific time in the future.
check—(Optional) Verify the syntax of the configuration, but do not activate it.
In Junos OS Release 11.4 and later, you can also use the commit confirmed command in
the [edit private] configuration mode.
NOTE: In Junos OS Release 10.4 and later, if the number of commit details
or messages exceeds a page when used with the | display detail pipe option,
the more pagination option on the screen is no longer available. Instead, the
messages roll up on the screen by default, just like using the commit command
with the | no more pipe option.
synchronize <force>—(Optional) If your router has two Routing Engines, you can manually
direct one Routing Engine to synchronize its configuration with the other by issuing the
commit synchronize command. The Routing Engine on which you execute this command
(request Routing Engine) copies and loads its candidate configuration to the other
(responding Routing Engine). Both Routing Engines then perform a syntax check on the
candidate configuration file being committed. If no errors are found, the configuration is
activated and becomes the current operational configuration on both Routing Engines.
The commit synchronize command does not work if the responding Routing Engine has
uncommitted configuration changes. However, you can enforce commit synchronization
on the Routing Engines by using the force option. When you issue the commit synchronize
command with the force option from one Routing Engine, the configuration sessions on
the other Routing Engine is terminated and its configuration synchronized with that on
the Routing Engine from which you issued the command.
NOTE: When you issue the commit synchronize command, you must use the
apply-groups re0 and re1 commands. For information about how to use groups,
see “Disabling Inheritance of a Junos OS Configuration Group” on page 141.
The responding Routing Engine must use Junos OS Release 5.0 or later.
load merge
load replace
load override
load update
For more information, see the Secure Configuration Guide for Common Criteria
and Junos-FIPS
Sample Output
commit | display detail (QFX Series)
user@host> commit | display detail
--------------
2011-08-24 01:08:08.00691 PDT: begin creating snapshots
2011-08-24 01:08:09.00210 PDT: end creating snapshots
2011-08-24 01:08:09.00211 PDT: begin preparing metadata
2011-08-24 01:08:09.00228 PDT: end preparing metadata
2011-08-24 01:08:09.00229 PDT: begin computing dcf root changes
2011-08-24 01:08:09.00236 PDT: end computing dcf root changes
2011-08-24 01:08:09.00244 PDT: begin computing additions
2011-08-24 01:08:09.00251 PDT: end computing additions
2011-08-24 01:08:09.00251 PDT: begin local object validation
2011-08-24 01:08:09.00251 PDT: end local object validation
2011-08-24 01:08:09.00252 PDT: begin update instances
2011-08-24 01:08:09.00252 PDT: end update instances
2011-08-24 01:08:09.00252 PDT: begin adjust metadata
2011-08-24 01:08:09.00252 PDT: end adjust metadata
2011-08-24 01:08:09.00253 PDT: begin validate metadata
2011-08-24 01:08:09.00253 PDT: end validate metadata
2011-08-24 01:08:09.00253 PDT: begin adjust allocations
2011-08-24 01:08:09.00254 PDT: end adjust allocations
2011-08-24 01:08:09.00254 PDT: begin adjust dependencies
2011-08-24 01:08:09.00254 PDT: end adjust dependencies
2011-08-24 01:08:09.00255 PDT: begin instance validation
2011-08-24 01:08:09.00255 PDT: end instance validation
2011-08-24 01:08:09.00255 PDT: begin opening all sessions eagerly
2011-08-24 01:08:09.00277 PDT: begin request #1 [login]
2011-08-24 01:08:09.00278 PDT: end request #1 [login]
2011-08-24 01:08:09.00325 PDT: begin processing globals
2011-08-24 01:08:09.00330 PDT: begin waiting for stamp check
(qfabric-default---node0)
2011-08-24 01:08:09.00334 PDT: end reply #1 [login]
2011-08-24 01:08:09.00351 PDT: end reply #1 [login]
2011-08-24 01:08:09.00451 PDT: begin request #2 [open]
2011-08-24 01:08:09.00451 PDT: end request #2 [open]
2011-08-24 01:08:09.00451 PDT: begin request #3 [get commit history]
2011-08-24 01:08:09.00452 PDT: end request #3 [get commit history]
2011-08-24 01:08:09.00452 PDT: begin request #4 [load]
2011-08-24 01:08:09.00453 PDT: end request #4 [load]
2011-08-24 01:08:09.00453 PDT: begin request #5 [load]
2011-08-24 01:08:09.00454 PDT: begin reply #2 [open]
2011-08-24 01:08:09.00456 PDT: end reply #2 [open]
2011-08-24 01:08:09.00457 PDT: begin reply #3 [get commit history]
2011-08-24 01:08:09.00475 PDT: end reply #3 [get commit history]
2011-08-24 01:08:09.00476 PDT: begin reply #4 [load]
2011-08-24 01:08:09.00499 PDT: begin reply #5 [load]
2011-08-24 01:08:09.00501 PDT: end waiting for stamp check
(qfabric-default---node0)
2011-08-24 01:08:09.00501 PDT: begin waiting for open (qfabric-default---node0)
2011-08-24 01:08:09.00502 PDT: end waiting for open (qfabric-default---node0)
2011-08-24 01:08:09.00504 PDT: end processing globals
2011-08-24 01:08:09.00617 PDT: end request #5 [load]
2011-08-24 01:08:09.00617 PDT: begin request #6 [check]
2011-08-24 01:08:09.00617 PDT: end request #6 [check]
2011-08-24 01:08:09.00619 PDT: end reply #5 [load]
2011-08-24 01:08:09.00619 PDT: begin reply #6 [check]
2011-08-24 01:08:09.00730 PDT: end session
2011-08-24 01:08:09.00752 PDT: end request #5 [load]
Description For Junos OS batch commits, specify the time interval (in seconds) between two commit
operations.
configuration-breadcrumbs
Syntax configuration-breadcrumbs;
Description Enable the configuration breadcrumbs view in the CLI to display the location in the
configuration hierarchy.
• class
• login
copy
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
Description For Junos OS batch commits, specify the number of days to keep the error logs.
deactivate
Description Add the inactive: tag to a statement, effectively commenting out the statement or
identifier from the configuration. Statements or identifiers marked as inactive do not take
effect when you issue the commit command.
Options identifier—Identifier to which you are adding the inactive: tag. It must be an identifier at
the current hierarchy level.
statement—Statement to which you are adding the inactive: tag. It must be a statement
at the current hierarchy level.
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
delete
Description Delete a statement or identifier. All subordinate statements and identifiers contained
within the specified statement path are deleted with it.
If you do not specify statement-path or identifier, the entire hierarchy, starting at the current
hierarchy level, is removed.
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
edit
Description Move inside the specified statement hierarchy. If the statement does not exist, it is created.
You cannot use the edit command to change the value of identifiers. You must use the
set command.
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
exit
Description Exit the current level of the statement hierarchy, returning to the level prior to the last
edit command, or exit from configuration mode. The quit and exit commands are
synonyms.
Options none—Return to the previous edit level. If you are at the top of the statement hierarchy,
exit configuration mode.
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
help
Description Display help about available configuration statements or general information about
getting help.
Options apropos string—(Optional) Display statement names and help text that matches the
string specified. If the string contains spaces, enclose it in quotation marks (" "). You can
also specify a regular expression for the string, using standard UNIX-style regular
expression syntax.
tip cli number—(Optional) Display a tip about using the CLI. Specify the number of the
tip you want to view.
Entering the help command without an option provides introductory information about
how to use the help command.
Related • Getting Online Help from the Junos OS Command-Line Interface on page 9
Documentation
insert
identifier1—Existing identifier.
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
load
Description Load a configuration from an ASCII configuration file, from terminal input, or from the
factory default. Your current location in the configuration hierarchy is ignored when the
load operation occurs.
On J Series Services Routers, pressing and holding down the Config button on the router
for 15 seconds causes the factory configuration to be loaded and committed. However,
this operation deletes all other configurations on the router; using the load factory-default
command does not.
filename—Name of the file to load. For information about specifying the filename, see
“Specifying Filenames and URLs” on page 240.
merge—Combine the configuration that is currently shown in the CLI with the configuration.
override—Discard the entire configuration that is currently shown in the CLI and load the
entire configuration. Marks every object as changed.
patch—Change part of the configuration and mark only those parts as changed.
replace—Look for a replace tag in filename, delete the existing statement of the same
name, and replace it with the configuration.
set—Merge a set of commands with an existing configuration. This option executes the
configuration instructions line by line as they are stored in a file or from a terminal. The
instructions can contain any configuration mode command, such as set, edit, exit, and
top.
relative—(Optional) Use the merge or replace option without specifying the full hierarchy
level.
terminal—Use the text you type at the terminal as input to the configuration. Type Ctrl+d
to end terminal input.
update—Discard the entire configuration that is currently shown in the CLI, and load the
entire configuration. Marks changed objects only.
load merge
load replace
load override
load update
For more information, see the Secure Configuration Guide for Common Criteria
and Junos-FIPS .
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
Description For Junos OS batch commits, specify the maximum number of individual commit
operations that are aggregated or merged into a single commit operation.
Description For Junos OS batch commits, specify the maximum number of commit jobs that are
included in the commit queue.
Options number-of-entries—Maximum number of commit jobs that are included in the commit
queue.
protect
Options none
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
quit
Description Exit the current level of the statement hierarchy, returning to the level prior to the last
edit command, or exit from configuration mode. The quit and exit commands are
synonyms.
Options none—Return to the previous edit level. If you are at the top of the statement hierarchy,
exit configuration mode.
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
rename
logical-systems {
logical-system-abc {
(...)
protocols {
ospf {
area 0.0.0.0 {
interface ge-0/1/0.0;
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
rename
logical-systems {
logical-system-abc {
(...)
protocols {
ospf {
area 0.0.0.0 {
interface ge-0/1/0.0;
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
replace
Options pattern1—Text string or regular expression that defines the identifiers or values you want
to match.
pattern2—Text string or regular expression that replaces the identifiers and values located
with pattern1.
Juniper Networks uses standard UNIX-style regular expression syntax (as defined in
POSIX 1003.2). If the regular expression contains spaces, operators, or wildcard characters,
enclose the expression in quotation marks. Greedy qualifiers (match as much as possible)
are supported. Lazy qualifiers (match as little as possible) are not.
upto n—Number of objects replaced. The value of n controls the total number of objects
that are replaced in the configuration (not the total number of times the pattern occurs).
Objects at the same hierarchy level (siblings) are replaced first. Multiple occurrences of
a pattern within a given object are considered a single replacement. If you do not specify
an upto option, all identifiers and values in the configuration that match pattern1 are
replaced.
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
rollback
Description Return to a previously committed configuration. The software saves the last 50 committed
configurations, including the rollback number, date, time, and name of the user who
issued the commit configuration command.
The currently operational Junos OS configuration is stored in the file juniper.conf, and the
last three committed configurations are stored in the files juniper.conf.1, juniper.conf.2,
and juniper.conf.3. These four files are located in the directory /config, which is on the
router’s flash drive. The remaining 46 previous committed configurations, the files
juniper.conf.4 through juniper.conf.49, are stored in the directory /var/db/config, which
is on the router’s hard disk.
During rollback, the configuration you specify is loaded from the associated file. Only
objects in the rollback configuration that differ from the previously loaded configuration
are marked as changed (equivalent to load update).
number—(Optional) Configuration to return to. The range of values is from 0 through 49.
The most recently saved configuration is number 0, and the oldest saved configuration
is number 49. The default is 0.
Required Privilege rollback—To roll back to configurations other than the one most recently committed.
Level
run
Description Run a top-level CLI command without exiting from configuration mode.
save
Description Save the configuration to an ASCII file. The contents of the current level of the statement
hierarchy (and below) are saved, along with the statement hierarchy containing it. This
allows a section of the configuration to be saved, while fully specifying the statement
hierarchy.
When saving a file to a remote system, the software uses the scp/ssh protocol.
Options filename—Name of the saved file. You can specify a filename in one of the following ways:
• filename—File in the user’s home directory (the current directory) on the local flash
drive.
• a:filename or a:path/filename—File on the local drive. The default path is / (the root-level
directory). The removable media can be in MS-DOS or UNIX (UFS) format.
Syntax server {
commit-interval <number-of-seconds-between-commits>;
days-to-keep-error-logs <days-to-keep-error-log-entries>;
maximum-aggregate-pool <maximum-number-of-commits-to-aggregate>;
maximum-entries <number-of-entries>;
traceoptions {
file filename;
files number;
flag (all | batch | commit-server | configuration);
size maximum-file-size;
(world-readable | no-world-readable);
}
}
Description For Junos OS batch commits, configure the batch commit server properties.
set
Description Create a statement hierarchy and set identifier values. This is similar to edit except that
your current level in the hierarchy does not change.
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
show
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
show configuration
Description Display the configuration that currently is running on the router or switch, which is the
last committed configuration.
• chassis—Chassis configuration.
• class-of-service—Class-of-service configuration.
• firewall—Firewall configuration.
• groups—Configuration groups.
• interfaces—Interface configuration.
• security—Security configuration.
Additional Information The portions of the configuration that you can view depend on the user class that you
belong to and the corresponding permissions. If you do not have permission to view a
portion of the configuration, the text ACCESS-DENIED is substituted for that portion of
the configuration. If you do not have permission to view authentication keys and passwords
in the configuration, because the secret permission bit is not set for your user account,
the text SECRET-DATA is substituted for that portion of the configuration. If an identifier
in the configuration contains a space, the identifier is displayed in quotation marks.
Likewise, 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.
Output Fields This command displays information about the current running configuration.
Sample Output
show configuration
user@host> show configuration
## Last commit: 2006-10-31 14:13:00 PST by alant version "8.2I0 [builder]"; ##
last changed: 2006-10-31 14:05:53 PST
system {
host-name nestor;
domain-name east.net;
backup-router 192.1.1.254;
time-zone America/Los_Angeles;
default-address-selection;
name-server {
192.154.169.254;
192.154.169.249;
192.154.169.176;
}
services {
telnet;
}
tacplus-server {
1.2.3.4 {
secret /* SECRET-DATA */;
...
}
}
}
interfaces {
...
}
protocols {
isis {
export "direct routes";
}
}
policy-options {
policy-statement "direct routes" {
from protocol direct;
then accept;
}
}
Description Show the inherited configuration data and information about the source group from
which the configuration has been inherited. Show interface ranges configuration data in
expanded format and information about the source interface-range from which the
configuration has been expanded
• defaults—Display the Junos OS defaults that have been applied to the configuration.
Description Display configuration statements (including those marked as hidden by the apply-flags
omit configuration statement).
Description Display the full set of available preset statements from the Junos OS defaults group.
status
Syntax status
top
Description Return to the top level of configuration command mode, which is indicated by the [edit]
banner.
• up on page 223
Syntax traceoptions {
file filename;
files number;
flag (all | batch | commit-server | configuration);
size maximum-file-size;
(world-readable | no-world-readable);
}
Options file name—Name of the file to receive the output of the tracing operation.
flag flag—Tracing operation to perform. To specify more than one tracing operation,
include multiple flag statements. You can include the following flags:
• all—All tracing operations flags.
size—Maximum size of each trace file, in kilobytes (KB), megabytes (MB), or gigabytes
(GB).
unprotect
Options none
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
up
update
Syntax update
Description Update private candidate configuration with a copy of the most recently committed
configuration, including your private changes.
NOTE: The update command is available only when you are in configure
private mode.
when
Syntax when {
chassis chassis-id;
member member-id;
model model-id;
node node-id;
routing-engine routing-engine-id;
time <start-time> [to <end-time>];
}
Description Define conditions under which the configuration group should be applied. Conditions
include the type of chassis, model, or Routing Engine, virtual chassis member, cluster
node, and start and optional end time of day. If you specify multiple conditions in a single
configuration group, all conditions must be met before the configuration group is applied.
Options chassis chassis-id—Specify the chassis type of the router. Valid types include SCC0, SCC1,
LCC0, LCC1 ... LCC3.
model model-id—Specify the model name of the router, such as m7i or tx100.
time <start-time> [to <end-time>]—Specify the start time or time duration for this
configuration group to be applied. If only the start time is specified, the configuration
group is applied at the specified time and remains in effect until the time is changed.
If the end time is specified, then on each day, the applied configuration group is
started and stopped at the specified times. The syntax for specifying the time is:
time <start-time> [to <end-time>] using the time format yyyy-mm-dd.hh:mm, hh:mm,
or hh.
wildcard delete
Description Delete a statement or identifier. All subordinate statements and identifiers contained
within the specified statement path are deleted with it.
If you do not specify statement-path or identifier, the entire hierarchy starting at the current
hierarchy level is removed.
Required Privilege configure—To enter configuration mode. Other required privilege levels depend on where
Level the statement is located in the configuration hierarchy.
Related • Example: Using Global Replace in a Junos Configuration—Using the upto Option on
Documentation page 173.
Administration
• Routine Monitoring on page 229
• Managing the CLI Environment on page 251
• CLI Advanced Features Reference on page 259
• Junos OS CLI Environment Commands on page 261
• Junos OS CLI Operational Mode Commands on page 277
Routine Monitoring
You can use show commands to check the status of the device and monitor the activities
on the device.
• Type show ? to display the list of show commands you can use to monitor the router:
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
• Use the show chassis routing-engine command to view the Routing Engine status:
• Use the show system storage command to view available storage on the device:
Related • Displaying the Junos OS CLI Command and Word History on page 163
Documentation
• Managing Programs and Processes Using Junos OS Operational Mode Commands on
page 243
This topic provides a sample configuration that describes how to configure an OSPF
backbone area that has two SONET interfaces.
[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;
}
}
}
}
Shortcut
You can create a shortcut for this entire configuration with the following two commands:
[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
Longer Configuration
This section provides a longer example of creating the previous OSPF configuration. In
the process, it illustrates how to use the different features of the CLI.
user@host> configure
entering configuration mode
[edit]
user@host#
Notice that the prompt has changed to a pound sign (#) to indicate configuration
mode.
2. To create the above configuration, you start by editing the protocols ospf statements:
[edit]
user@host# edit protocols ospf
[edit protocols ospf]
user@host#
7. You are finished at this level, so back up a level and take a look at what you have so
far:
The interface statement appears because you have moved to the area statement.
[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. Before committing the configuration (and thereby activating it), verify that the
configuration is correct:
[edit]
user@host# commit check
configuration check succeeds
[edit]
user@host#
[edit]
user@host# commit
commit complete
[edit]
user@host#
1. Go directly to the appropriate hierarchy level by typing the full hierarchy path to the
statement you want to edit:
[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. If you decide not to run OSPF on the first interface, delete the statement:
[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#
Everything inside the statement you deleted was deleted with it. You can also eliminate
the entire OSPF configuration by simply entering delete protocols ospf while at the
top level.
3. If you decide to use the default values for the hello and dead intervals on your remaining
interface but you want OSPF to run on that interface, delete the hello and dead interval
timers:
[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
You can set multiple statements at the same time as long as they are all part of the
same hierarchy (the path of statements from the top inward, as well as one or more
statements at the bottom of the hierarchy). This feature can reduce considerably the
number of commands you must enter.
4. To go back to the original hello and dead interval timers on interface so-0/0/1, enter:
[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. You also can re-create the other interface, as you had it before, with only a single
entry:
[edit]
user@host# set protocols ospf area 0.0.0.0 interface so-0/0/1 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#
• Interface Naming Conventions Used in the Junos OS Operational Commands on page 165
Depending upon how you configure Junos OS, multiple users can log in to the router, use
the CLI, and configure or modify the software configuration.
If, when you enter configuration mode, another user is also in configuration mode, a
notification message is displayed that indicates who the user is and what portion of the
configuration the person is viewing or editing:
user@host> configure
Entering configuration mode
Users currently editing the configuration:
root terminal d0 (pid 4137) on since 2008-04-09 23:03:07 PDT, idle 7w6d 08:22
[edit]
The configuration has been changed but not committed
[edit]
user@host#
Related • Entering and Exiting the Junos OS CLI Configuration Mode on page 61
Documentation
• Controlling the Junos OS CLI Environment on page 251
Junos OS stores information in files on the device, including configuration files, log files,
and router software files. This topic shows some examples of operational commands
that you can use to view files and directories on a device running Junos OS.
Sections include:
/config This directory is located on the device’s router’s internal flash drive. It
contains the active configuration (juniper.conf) and rollback files 1, 2,
and 3.
/var/db/config This directory is located on the router’sdevice’s hard drive and contains
rollback files 4 through 49.
/var/tmp This directory is located on thedevice’s hard drive. It holds core files
from the various processes on the Routing Engines. Core files are
generated when a particular process crashes and are used by Juniper
Networks engineers to diagnose the reason for failure.
/var/log This directory is located on the device’s hard drive. It contains files
generated by both the device’s logging function as well as the
traceoptions command.
/altroot This directory is located on the device’s hard drive and contains a copy
of the root file structure from the internal flash drive. This directory is
used in certain disaster recovery modes where the internal flash drive
is not operational.
/altconfig This directory is located on the device’s hard drive and contains a copy
of the /config file structure from the internal flash drive. This directory
is also used in certain disaster recovery modes when the internal flash
drive is not operational.
user@host> 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
Help shows that the file command includes several options for manipulating files.
2. Use the list option to see the directory structure of the device. For example, to show
the files located in your home directory on the device:
The default directory for the file list command is the home directory of the user logged
in to the device. In fact, the user’s home directory is the default directory for most of
Junos OS commands requiring a filename.
3. To view the contents of other file directories, specify the directory location. For
example:
4. You can also use the device’s context-sensitive help system to locate a directory. For
example:
• filename—File in the user’s current directory on the local flash drive. You can use
wildcards to specify multiple source files or a single destination file. Wildcards are not
supported in Hypertext Transfer Protocol (HTTP) or FTP.
NOTE: Wildcards are supported only by the file (compare | copy | delete |
list | rename | show) commands. When you issue the file show command
with a wildcard, it must resolve to one filename.
• /var/filename or /var/path/filename—File on the local hard disk. You can also specify
a file on a local Routing Engine for a specific T640 router on a routing matrix:
• a:filename or a:path/filename—File on the local drive. The default path is / (the root-level
directory). The removable media can be in MS-DOS or UNIX (UFS) format.
You can display Junos OS version information and other status to determine if the version
of Junos OS that you are running supports particular features or hardware.
2. To display brief information and status for the kernel and Packet Forwarding Engine,
enter the show version brief command. This command shows version information for
Junos OS packages installed on the router. For example:
user@host>
If the Junos Crypto Software Suite is listed, the router has Canada and USA encrypted
Junos OS. If the Junos Crypto Software Suite is not listed, the router is running worldwide
nonencrypted Junos OS.
3. To display detailed version information, enter the show version detail command. This
command display shows the hostname and version information for Junos OS packages
installed on your router. It also includes the version information for each software
process. For example:
Hostname: host
Model: m20
JUNOS Base OS boot [8.4R1.13]
JUNOS Base OS Software Suite [8.4R1.13]
JUNOS Kernel Software Suite [8.4R1.13]
JUNOS Crypto Software Suite [8.4R1.13]
JUNOS Packet Forwarding Engine Support (M/T Common) [8.4R1.13]
JUNOS Packet Forwarding Engine Support (M20/M40) [8.4R1.13]
JUNOS Online Documentation [8.4R1.13]
JUNOS Routing Software Suite [8.4R1.13]
KERNEL 8.4R1.13 #0 built by builder on 2007-08-08 00:33:41 UTC
MGD release 8.4R1.13 built by builder on 2007-08-08 00:34:00 UTC
CLI release 8.4R1.13 built by builder on 2007-08-08 00:34:47 UTC
RPD release 8.4R1.13 built by builder on 2007-08-08 00:45:21 UTC
CHASSISD release 8.4R1.13 built by builder on 2007-08-08 00:36:59 UTC
DFWD release 8.4R1.13 built by builder on 2007-08-08 00:39:32 UTC
DCD release 8.4R1.13 built by builder on 2007-08-08 00:34:24 UTC
SNMPD release 8.4R1.13 built by builder on 2007-08-08 00:42:24 UTC
MIB2D release 8.4R1.13 built by builder on 2007-08-08 00:46:47 UTC
APSD release 8.4R1.13 built by builder on 2007-08-08 00:36:39 UTC
VRRPD release 8.4R1.13 built by builder on 2007-08-08 00:45:44 UTC
ALARMD release 8.4R1.13 built by builder on 2007-08-08 00:34:30 UTC
PFED release 8.4R1.13 built by builder on 2007-08-08 00:41:54 UTC
CRAFTD release 8.4R1.13 built by builder on 2007-08-08 00:39:03 UTC
SAMPLED release 8.4R1.13 built by builder on 2007-08-08 00:36:05 UTC
ILMID release 8.4R1.13 built by builder on 2007-08-08 00:36:51 UTC
RMOPD release 8.4R1.13 built by builder on 2007-08-08 00:42:04 UTC
user@host>
Related • Managing Programs and Processes Using Junos OS Operational Mode Commands on
Documentation page 243
This topic shows some examples of Junos operational commands that you can use to
manage programs and processes on a device running Junos OS.
Sections include:
2. Type the show system processes extensive command. This command shows the CPU
utilization on the device and lists the processes in order of CPU utilization. For example:
last pid: 28689; load averages: 0.01, 0.00, 0.00 up 56+06:16:13 04:52:04
73 processes: 1 running, 72 sleeping
Mem: 101M Active, 101M Inact, 98M Wired, 159M Cache, 69M Buf, 286M Free
Swap: 1536M Total, 1536M Free
PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND
3365 root 2 0 21408K 4464K select 511:23 0.00% 0.00% chassisd
3508 root 2 0 3352K 1168K select 32:45 0.00% 0.00% l2ald
3525 root 2 0 3904K 1620K select 13:40 0.00% 0.00% dcd
5532 root 2 0 11660K 2856K kqread 10:36 0.00% 0.00% rpd
3366 root 2 0 2080K 828K select 8:33 0.00% 0.00% alarmd
3529 root 2 0 2040K 428K select 7:32 0.00% 0.00% irsd
3375 root 2 0 2900K 1600K select 6:01 0.00% 0.00% ppmd
3506 root 2 0 5176K 2568K select 5:38 0.00% 0.00% mib2d
4957 root 2 0 1284K 624K select 5:16 0.00% 0.00% ntpd
6 root 18 0 0K 0K syncer 4:49 0.00% 0.00% syncer
3521 root 2 0 2312K 928K select 2:14 0.00% 0.00% lfmd
3526 root 2 0 5192K 1988K select 2:04 0.00% 0.00% snmpd
3543 root 2 0 0K 0K peer_s 1:46 0.00% 0.00% peer proxy
Table 13 on page 245 lists and describes the output fields included in this example. The
fields are listed in alphabetical order.
CPU Raw (unweighted) CPU usage. The value of this field is used to sort the
processes in the output.
NICE UNIX “nice” value. The nice value allows a process to change its final
scheduling priority.
PRI Current kernel scheduling priority of the process. A lower number indicates a
higher priority.
processes Number of existing processes and the number of processes in each state
(sleeping, running, starting, zombies, and stopped).
SIZE Total size of the process (text, data, and stack), in KB.
STATE Current state of the process (sleep, wait, run, idle, zombi, or stop).
• process-name is the name of the process that you want to restart. For example,
routing or class-of-service. You can use the command completion feature of Junos
OS to see a list of software processes that you can restart using this command.
• immediately restarts the software process without performing any clean-up tasks.
• soft rereads and reactivates the configuration without completely restarting the
software processes. For example, BGP peers stay up and the routing table stays
constant.
When a process restarts, the process identifer (PID) is updated. (See Figure 14 on page 246.)
NOTE: SRX Series Services Gateway devices for the branch and EX Series
Ethernet Switches support resilient dual-root partitioning.
2. Enter the request system halt command. This command stops all system processes
and halts the operating system. For example:
2. Enter the request system reboot command. This command displays the final stages
of the system shutdown and executes the reboot. Reboot requests are recorded to
the system log files, which you can view with the show log messages command. For
example:
Using the Junos OS CLI Comment Character # for Operational Mode Commands
The comment character in Junos OS enables you to copy operational mode commands
that include comments from a file and paste them into the CLI. A pound sign (#) at the
beginning of the command-line indicates a comment line. This is useful for describing
frequently used operational mode commands; for example, a user’s work instructions
on how to monitor the network. To add a comment to a command file, the first character
of the line must be #. When you start a command with #, the rest of the line is disregarded
by Junos OS.
To add comments in operational mode, start with a # and end with a new line (carriage
return):
user@host> # comment-string
comment-string is the text of the comment. The comment text can be any length, but
each comment line must begin with a #.
Related • Example: Using Comments in Junos OS Operational Mode Commands on page 248
Documentation
The following example shows how to copy and paste contents of a file into the CLI:
Model: m5
Junos Base OS boot [6.4-20040511.0]
Junos Base OS Software Suite [6.4-20040511.0]
Junos Kernel Software Suite [6.4-20040511.0]
Junos Packet Forwarding Engine Support (M5/M10) [6.4-20040511.0] Junos Routing
Software Suite [6.4-20040511.0] Junos Online Documentation [6.4-20040511.0] Junos
Crypto Software Suite [6.4-20040511.0]
user@host> # Command 2: Show all router interfaces
user@host> show interfaces terse
Interface Admin Link Proto Local Remote
fe-0/0/0 up up
fe-0/0/1 up down
fe-0/0/2 up down
mo-0/1/0 up
mo-0/1/0.16383 up up inet 10.0.0.1 --> 10.0.0.17
so-0/2/0 up up
so-0/2/1 up up
dsc up up
fxp0 up up
fxp0.0 up up inet 192.168.70.62/21
fxp1 up up
fxp1.0 up up tnp 4
gre up up
ipip up up
lo0 up up
lo0.0 up up inet 127.0.0.1 --> 0/0
lo0.16385 up up inet
Related • Using the Junos OS CLI Comment Character # for Operational Mode Commands on
Documentation page 248
In operational mode, you can control the Junos OS command-line interface (CLI)
environment. For example, you can specify the number of lines that are displayed on the
screen or your terminal type. The following output lists the options that you can use to
control the CLI environment:
user@host>set cli ?
Possible completions:
complete-on-space Set whether typing space completes current word
directory Set working directory
idle-timeout Set maximum idle time before login session ends
logical-system Set default logical system
prompt Set CLI command prompt string
restart-on-upgrade Set whether CLI prompts to restart after software upgrade
NOTE: When you use SSH to log in to the router or log in from the console
when its terminal type is already configured (as described in the Junos OS
System Basics Configuration Guide), your terminal type, screen length, and
screen width are already set.
The terminal type can be one of the following: ansi, vt100, small-xterm, or xterm.
If you do not specify a timestamp format, the default format is Mmm dd hh:mm:ss (for
example, Feb 08 17:20:49). Enclose the format in single quotation marks ( ‘).
timeout can be 0 through 100,000 minutes. Setting timeout to 0 disables the timeout.
To have the CLI allow only a tab to complete a command, use the set cli
complete-on-space off command:
To reenable the use of both spaces and tabs for command completion, use the set cli
complete-on-space on command:
This topic provides an overview of Junos OS CLI operational mode commands and
contains the following sections:
• Commands for controlling the CLI environment—Some set commands in the set
hierarchy configure the CLI display screen. For information about these commands,
see “Understanding the Junos OS CLI Modes, Commands, and Statement Hierarchies”
on page 5.
• test—Test the configuration and application of policy filters and autonomous system
(AS) path regular expressions.
• Commands for connecting to other network systems—The ssh command opens Secure
Shell connections, and the telnet command opens telnet sessions to other hosts on
the network. For information about these commands, see the CLI Explorer.
• Commands for copying files—The copy command copies files from one location on
the router or switch to another, from the router or switch to a remote system, or from
a remote system to the router or switch. For information about these commands, see
the CLI Explorer.
• A command—start—to exit the CLI and start a UNIX shell. For information about this
command, see the CLI Explorer.
• A command—quit—to exit the CLI. For information about this command, see the CLI
Explorer.
• For more information about the CLI operational mode commands, see the CLI Explorer
and the CLI Explorer.
NOTE: The QFX3500 switch does not support the IS-IS, OSPF, BGP, MPLS,
and RSVP protocols.
Software version Versions of software running on the router or switch show version
Log files and their contents and recent user logins show log
Manipulate files List of files and directories on the router or switch file list
Routing table information Information about entries in the routing tables show route
Forwarding table Information about data in the kernel’s forwarding table show route forwarding-table
information
OSPF Display standard information about OSPF neighbors show ospf neighbor
Configured LSPs on the router or switch, as well as all ingress, show mpls lsp
transit, and egress LSPs
Related • Junos OS Operational Mode Commands That Combine Other Commands on page 18
Documentation
• Understanding the Brief, Detail, Extensive, and Terse Options of Junos OS Operational
Commands on page 19
You can set the Junos OS command-line interface (CLI) screen length and width according
to your specific requirements. This topic contains the following sections:
Setting the screen length to 0 lines disables the display of output one screen at a time.
Disabling this UNIX more-type interface can be useful when you are issuing CLI commands
from scripts.
The following examples explain how the cli screen-length and cli screen-width values
determine the appearance of the output:
• When the CLI screen width is set to the default value (80 characters) and the cli scree
length to 10 lines, the --more-- prompt appears on the tenth line of the output.
• When the CLI screen width is set to 20 characters and the CLI screen length is set to
6 lines in a telnet or console window that is wide enough to contain 40 characters, the
--more-- prompt appears on the fourth line of the output. Here each one of the first
two lines has more than 20 characters and is counted as two lines. The third line
contains the fifth line of output, and the fourth line contains the --more-- prompt, which
has to appear in the sixth line as per the setting.
NOTE: If you have inadvertently set the CLI screen width to a lower value
that does not allow you to see the commands that you are typing, reset the
CLI screen width with a higher value by entering the set cli screen-width
command.
TIP: If you are not able to see the command that you are entering, type the
command in a text editor and copy it at the command prompt.
• Common Regular Expressions to Use with the replace Command on page 259
Table 15: Common Regular Expressions to Use with the replace Command
Operator Function
| Indicates that a match can be one of the two terms on either side of
the pipe.
* 0 or more terms.
Result: router1
Result: 10.2.3.4/28
Result: abc1.1def
Result: abc&def
Description Set the command-line interface (CLI) to complete a partial command entry when you
type a space or a tab. This is the default behavior of the CLI.
Output Fields When you enter this command, you are provided feedback on the status of your request.
Sample Output
set cli complete-on-space
In the following example, pressing the Spacebar changes the partial command entry
from com to complete-on-space. The example shows how adding the keyword off at the
end of the command disables command completion.
Output Fields When you enter this command, you are provided feedback on the status of your request.
Sample Output
set cli directory
user@host> set cli directory /var/tmp
Current directory: /var/tmp
Description Set the maximum time that an individual session can be idle before the user is logged
off the router or switch.
Options minutes—(Optional) Maximum idle time. The range of values, in minutes, is 0 through
100,000. If you do not issue this command, and the user’s login class does not specify
this value, the user is never forced off the system after extended idle times. Setting
the value to 0 disables the timeout.
Output Fields When you enter this command, you are provided feedback on the status of your request.
Sample Output
set cli idle-timeout
user@host> set cli idle-timeout 60
Idle timeout set to 60 minutes
Options string—CLI prompt string. To include spaces in the prompt, enclose the string in quotation
marks. By default, the string is username@hostname.
Description For an individual session, set the CLI to prompt you to restart the router after upgrading
the software.
Related • Setting the CLI to Prompt After a Software Upgrade on page 252
Documentation
Options length—Number of lines of text that the terminal screen displays. The range of values, in
number of lines, is 24 through 100,000. The default is 24.
The point at which the ---(more)--- prompt appears on the screen is a function of this
setting and the settings for the set cli screen-width and set cli terminal commands.
Options width—Number of characters in a line. The value is 0 or in the range of 40 through 1024.
The default value is 80.
NOTE: In Junos OS Release 13.2 and earlier, the value of width is in the range
of 0 through 1024.
Options format timestamp-format—Set the data and time format for the timestamp. The
timestamp format you specify can include the following placeholders in any order:
• %m—Two-digit month
• %d—Two-digit date
Enclose the format in single quotation marks ( ‘ ). Do not use spaces. Use a hyphen ( - )
or similar character to separate placeholders.
set date
• YYYYMMDDHHMM.SS
• ntp—Configure the router to synchronize the current date and time setting with a
Network Time Protocol (NTP) server.
show cli
Related • Displaying the Junos OS CLI Command and Word History on page 163
Documentation
• configure
• file
• help
• | (pipe)
• request
• restart
• set
configure
Syntax configure
<batch>
<dynamic>
<exclusive>
<private>
Description Enter configuration mode. When this command is entered without any optional keywords,
everyone can make configuration changes and commit all changes made to the
configuration.
batch—(Optional) Work in the batch commit mode where commit operations are executed
in batches.
Additional Information For more information about the different methods of entering configuration mode and
the restrictions that apply, see the Junos OS System Basics Configuration Guide.
Output Fields When you enter this command, you are placed in configuration mode and the system
prompt changes from hostname> to hostname#.
Sample Output
configure
user@host> configure
Entering configuration mode
[edit]
user@host#
file
Syntax file <archive |checksum |compare | copy | delete | list | rename | show | source address
|archive>
Description Archive files from the device, copy files to and from the router or switch, calculate the
file checksum, compare files, delete a file from the device, list files on the device, rename
a file, show file contents, or show the local address to initiate a connection.
Options archive (Optional) —Archive, and optionally compress, one or multiple local system files
as a single file, locally or at a remote location.
compare (Optional) —Compare two local files and describe the differences between
them in default, context, or unified output styles.
copy (Optional) —Copy files from one place to another on the local switch or between
the local switch and a remote system.
source address (Optional) —Specify the source address of the local file.
Related • Viewing Files and Directories on a Device Running Junos OS on page 237
Documentation
• CLI Explorer
help
Syntax help < (apropos string | reference <statement-name> | syslog <syslog-tag> | tip cli number
| topic <word>)>
Description Display help about available operational commands, configuration statements, or general
information about getting help. Entering the help command without an option provides
introductory information about how to use the help and ? commands.
Options apropos string—(Optional) Display command names and help text that matches the
string specified. If the string contains spaces, enclose it in quotation marks (" " ). You
can also specify a regular expression for the string, using standard UNIX-style regular
expression syntax.
tip cli number—(Optional) Display a tip about using the CLI. Specify the number of the
tip you want to view.
Related • Getting Online Help from the Junos OS Command-Line Interface on page 9
Documentation
| (pipe)
Syntax | (compare | count | display (changed | commit-scripts | detail | display set | inheritance |
omit | xml) | except pattern | find pattern | hold | last lines | match pattern| no-more |
request message (all | account@terminal) resolve <full-names> | save filename | trim
columns )
Options compare (filename | rollback n )—(Configuration mode only, and only with the show
command) Compare configuration changes with another configuration file.
• xml—(Operational mode only) Display the command output as Junos XML protocol
(Extensible Markup Language [XML]) tags.
except pattern—Ignore text matching a regular expression when searching the output. If
the regular expression contains spaces, operators, or wildcard characters, enclose it in
quotation marks.
find pattern—Display the output starting at the first occurrence of text matching a regular
expression. If the regular expression contains spaces, operators, or wildcard characters,
enclose it in quotation marks (" ").
last lines—Display the last number of lines you want to view from the end of the
configuration. However, when the number of lines requested is less than the number of
lines that the screen length setting permits you to display, Junos returns as many lines
as permitted by the screen length setting. For more information on using the last lines
option, see “Displaying Output Beginning with the Last Entries” on page 28.
match pattern—Search for text matching a regular expression. If the regular expression
contains spaces, operators, or wildcard characters, enclose it in quotation marks.
save filename—Save the output to a file or URL. For information about specifying the
filename, see “Specifying Filenames and URLs” on page 240.
• Using Regular Expressions with the Pipe ( | ) Symbol to Filter Junos Command Output
on page 24
request
Syntax request <chassis | ipsec switch | message | mpls | routing-engine | security | services | system
| flow-collector | support information>
Description Stop or reboot router components, switch between primary and backup components,
display messages, and display system information.
CAUTION: Halt the backup Routing Engine before you remove it or shut off
the power to the router; otherwise, you might need to reinstall the Junos OS.
NOTE: If your router contains two Routing Engines and you want to shut the
power off to the router or remove a Routing Engine, you must first halt the
backup Routing Engine (if it has been upgraded) and then the master Routing
Engine. To halt a Routing Engine, enter the request system halt command.
You can also halt both Routing Engines at the same time by issuing the request
system halt both-routing-engines command.
If you want to reboot a router that has two Routing Engines, reboot the backup
Routing Engine (if you have upgraded it) and then the master Routing Engine.
NOTE: If you reboot the TX Matrix router, all the T640 master Routing Engines
connected to the TX Matrix router reboot. If you halt both Routing Engines
on a TX Matrix router, all the T640 Routing Engines connected to the TX
Matrix router are also halted. Likewise, if you reboot the TX Matrix Plus router,
all the T1600 or T4000 master Routing Engines connected to the TX Matrix
Plus router reboot. If you halt both Routing Engines on a TX Matrix Plus router,
all the T1600 or T4000 Routing Engines connected to the TX Matrix Plus
router are also halted.
NOTE: If you insert a Flexible PIC Concentrator (FPC) into your router, you
may need to issue the request chassis fpc command (or press the online
button) to bring the FPC online. This applies to FPCs in M20, M40, M40e,
M160, M320, and T Series routers. For command usage, see the request chassis
fpc command description in the CLI Explorer.
Additional Information Most request commands are described in the Junos System Basics and Services Command
Reference. The following request commands are described in the Junos Interfaces
Command Reference: request ipsec switch and request services.
restart
Syntax restart
<adaptive-services |ancpd-service | application-identification |audit-process |
auto-configuration |captive-portal-content-delivery |ce-l2tp-service |chassis-control |
class-of-service |clksyncd-service |database-replication|datapath-trace-service
|dhcp-service | diameter-service | disk-monitoring | dynamic-flow-capture |
ecc-error-logging | ethernet-connectivity-fault-management
|ethernet-link-fault-management |event-processing | firewall
|general-authentication-service | gracefully | iccp-service |idp-policy | immediately
|interface-control | ipsec-key-management | kernel-replication | l2-learning | l2cpd-service
| l2tp-service | l2tp-universal-edge | lacp | license-service |link-management
|local-policy-decision-function |mac-validation |mib-process | mobile-ip | mountd-service
|mpls-traceroute |mspd | multicast-snooping |named-service | nfsd-service |
packet-triggered-subscribers |peer-selection-service |pgcp-service | pgm |
pic-services-logging | pki-service |ppp | ppp-service |pppoe |
protected-system-domain-service | redundancy-interface-process | remote-operations |
root-system-domain-service | routing <logical-system logical-system-name> | sampling
| sbc-configuration-process | sdk-service |service-deployment | services | services pgcp
gateway gateway-name | snmp |soft |static-subscribers |statistics-service|
subscriber-management | subscriber-management-helper | tunnel-oamd |usb-control|
vrrp |web-management>
<gracefully | immediately | soft>
• sfc and all-sfc for the TX Matrix Router in Junos OS Release 9.6.
all-chassis—(TX Matrix and TX Matrix Plus routers only) (Optional) Restart the software
process on all chassis.
all-lcc—(TX Matrix and TX Matrix Plus routers only) (Optional) For a TX Matrix router,
restart the software process on all T640 routers connected to the TX Matrix router.
For a TX Matrix Plus router, restart the software process on all routers connected to
the TX Matrix Plus router.
all-members—(MX Series routers only) (Optional) Restart the software process for all
members of the Virtual Chassis configuration.
all-sfc—(TX Matrix Plus routers only) (Optional) For a TX Matrix Plus router, restart the
software processes for the TX Matrix Plus router (or switch-fabric chassis).
ce-l2tp-service—(M10, M10i, M7i, and MX Series routers only) (Optional) Restart the
Universal Edge Layer 2 Tunneling Protocol (L2TP) process, which establishes L2TP
tunnels and Point-to-Point Protocol (PPP) sessions through L2TP tunnels.
dhcp—(J Series routers and EX Series switches only) (Optional) Restart the software
process for a Dynamic Host Configuration Protocol (DHCP) server. A DHCP server
allocates network IP addresses and delivers configuration settings to client hosts
without user intervention.
dialer-services—(J Series routers and EX Series switches only) (Optional) Restart the
ISDN dial-out process.
disk-monitoring—(Optional) Restart disk monitoring, which checks the health of the hard
disk drive on the Routing Engine.
dlsw—(J Series routers and QFX Series only) (Optional) Restart the data link switching
(DLSw) service.
isdn-signaling—(J Series routers and QFX Series only) (Optional) Restart the ISDN
signaling process, which initiates ISDN connections.
l2tp-service— (M10, M10i, M7i, and MX Series routers only) (Optional) Restart the Layer 2
Tunneling Protocol (L2TP) process, which sets up client services for establishing
Point-to-Point Protocol (PPP) tunnels across a network and negotiating Multilink
PPP if it is implemented.
l2tp-universal-edge—(MX Series routers only) (Optional) Restart the L2TP process, which
establishes L2TP tunnels and PPP sessions through L2TP tunnels.
lacp—(Optional) Restart the Link Aggregation Control Protocol (LACP) process. LACP
provides a standardized means for exchanging information between partner systems
on a link to allow their link aggregation control instances to reach agreement on the
identity of the LAG to which the link belongs, and then to move the link to that LAG,
and to enable the transmission and reception processes for the link to function in
an orderly manner.
lcc number—(TX Matrix and TX Matrix Plus routers only) (Optional) For a TX Matrix router,
restart the software process for a specific T640 router that is connected to the TX
Matrix router. For a TX Matrix Plus router, restart the software process for a specific
router that is connected to the TX Matrix Plus router.
Replace number with the following values depending on the LCC configuration:
• 0 through 7, when T1600 routers are connected to a TX Matrix Plus router with 3D
SIBs in a routing matrix.
link-management— (TX Matrix and TX Matrix Plus routers and EX Series switches only)
(Optional) Restart the Link Management Protocol (LMP) process, which establishes
and maintains LMP control channels.
lldpd-service—(EX Series switches only) (Optional) Restart the Link Layer Discovery
Protocol (LLDP) process.
local—(MX Series routers only) (Optional) Restart the software process for the local
Virtual Chassis member.
mac-validation— (Optional) Restart the Media Access Control (MAC) validation process,
which configures MAC address validation for subscriber interfaces created on demux
interfaces in dynamic profiles on MX Series routers.
member member-id—(MX Series routers only) (Optional) Restart the software process
for a specific member of the Virtual Chassis configuration. Replace member-id with
a value of 0 or 1.
mountd-service—(EX Series switches and MX Series routers only) (Optional) Restart the
service for NFS mount requests.
network-access-service—(J Series routers and QFX Series only) (Optional) Restart the
network access process, which provides the router's Challenge Handshake
Authentication Protocol (CHAP) authentication service.
nfsd-service—(Optional) Restart the Remote NFS Server process, which provides remote
file access for applications that need NFS-based transport.
pgm—(Optional) Restart the process that implements the Pragmatic General Multicast
(PGM) protocol for assisting in the reliable delivery of multicast packets.
pic-services-logging—(Optional) Restart the logging process for some PICs. With this
process, also known as fsad (the file system access daemon), PICs send special
logging information to the Routing Engine for archiving on the hard disk.
routing—(ACX Series routers, QFX Series, EX Series switches, and MX Series routers only)
(Optional) Restart the routing protocol process.
scc—(TX Matrix routers only) (Optional) Restart the software process on the TX Matrix
router (or switch-card chassis).
sdk-service—(Optional) Restart the SDK Service process, which runs on the Routing
Engine and is responsible for communications between the SDK application and
Junos OS. Although the SDK Service process is present on the router, it is turned off
by default.
sfc number—(TX Matrix Plus routers only) (Optional) Restart the software process on
the TX Matrix Plus router (or switch-fabric chassis). Replace number with 0.
services pgcp gateway gateway-name—(Optional) Restart the pgcpd process for a specific
border gateway function (BGF) running on an MS-PIC. This option does not restart
the pgcpd process running on the Routing Engine. To restart the pgcpd process on
the Routing Engine, use the pgcp-service option.
sflow-service—(EX Series switches only) (Optional) Restart the flow sampling (sFlow
technology) process.
snmp—(Optional) Restart the SNMP process, which enables the monitoring of network
devices from a central location and provides the router's or switch’s SNMP master
agent.
tunnel-oamd—(Optional) Restart the Tunnel OAM process, which enables the Operations,
Administration, and Maintenance of Layer 2 tunneled networks. Layer 2 protocol
tunneling (L2PT) allows service providers to send Layer 2 PDUs across the provider’s
cloud and deliver them to Juniper Networks EX Series Ethernet Switches that are
not part of the local broadcast domain.
usb-control—(J Series routers and MX Series routers only) (Optional) Restart the USB
control process.
vrrp—(ACX Series routers, EX Series switches, and MX Series routers only) (Optional)
Restart the Virtual Router Redundancy Protocol (VRRP) process, which enables
hosts on a LAN to make use of redundant routing platforms on that LAN without
requiring more than the static configuration of a single default route on the hosts.
Output Fields When you enter this command, you are provided feedback on the status of your request.
Sample Output
restart interfaces
user@host> restart interfaces
interfaces process terminated
interfaces process restarted
set
Description Create a statement hierarchy and set identifier values. This is similar to edit except that
your current level in the hierarchy does not change.
Required Privilege configure—To enter configuration mode, but other required privilege levels depend on
Level where the statement is located in the configuration hierarchy.
Troubleshooting
• Troubleshooting Procedures on page 301
Troubleshooting Procedures
To return to the most recently committed configuration and load it into configuration
mode without activating it, use the rollback configuration mode command:
[edit]
user@host# rollback
load complete
To activate the configuration to which you rolled back, use the commit command:
[edit]
user@host# rollback
load complete
[edit]
user@host# commit
This topic explains how you can return to a configuration prior to the most recently
committed one, and contains the following sections:
• Returning to a Configuration Prior to the One Most Recently Committed on page 302
• Displaying Previous Configurations on page 302
• Comparing Configuration Changes with a Prior Version on page 303
• Creating and Returning to a Rescue Configuration on page 305
• Saving a Configuration to a File on page 305
[edit]
user@host# rollback number
load complete
[edit]
user@host# rollback ?
Possible completions:
<[Enter]> Execute this command
<number> Numeric argument
0 2005-02-27 12:52:10 PST by abc via cli
1 2005-02-26 14:47:42 PST by def via cli
2 2005-02-14 21:55:45 PST by ghi via cli
3 2005-02-10 16:11:30 PST by jkl via cli
4 2005-02-10 16:02:35 PST by mno via cli
5 2005-03-16 15:10:41 PST by pqr via cli
6 2005-03-16 14:54:21 PST by stu via cli
7 2005-03-16 14:51:38 PST by vwx via cli
8 2005-03-16 14:43:29 PST by yzz via cli
9 2005-03-16 14:15:37 PST by abc via cli
10 2005-03-16 14:13:57 PST by def via cli
11 2005-03-16 12:57:19 PST by root via other
12 2005-03-16 10:45:23 PST by root via other
13 2005-03-16 10:08:13 PST by root via other
14 2005-03-16 01:20:56 PST by root via other
15 2005-03-16 00:40:37 PST by ghi via cli
16 2005-03-16 00:39:29 PST by jkl via cli
17 2005-03-16 00:32:36 PST by mno via cli
18 2005-03-16 00:31:17 PST by pqr via cli
19 2005-03-15 19:59:00 PST by stu via cli
20 2005-03-15 19:53:39 PST by vwx via cli
21 2005-03-15 18:07:19 PST by yzz via cli
22 2005-03-15 17:59:03 PST by abc via cli
23 2005-03-15 15:05:14 PST by def via cli
24 2005-03-15 15:04:51 PST by ghi via cli
25 2005-03-15 15:03:42 PST by jkl via cli
26 2005-03-15 15:01:52 PST by mno via cli
27 2005-03-15 14:58:34 PST by pqr via cli
28 2005-03-15 13:09:37 PST by root via other
29 2005-03-12 11:01:20 PST by stu via cli
30 2005-03-12 10:57:35 PST by vwx via cli
31 2005-03-11 10:25:07 PST by yzz via cli
32 2005-03-10 23:40:58 PST by abc via cli
[edit]
user@host# show | compare (filename| rollback n)
filename is the full path to a configuration file. The file must be in the proper format: a
hierarchy of statements.
n is the index into the list of previously committed configurations. The most recently
saved configuration is number 0, and the oldest saved configuration is number 49. If you
do not specify arguments, the candidate configuration is compared against the active
configuration file (/config/juniper.conf).
• Statements that are only in the candidate configuration are prefixed with a plus sign
(+).
• Statements that are only in the comparison file are prefixed with a minus sign (-).
• Statements that are unchanged are prefixed with a single blank space ( ).
The following example shows various changes, then a comparison of the candidate
configuration with the active configuration, showing only the changes made at the [edit
protocols bgp] hierarchy level:
[edit]
user@host# edit protocols bgp
To save the most recently committed configuration as the rescue configuration so that
you can return to it at any time, issue the request system configuration rescue save
command:
To return to the rescue configuration, use the rollback rescue configuration mode
command:
[edit]
user@host# rollback rescue
load complete
NOTE: If the rescue configuration does not exist, or if the rescue configuration
is not a complete, viable configuration, the rollback command fails, an error
message appears, and the current configuration remains active.
To activate the rescue configuration that you have loaded, use the commit command:
[edit]
user@host# rollback rescue
load complete
[edit]
user@host# commit
To delete an existing rescue configuration, issue the request system configuration rescue
delete command:
For more information about the request system configuration rescue delete and request
system configuration rescue save commands, see the CLI Explorer.
To save software configuration changes to an ASCII file, use the save configuration mode
command:
[edit]
user@host# save filename
[edit]
user@host#
The contents of the current level of the statement hierarchy (and below) are saved, along
with the statement hierarchy containing it. This allows a section of the configuration to
be saved, while fully specifying the statement hierarchy.
By default, the configuration is saved to a file in your home directory, which is on the flash
drive.
When you issue this command from anywhere in the hierarchy (except the top level), a
replace tag is automatically included at the beginning of the file. You can use the replace
tag to control how a configuration is loaded from a file.
Related • Returning to the Most Recently Committed Junos Configuration on page 301
Documentation
• Loading a Configuration from a File on page 125
This topic shows how to use the rollback command to return to the most recently
committed Junos OS configuration. The rollback command is useful if you make
configuration changes and then decide not to keep the changes.
The following procedure shows how to configure an SNMP health monitor on a device
running Junos OS and then return to the most recently committed configuration that
does not include the health monitor. When configured, the SNMP health monitor provides
the network management system (NMS) with predefined monitoring for file system
usage, CPU usage, and memory usage on the device.
user@host> configure
entering configuration mode
[edit]
user@host#
[edit]
user@host# show snmp
No snmp statements appear because SNMP has not been configured on the device.
[edit]
user@host# set snmp health-monitor
[edit]
user@host# show snmp
health-monitor;
5. Enter the rollback configuration mode command to return to the most recently
committed configuration:
[edit]
user@host# rollback
load complete
6. Show the configuration again to make sure your change is no longer present:
[edit]
user@host# show snmp
7. Enter the commit command to activate the configuration to which you rolled back:
[edit]
user@host# commit
[edit]
user@host# exit
Exiting configuration mode
You can also use the rollback command to return to earlier configurations.
Related • Returning to the Most Recently Committed Junos Configuration on page 301
Documentation
Index
• Index on page 311
B
batch commit
Symbols
usage guidelines.............................................53, 115, 116
!
braces, in configuration statements................................xix
in interface names.........................................................49
brackets
" ", configuration group wildcards...................................143
angle, in syntax descriptions.....................................xix
#, comments in configuration statements...........xix, 90
square, in configuration statements.......................xix
( ), in syntax descriptions....................................................xix
*
in interface names.........................................................49
C
candidate configuration..........................................................5
regular expression operator.....................................259
CLI
wildcard character.......................................................143
breadcrumbs
+
usage guidelines...................................................175
in statement lists...........................................................80
command completion...............................................262
regular expression operator.....................................259
command history.........................................................163
. (period)
displaying...............................................................276
regular expression operator.....................................259
comparing configuration versions........................303
/* */, comment delimiters..................................................90
configuration mode
< >, in syntax descriptions...................................................xix
description...............................................................33
?
navigation commands, table...............................7
regular expression operator......................................143
configuration-breadcrumbs statement..............189
wildcard............................................................................143
current working directory
[ ], in configuration statements........................................xix
displaying...............................................................275
\
setting.....................................................................263
in interface names.........................................................49
date
wildcard characters.....................................................143
setting.......................................................................271
{ }, in configuration statements........................................xix
editing command line...................................................47
specifying statements..................................................42
idle timeout, setting...................................................264
| (pipe)......................................................................................282
keyboard sequences.....................................................47
command output........................................................282
permissions, displaying..............................................273
in syntax descriptions.........................................xix, 282
prompt strings..............................................................252
| (pipe), in syntax descriptions................................xix, 282
prompt, setting.............................................................265
restart, after software upgrade.............................266
A
screen length, setting.................................................267
access privilege levels
screen width, setting..................................................268
entering configuration mode......................................61
settings, displaying......................................................272
activate command...............................................................182
terminal type, setting.................................................269
usage guidelines.............................................................34
timestamp......................................................................252
activate statements and identifiers................................88
timestamp, setting......................................................270
active configuration..................................................................5
type checking..................................................................44
addresses
users, monitoring..........................................................237
machine name................................................................76
K pipe ( | )
keyboard sequences command output, filtering................................25, 282
editing command line...................................................47 processes
managing........................................................................243
L restarting........................................................................286
last command.......................................................................282 programs
last filter......................................................................................28 managing........................................................................243
load command.......................................................................197 prompt
usage guidelines.............................................................34 setting to display in CLI.............................................265
load merge command to restart.........................................................................266
usage guidelines...........................................................126 prompt strings
load override command CLI......................................................................................252
usage guidelines...........................................................125 protect command...............................................................200
load set command usage guidelines...........................................................100
usage guidelines............................................................127 protecting configuration
locking configuration...............................................................71 usage guidelines...........................................................100
logical interfaces
unit numbers..................................................................166 Q
quit command.......................................................16, 201, 254
M usage guidelines.............................................................35
manuals
comments on..................................................................xix R
match command..................................................................282 re0 configuration group......................................................135
match filter................................................................................29 re1 configuration group........................................................135
maximum-aggegate-pool statement..........................198 redrawing screen....................................................................48
maximum-entries statement...........................................199 regional configurations.......................................................155
regular expressions
N first match, displaying from........................................27
names matching output, displaying......................................29
wildcard ..........................................................................156 nonmatching output, ignoring...................................27
naming conventions, interface.........................................165 relative option.........................................................................127
nested configuration groups.............................................138 rename command.....................................................202, 203
no-more command...................................................282, 283 usage guidelines.............................................................85
no-more filter...........................................................................29 renaming identifiers...............................................................85
replace command...............................................................204
O usage guidelines.............................................................49
operational mode, CLI replace option.........................................................................126
command history.........................................................163 request command...............................................................284
switching to configuration mode..............................74 usage guidelines....................................................16, 254
users, monitoring..........................................................237 request message filter..........................................................29
word history....................................................................164 request system configuration rescue delete
command...........................................................................305
P request system configuration rescue save
parentheses, in syntax descriptions................................xix command...........................................................................305
partial command entry, completing.............................262 request system halt command.......................................247
paste command request system logout pid pid_number
usage guidelines.............................................................35 command...............................................................................71
peer entities.............................................................................153 request system reboot command..................................247
permissions, CLI, displaying..............................................273 resolve command................................................................282
trim command.......................................................................282
TX Matrix router
configuration groups...................................................135
configuration groups example................................139
type checking, CLI...................................................................44
U
UNIX operating system.......................................................3, 4
UNIX shell.....................................................................................4
unprotect command...........................................................222
usage guidelines...........................................................100
unprotecting configuration
usage guidelines...........................................................100
up command..........................................................................223
usage guidelines.....................................................35, 84
update command.................................................................224
usage guidelines......................................................35, 72
updating configure private configuration.......................72
upgrade, restarting after....................................................252
upgrading software..............................................................252
prompt to restart after..............................................266
URLs, specifying in commands......................................240
user accounts
configuration example.................................................76
user timeout, setting...........................................................264
users
CLI permissions, displaying......................................273
editing configuration
displaying..................................................................67
multiple simultaneous users.....................40, 52
of CLI, monitoring.........................................................237
W
wildcard characters..............................................................143
wildcard command.............................................................226
wildcard delete command
usage guidelines.............................................................92
wildcard names.....................................................................156
wildcard range command
usage guidelines.............................................................94
word history
operational mode........................................................164
working directory
current, setting.............................................................263
displaying........................................................................275
X
XML format
displaying command output in.................................27