Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

CLI Overview

The CLI is the software interface used to access your device. You use the CLI to configure the device, monitor its operations, and adjust the configuration as needed. You access the CLI through a console connection interface or through a network connection.

Introducing the Command-Line Interface

The Junos OS CLI is a command shell specific to Juniper Networks that runs on top of the operating system kernel. Through industry-standard tools and utilities, the CLI provides a powerful set of commands that you can use to monitor and to configure devices running Junos OS.

The CLI has two modes:

  • Operational mode—Use this mode to display the current status of the device. In operational mode, you enter commands to monitor and to troubleshoot the network operating system, devices, and network connectivity.

  • Configuration mode—Use this mode to configure the device. In this mode, you enter statements to configure all properties of the device, including interfaces, general routing information, routing protocols, user access, and several system and hardware properties. Junos OS stores a configuration as a hierarchy of configuration statements.

    When you enter configuration mode, you are viewing and changing a file called the candidate configuration. You use the candidate configuration file, you make configuration changes without causing operational changes to the current operating configuration, called the active configuration. The device does not implement the changes you added to the candidate configuration file until you commit the changes. Committing the configuration changes activates the revised configuration on the device. Candidate configurations enable you to alter your configuration without damaging your current network operations.

Key Features of the CLI

The CLI commands and statements follow a hierarchical organization and have a regular syntax. The CLI provides the following features to simplify CLI use:

  • Consistent command names—Commands that provide the same type of function have the same name, regardless of the specific device type on which you are operating. For example, all show commands display software information and statistics, and all clear commands erase various types of system information.

  • Lists and short descriptions of available commands—The CLI provides information about available commands t each level of the command hierarchy. If you type a question mark (?) at any level, you see a list of the available commands along with a short description of each. This means that if you are already familiar with Junos OS or with other routing software, you can use many of the CLI commands without referring to the documentation.

  • Command completion—Command completion for command names (keywords) and for command options is available at each level of the hierarchy. To complete a command or option that you have partially typed, press the Tab key or the Spacebar. If the partially typed letters begin a string that uniquely identifies a command, the complete command name appears. Otherwise, a beep indicates that you have entered an ambiguous command, and the CLI displays possible completions. Completion also applies to other strings, such as filenames, interface names, usernames, and configuration statements.

    If you have typed the mandatory arguments for executing a command in operational mode or configuration mode, the CLI displays <[Enter]> as one of the choices when you type a question mark (?). This output 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 reach a specific hierarchy level in the configuration mode and do not need to enter any more mandatory arguments or statements.

  • Industry-standard technology—With FreeBSD UNIX as the kernel, a variety of UNIX utilities are available on the CLI. For example, you can:

    • Use regular expression matching to locate and to replace values and identifiers in a configuration, to filter command output, and to 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.

    • Store and archive Junos OS device files on a UNIX-based file system.

      Use standard UNIX conventions to specify filenames and paths.

      Exit the CLI environment and create a UNIX C shell or Bourne shell to navigate the file system, manage router processes, and so on.

CLI Modes, Commands, and Statement Hierarchies—An Overview

The Junos OS CLI commands and statements are organized under two command modes and various hierarchies. The following sections provide an overview of the CLI command modes and the command and statement hierarchies.

CLI Command Hierarchy

CLI commands are organized in a hierarchy. Commands that perform a similar function are grouped together under the same level of the hierarchy. For example, all commands that display information about the system and the system software are under the show system command. All commands that display information about the routing table are under the show route command.

To execute a command, 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.

Configuration Statement Hierarchy

The configuration statement hierarchy has 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 statements and leaf statements together form the configuration hierarchy.

The following illustration shows 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; that is, they are branches of the hierarchy tree. The hello-interval statement is a leaf on the tree.

Figure 1: Configuration Statement Hierarchy Example

Configuration Statement Hierarchy Example

Move Among Hierarchy Levels

The following table shows the CLI commands you use to navigate the levels of the configuration statement hierarchy.

Table 1: CLI Configuration Mode Navigation Commands

Command

Description

edit hierarchy-level

Moves to an existing configuration statement hierarchy or creates a hierarchy and moves to that level.

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 command and the quit command are interchangeable.

up

Moves up the hierarchy one level at a time.

top

Moves directly to the top level of the hierarchy.

Other Tools to Configure and Monitor Juniper Networks Devices

Apart from the CLI, Junos OS also supports the following applications, scripts, and utilities that enable you to configure and monitor Juniper Networks devices:

  • J-Web GUI—Available on select Juniper Networks devices, the J-Web GUI enables you to monitor, configure, troubleshoot, and manage the device by means of a browser with HTTP or HTTPS enabled. For more information, see the J-Web Interface User Guide.

  • Junos XML management protocol—The Junos XML management protocol enables you to monitor and configure Juniper Networks devices. For more information, see the Junos XML Management Protocol Developer Guide.

  • NETCONF API—You can also use the NETCONF XML management protocol to monitor and configure Juniper Networks devices. For more information, see the NETCONF XML Management Protocol Developer Guide.

  • 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 Automation Scripting User Guide.

  • MIBs—You can use enterprise-specific and standard MIBS to retrieve information about the hardware and software components on a Juniper Networks device. For more information about MIBs, see the Junos OS Network Management Administration Guide for Routing Devices.

Configure Junos OS in a FIPS Environment

With Junos-FIPS you can configure a network of Juniper Networks devices in a FIPS 140-2 environment.

The Junos-FIPS software environment requires the installation of FIPS software by a Crypto Officer. In Junos-FIPS, some Junos OS commands and statements have restrictions and some additional configuration statements are available. For more information, see the following resources:

  • Common Criteria and FIPS Certifications—Provides links to guidelines for configuring Juniper Networks devices so the secure environment complies with the requirements of public sector certifications such as Common Criteria and FIPS certification.

  • Compliance Advisor—A Web application that provides regulatory compliance information about Common Criteria, FIPS, Homologation, ROHS2, and USGv6 for Juniper Networks products.