Activating the Router Configuration

Problem

You have created or modified the router's configuration using the CLI and you want to put the configuration into effect.

Solution

Use the following command to activate a router configuration:

[edit] aviva@router1# commit commit complete [edit] aviva@router1#

 

Discussion

When you modify the configuration on the router, you are editing a copy of the router's configuration. This copy is called the candidate configuration. Any modifications that you make to the configuration are recorded only in the copy of the configuration and have no impact on the operation of the router. When you want the configuration to take effect, you must activate, or commit, it. When you do this, your configuration file is checked to make sure the syntax is correct. It is then activated, becoming the running configuration.

The commit process is a batch mode operation. While you are in configuration mode, you can make any number of changes, but these appear only in the candidate configuration and have no effect on the running configuration. You can even verify the syntax without activating the changes (with the commit check command; see Recipe 1.6). The commit command batches up all your changes (as well as changes made by anyone else who is also in configuration mode) and activates them all at once. This means that interdependent configuration segments take effect at the same time, so you don't have to worry about the order in which you add statements to the configuration.

When you activate a configuration, the JUNOS software saves a copy of it on the router. This is discussed further in Recipe 1.14.

It bears repeating that you must activate a configuration using the commit command for it to take effect. It is a common mistake to forget to commit your changes, so this is often the first thing to check when debugging an operational problem on the router. It's very easy to see how this might happen. You might make a change in the configuration and then immediately use the run command to issue an operational mode command to verify that the router behavior matches the changed configuration, or you might get interrupted or distracted while configuring and issue a run command without committing.

If you have not committed your changes, you are warned when you try to exit configuration mode and return to operational mode:

aviva@router1# exit The configuration has been changed but not committed Exit with uncommitted changes? [yes,no] (yes)

If you choose to exit without committing the changes by pressing Enter or typing yes, the changes are retained in the candidate configuration but are not activated. When you again enter configuration mode, you are reminded of the uncommitted changes:

aviva@router1> configure Entering configuration mode The configuration has been changed but not committed [edit] aviva@router1#

If you decide not to exit configuration mode just yet, you can find out what changes you (and anyone else in configuration mode) made by comparing the candidate configuration to the one that is active and running:

[edit] aviva@router1# exit The configuration has been changed but not committed Exit with uncommitted changes? [yes,no] (yes) no Exit aborted [edit] aviva@router1# show | compare [edit system services] + telnet;

Use the following command if you are not at the top of the configuration:

[edit system services] aviva@router1# top show | compare [edit system services] + telnet;

For routers with two Routing Engines, use the commit synchronize command to commit the configuration simultaneously on both Routing Engines (see Recipe 1.30).

See Also

Recipes 1.6, 1.11, 1.14, 1.15, 1.17, and 1.30

Категории