Topic: tech juniper ijos prev next

tech juniper ijos > 04: Junos CLI Configuration Mode

04: Junos CLI Configuration Mode

Configuration changes do not take effect immediately. The active configuration is currently active and will be loaded on boot. The candidate configuration is the working copy and may become the active configuration. A candidate configuration is committed to become the active configuration.

Configuration Modes

The candidate configuration is applied using the commit command. When the commit command is issued, the candidate configuration is checked for errors. If any part of the configuration contains an error, none of the candidate configuration is applied.

Junos maintains a configuration history accessed by the rollback <VERSIONS> command. The current active configuration is rollback 0. If a configuration is loaded by rollback <VERSIONS>, it must still be committed.

Multiple users (up to 32) can enter and commit changes simultaneously. Configuration changes are entered into the candidate configuration as soon as the user hits the enter key. When a single user enters the commit command, all changes made by all users are checked for errors and committed.

Use configure exclusive to stop other users editing the candidate configuration. In this mode, any changes which are uncommitted upon leaving configuration mode will be lost. In contrast, uncommitted changes left when leaving normal configuration mode are kept in the candidate configuration.

Using configure private command gives the user their own candidate configuration. Like configure exclusive, uncommitted changes are lost upon leaving configuration mode. When a user is in private mode, other users must also enter private mode, or use configure exclusive to take exclusive control of the candidate configuration. In some deployments, it is desirable to allow users to use only configure private.

If two users make competing changes and the first user’s configuration succeeds, the second user receives a warning when they issue a commit command. The second user must issue a second commit command to activate their competing configuration change.

configure batch enters batch configuration mode. Changes made in this configuration mode are executed in batches by the commit server. This saves system resources.

configure dynamic can be used to configure routing policy and certain routing policy objects in a dynamic database. It is not subject to the same verification as the main configuration. Changes are committed more quickly due to the lack of verification. Policy objects can still be references from the main configuration.

Configuration Format

The configuration is a hierarchy. When in configuration mode, the following commands move between parts of the hierarchy:

The show command shows the current level of the configuration hierarchy. Curly brackets, {}, represent the hiearchical structure. Semicolons, ;, indicate terminating symbols.

When in configuration mode, the candidate configuration at the current level in the hierarchy can be viewed with the show command. The individual set commands can be viewed with show | display set.

Committing Configurations

On devices with multiple routing engines, the commit synchronize command commits the configuration to both RE`s.

commit can be executed at any level in the configuration hiearchy, except when in configure private mode. In configure private mode, commit must be executed from the top level of the configuration hierachy.

Use the commit check command to validate the syntax of the candidate configuration before committing it.

Use the commit confirmed command to require a second commit command within a timeout value. If the second commit is not received, the change is rolled back. The default timeout is 10 minutes.

Commits can be made at a specific time using the commit at command. View pending changes with show system commit. Pending changes can be cleared with clear system commit.

A log entry can be added to a commit with the commit comment command.

Use commit and-quit to exit configuration mode after committing the change, saving a step.

It is possible to use commit prepare and then commit activate to prepare and then apply a commit in two steps.

Use show | compare to show the differences between the candidate and active configurations at the current hierarchy level.

Use show configuration | compare rollback <n> to determine differences between the active and rollback configurations.

Use show configuration | display <options> to show the configuration in different forms, for instance, as JSON or XML.

Rescue and Save Configurations

Issue the request system configuration rescue save command to save the most recently saved configuration as the rescue configuration. To rollback to this configuration, use the rollback rescue command.

The candidate configuration at the current hierarchy can be saved to an ASCII file with the save <filename> command.

The configuration mode load command can be used to load a configuration file from one of several sources. The load override option replaces the entire configuration with a new one and must be run at the root of the configuration hierarchy.

The run command provides access to operational mode commands from configuration mode.

Removing Configuration Statements

delete is the opposite of set and removes configuration statements. deactivate only deactivates statements, keeping them in the configuration, but not interpreted by Junos.

Use wildcard to delete several parts of the configuration at once. For instance, wildcard delete interfaces ge-*. Junos will prompt to confirm deletion of matched statements.

Ephemeral Configuration Database

The ephemeral configuration database is committed to by the XML RPC API or the JET. It is not configured to by the CLI. The ephemeral configuration database is useful in large datacentre environments, where configuration changes are made frequently. Whilst basic syntax checks are carried out on commits to the ephemeral database, full checks for compatibility with the main configuration are not carried out. In the event of a conflict between the ephemeral configuration and the main configuration, the ephemeral configuration wins.

Loading Configuration Files

The load command loads configuration files from various sources. It can be used in various ways; factory-default, merge, override, patch, replace, set, update.

Additional Commands

rename renames a configuration hierarchy, for instance, an interface.

replace replaces a pattern of configuration statements with another (like find & replace).

copy copies a hierarchy of configuration statements under a new name, leaving the original unchanged.

insert places a new configuration statement in a specific location. This is used for routing and firewall policies. E.g. insert term t1 before term t2.

annotate attaches a comment to a configuration statement.

The run Command

run allows operational mode commands to be executed from configuration mode. It is similar to do from other vendors. It is supported at all configuration hierarchy levels.