[Contents] [Prev] [Next] [Index] [Report an Error]


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 JUNOS Internet Software Protocols, Class of Service, Chassis, and Management 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 12: 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.


  1. Enter Ctrl+a to select all the text, and Ctrl+c to copy the contents of the text file to the clipboard.
  2. On the router, enter configuration mode:
  3. user@host> cli
    
    [edit]
    
    user@host#
    
    
    
  4. Load the configuration file:
  5. user@host> load merge terminal
    
    
    
  6. At the prompt, paste the contents of the clipboard using the mouse and the paste icon.
  7. [edit]
    
    user@host# load merge terminal 
    
    [Type ^D at a new line to end input]
    
    > Paste the contents of the clipboard here<
    
    
    
  8. Hit Enter.
  9. Enter Ctrl+d.
  10. 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

What It Means

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.


[Contents] [Prev] [Next] [Index] [Report an Error]