Tuesday, October 26, 2010

Load a Configuration

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 (patch | replace | merge | override) filename
To load a configuration from the terminal, use the following version of the load configuration mode command:
[edit]
user@host# load (patch | replace | merge | override) terminal  
[Type ^D to end input]

To replace an entire configuration, specify the override option at the top 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.
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.
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 replace: tag.
To change part of the configuration with a patch file and mark only those parts as changed, specify the patch option.
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.
For information about specifying the filename, see How to Specify Filenames and URLs.
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 Internet Software Operational Mode Command Reference.

Examples: Load a Configuration from a File

Pic. 3: Example 1: Load a Configuration from a File

 PIC 4: Example 2: Load a Configuration from a File

Add caption
PIC 5: Example 3: Load a Configuration from a File
 



Pic 6: Example 4: Load Configuration from a File

No comments: