Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

CLI Configuration Mode Overview

 

The configuration mode of the Junos OS CLI enables you to configure a device, using configuration statements to set, manage, and monitor device properties.

Understanding Junos OS CLI Configuration Mode

You can configure all Junos OS properties, including interfaces, general routing information, routing protocols, and user access, as well as several system hardware properties.

As described in Understanding the Junos OS CLI Modes, Commands, and Statement Hierarchies, a device configuration is stored as a hierarchy of statements. In configuration mode, you create the specific hierarchy of configuration statements to use. When you have finished entering the configuration statements and you are certain they are complete and correct, you commit them, which activates the configuration on the device.

You can create the hierarchy interactively or you can create an ASCII text file that is loaded onto the device and then committed.

This topic covers:

Configuration Mode Commands

The following table summarizes each CLI configuration mode command. The commands are organized alphabetically.

Table 1: Summary of Configuration Mode Commands

Command

Description

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.

annotate

Add comments to a configuration. You can add comments only at the current hierarchy level.

commit

Commit the set of changes to the database and cause the changes to take operational effect.

copy

Make a copy of an existing statement in the configuration.

deactivate

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.

delete

Delete a statement or identifier. All subordinate statements and identifiers contained within the specified statement path are deleted with it.

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.

extension

Manage configurations that are contributed by SDK application packages. Either display or delete user-defined configuration contributed by the named SDK application package. A configuration defined in any native Junos OS package is never deleted by the extension command.

help

Display help about available configuration statements.

insert

Insert an identifier into an existing hierarchy.

load

Load a configuration from an ASCII configuration file or from terminal input. Your current location in the configuration hierarchy is ignored when the load operation occurs.

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.

rename

Rename an existing configuration statement or identifier.

replace

Replace identifiers or values in a configuration.

rollback

Return to a previously committed configuration. The software saves the last 10 committed configurations, including the rollback number, date, time, and name of the user who issued the commit configuration command.

run

Run a top-level CLI command without exiting from configuration mode.

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.

show

Display the current configuration.

status

Display the users currently editing the configuration.

top

Return to the top level of configuration command mode, which is indicated by the [edit] banner.

up

Move up one level in the statement hierarchy.

update

Update a private database.

wildcard

Delete a statement or identifier. All subordinate statements and identifiers contained within the specified statement path are deleted with it. You can use regular expressions to specify a pattern. Based on this pattern, you search for items that contain these patterns and delete them.

Configuration Statements and Identifiers

You can configure device properties by including the corresponding statements in the configuration. Typically, a statement consists of a keyword, which is fixed text, and an optional identifier. An identifier is an identifying name that you can define, such as 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.

Table 2: Configuration Mode Top-Level Statements

Statement

Description

access

Configure the Challenge Handshake Authentication Protocol (CHAP). For information about the statements in this hierarchy, see the Junos OS Administration Library.

accounting-options

Configure accounting statistics data collection for interfaces and firewall filters. For information about the statements in this hierarchy, see the Network Management and Monitoring 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 Administration Library.

class-of-service

Configure class-of-service parameters. For information about the statements in this hierarchy, see the Junos OS Class of Service Feature Guide for Routing Devices.

firewall

Define filters that select packets based on their contents. For information about the statements in this hierarchy, see the Routing Policies, Firewall Filters, and Traffic Policers Feature Guide.

forwarding-options

Define forwarding options, including traffic sampling options. For information about the statements in this hierarchy, see the Junos OS Network Interfaces Library for Routing Devices.

groups

Configure configuration groups. For information about statements in this hierarchy, see the Junos OS Administration Library.

interfaces

Configure interface information, such as encapsulation, interfaces, virtual channel identifiers (VCIs), and data-link connection identifiers (DLCIs). For information about the statements in this hierarchy, see the Junos OS Network Interfaces Library for Routing Devices.

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 Policies, Firewall Filters, and Traffic Policers Feature 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 Library and the MPLS Applications Feature Guide for Routing Devices.

routing-instances

Configure multiple routing instances. For information about the statements in this hierarchy, see the Junos OS Routing Protocols Library.

routing-options

Configure protocol-independent routing options, such as static routes, autonomous system numbers, confederation members, and global tracing (debugging) operations to log. For information about the statements in this hierarchy, see the Junos OS Routing Protocols Library.

