Problem
After you have completed making changes to the configuration, you want to activate the configuration and return to operational mode.
Solution
From the top hierarchy level, activate the configuration and exit configuration mode:
[edit] aviva@router1# commit aviva@router1# quit aviva@router1>
From a lower level in the hierarchy, commit and exit configuration mode:
[edit system] aviva@router1# commit aviva@router1# top [edit] aviva@router1# quit aviva@router1>
The following command is a quicker variation:
[edit system] aviva@router1# commit aviva@router1# exit configuration-mode aviva@router1>
From any hierarchy level, activate the configuration and exit configuration mode with a single command:
[edit system] aviva@router1# commit and-quit aviva@router1>
Discussion
The commands in this recipe show several variations of quitting configuration mode after you have committed a configuration. If you issue separate commit and quit (or exit) commands, you must be at the top level of the hierarchy (at the [edit] level) for the exit command to quit configuration mode. From a lower level, use the top command to return quickly to the [edit] level. If you use the exit command at a lower level, it returns you to the highest hierarchy from which you previously issued an edit command.
Here's an example sequence of edit and exit commands to illustrate this:
[edit] aviva@router1# edit protocols [edit protocols] aviva@router1# edit ospf [edit protocols ospf] aviva@router1# edit area 0.0.0.1 [edit protocols ospf area 0.0.0.1] aviva@router1# exit [edit protocols ospf] aviva@router1# exit [edit protocols] aviva@router1# exit [edit] aviva@router1# exit Exiting configuration mode aviva@router1>
A quicker way to commit and then exit configuration mode from a lower level in the hierarchy is to use the commit command followed by the exit configuration-mode command.
Perhaps the quickest way to commit and get back to operational mode is to use the commit and-quit command. You can use this command at any hierarchy level. One caveat is that this command succeeds only if there are no mistakes or syntax errors in the configuration. If the commit fails, the CLI shows an error message, and you remain in configuration mode.
See Also
Recipe 1.7
Router Configuration and File Management
Basic Router Security and Access Control
IPSec
SNMP
Logging
NTP
Router Interfaces
IP Routing
Routing Policy and Firewall Filters
RIP
IS-IS
OSPF
BGP
MPLS
VPNs
IP Multicast