[an error occurred while processing this directive][an error occurred while processing this directive]

Loading a Configuration from a File

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 Viewing Files and Directories on a Device Running JUNOS Software.

To load a configuration from the terminal, use the following version of the load configuration mode command. Type ^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.

An override operation discards the current candidate configuration and loads the configuration in filename or the one 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 Examples: Loading a Configuration from a File.

To replace portions of a configuration, specify the replace option. 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 Examples: Loading a Configuration from a File.

To replace only the configuration that has changed, specify the update option at any level of the hierarchy. An update operation compares the current configuration and the current candidate configuration, and loads only the changes between these configurations in filename or the one that you type at the terminal. When you use the update operation and commit the configuration, JUNOS Software attempts to notify the smallest set of system processes that are affected by the configuration change.

To combine the current configuration and the configuration in filename or the one that you type at the terminal, specify the merge option. A merge operation is useful when you are adding a new section to an existing configuration. If the existing configuration and the incoming configuration contain conflicting statements, the statements in the incoming configuration override those in the existing configuration. For an example, see Examples: Loading a Configuration from a File.

To change part of the configuration with a patch file and mark only those parts as changed, specify the patch option. For an example, see Examples: Loading a Configuration from a File.

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-mappingbob 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-mappingbob sysid 0123.456.789bc;

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.

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 Examples: Loading a Configuration from a File.

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 JUNOS System Basics and Services Command Reference.

Note: If you are using JUNOS Software 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.


Published: 2010-01-17

[an error occurred while processing this directive]