security

Configure IP Security (IPsec) services. For information about the statements in this hierarchy see the Junos OS Administration Library.

snmp

Configure SNMP community strings, interfaces, traps, and notifications. For information about the statements in this hierarchy, see the Network Management and Monitoring Guide.

system

Configure systemwide properties, including the hostname, domain name, Domain Name System (DNS) server, user logins and permissions, mappings between hostnames and addresses, and software processes. For information about the statements in this hierarchy, see the Junos OS Administration Library.

For specific information on configuration statements, see the Junos OS configuration guides.

Configuration Statement Hierarchy

The Junos OS configuration consists of a hierarchy of statements. There are two types of statements: Container statements, which are statements that contain other statements, and leaf statements, which do not contain other statements. All the container and leaf statements together form the configuration hierarchy.

Figure 1: Configuration Mode Hierarchy of Statements
Configuration Mode Hierarchy of Statements

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. The previous illustration shows 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). 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.

The CLI represents the statement path shown in Figure 1:

[edit protocols ospf area area-number interface interface-name]

The command displays the configuration as follows:

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:

Likewise, in the following example, dynamic-profile dynamic-profile-name aggregate-clients; is a oneliner because the dynamic-profile statement, its identifier dynamic-profile-name, and leaf statement aggregate-clients all appear on one line when you run the show command in the configuration mode:

Entering and Exiting the Junos OS CLI Configuration Mode

You configure Junos OS by entering configuration mode and creating a hierarchy of configuration mode statements.

  • To enter configuration mode, use the configure command.

    When you enter configuration mode, the following configuration mode commands are available:

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

    Users must have configure permission to view and use the configure command. When in configuration mode, you can view and modify only those statements for which you have access privileges set.

  • 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:

    Up to 32 users can be in configuration mode simultaneously, and they all can make changes to the configuration at the same time.

  • To exit configuration mode, use the exit configuration-mode configuration mode command from any level, or use the exit command from the top level. For example:

    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:

  • 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.

Issuing Relative Junos OS Configuration Mode Commands

The top or up command followed by another configuration command, including edit, insert, delete, deactivate, annotate, or show enables you to quickly move to the top of the hierarchy or to a level above the area you are configuring.

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:

Using Command Completion in Configuration Mode

This topic demonstrates using basic command completion in the Junos OS CLI configuration mode.

List the configuration mode commands:

[edit]
user@host# ?

List all the statements available at a particular hierarchy level:

[edit]
user@host# edit ?
user@host# edit protocols ?
[edit]
user@host# edit protocols

List all commands that start with a particular letter or string:

user@host# edit routing-options a?
[edit]
user@host# edit routing-options a

List all configured Asynchronous Transfer Mode (ATM) interfaces:

[edit]
user@host# edit interfaces at?

Display a list of all configured policy statements:

[edit]
user@host# show policy-options policy-statement ?

Notational Conventions Used in Junos OS Configuration Hierarchies

When you are working in Junos OS command-line interface (CLI) configuration mode, the banner on the line preceding the prompt indicates the current hierarchy level. In the following example, the level is [edit protocols ospf]:

(The Junos OS documentation uses user@host# as the standard configuration mode prompt. In an actual CLI session, the prompt shows your user ID and the configured name of the Juniper Networks device you are working on.)

Use the set ? command to display the statements that you can include in the configuration at the current level. The help apropos command is also context-sensitive, displaying matching statements only at the current level and below.

Note

In this topic, statements are listed alphabetically within each hierarchy and subhierarchy. If a subhierarchy is sufficiently long that it might be difficult to determine where it ends and its next peer statement begins, the subhierarchy appears at the end of its parent hierarchy instead of in alphabetical order. In this case, a placeholder appears in its actual alphabetical position.

For example, at the [edit interfaces interface-name unit logical-unit-number] hierarchy level, the family family-name subhierarchy has more than 20 child statements, including several subhierarchies with child statements of their own. The full family family-name hierarchy appears at the end of its parent hierarchy ([edit interfaces interface-name unit logical-unit-number]), and the following placeholder appears at its actual alphabetical position:

Another exception to alphabetical order is that the disable statement always appears first in any hierarchy that includes it.