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

Load a Configuration Using Copy and Paste Commands

You can load configurations using the copy and paste commands in the following ways:

  1. Load a Configuration from a File to a Router
  2. Load a Configuration Using the display set Command

Load a Configuration from a File to a Router

Purpose

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.

Action

To load a configuration from a file, follow these steps:

  1. Create the configuration in a file using a text editor such as Notepad, making sure that the syntax of the configuration file is correct. See the JUNOS System Basics and Services Command Reference, for information about testing the syntax of a configuration file.
  2. In the text file, use an option to perform the required action. The following table lists and describes some options. For an example of a text file, see “What It Means”.

    Table 1: Options for the load Command

      

    merge

    Combines the current configuration and the configuration in filename or the one that you type at the terminal. 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.

    override

    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. You can use the override option at any level of the hierarchy.

    replace

    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 the statements marked with the replace tag to the configuration.

    Note: For this operation to work, you must include replace tags in the text file or configuration you type at the terminal.

  3. Enter Ctrl+a to select all the text, and Ctrl+c to copy the contents of the text file to the clipboard.
  4. On the router, enter configuration mode:
    user@host> cli [edit]user@host#
  5. Load the configuration file:
    user@host> load merge terminal
  6. At the prompt, paste the contents of the clipboard using the mouse and the paste icon.
    [edit]user@host# load merge terminal [Type ^D at a new line to end input]> Paste the contents of the clipboard here<
  7. Press Enter.
  8. Enter Ctrl+d.
  9. Commit the configuration to activate it on the router, or you can edit the configuration interactively using the CLI and commit it at a later time.

Sample Output

The following is an example of a text file with the replace option:

interfaces {
replace:
    so-0/0/0 {
        unit 0 {
            family inet {
                address 10.1.34.1/30;
            }
        }
    }

protocols {
replace:
    isis {
        interface so-0/0/1.0 {
            level 1 metric 10;
            level 2 disable;
        }
        interface fxp0.0 {
            disable;
        }
        interface lo0.0;
    }
}

The following output is for Step 4 through Step 8:

[edit]
user@R1# load merge terminal 
[Type ^D at a new line to end input]
interfaces {
replace:
    so-0/0/0 {
        unit 0 {
            family inet {
                address 10.1.34.1/30;
            }
        }
    }
protocols {
replace:
    isis {
        interface so-0/0/1.0 {
            level 1 metric 10;
            level 2 disable;
        }
        interface fxp0.0 {
            disable;
        }
        interface lo0.0;
    }
}
load complete

Meaning

The sample output shows a configuration loaded from a text file with the replace option. For more information about loading a configuration, see the JUNOS System Basics Configuration Guide.



Load a Configuration Using the display set Command

Purpose

In configuration mode only, you can display the configuration as a series of configuration mode commands required to recreate the configuration. This is useful for users who are not familiar with how to use configuration mode commands or for users who wish to cut, paste, and edit the displayed configuration. In addition, you can duplicate the configuration of one router to another.

Action

To load a configuration from the local router to a target router, follow these steps:

  1. On the local router, enter configuration mode:
    user@R1> cli [edit]user@host#
  2. Go to the hierarchy level you want to copy. For example:
    [edit]user@R1# edit interfaces
  3. Display the series of configuration commands required to recreate the configuration. For example:
    [edit interfaces]user@R1# show | display set set interfaces so-0/0/0 unit 0 family inet accounting destination-class-usageset interfaces so-0/0/0 unit 0 family inet address 10.1.12.1/30set interfaces fxp0 unit 0 family inet address 10.168.70.143/21set interfaces lo0 unit 0 family inet address 10.0.0.1/32set interfaces lo0 unit 0 family iso address 49.0002.1000.0000.0003.00
  4. Copy each line of the configuration individually from the local router to the target router. In the target router, you must be at the top level of the configuration and in configuration mode. For example:
    mwazna@R2> edit Entering configuration mode[edit]mwazna@R2# set interfaces so-0/0/0 unit 0 family inet accounting destination-class-usage
  5. Continue cutting and pasting each line of the configuration.
  6. Commit the configuration to activate it on the router, or you can edit the configuration interactively using the CLI and commit it at a later time.

Published: 2010-01-25

[an error occurred while processing this directive]