SystemEXEC

rollback configuration last [n]

Rolls back the configuration to a previous commit point, reverting changes made in the last N commits.

Overview

The 'rollback configuration last [n]' command is a powerful tool in Cisco IOS-XR that allows network engineers to revert the running configuration to a previous commit point. In IOS-XR, configuration changes are not applied immediately; instead, they are staged in a candidate configuration and then committed as a single atomic transaction. Each commit creates a checkpoint in the configuration history. The rollback command leverages this history to undo changes by reverting to a state before the last n commits. This is particularly useful in production environments where a change may cause unexpected behavior, such as routing flaps, connectivity loss, or security breaches. By rolling back to a known good state, engineers can quickly restore network stability without manually undoing each change. The command operates at the EXEC mode and requires appropriate privileges. It is important to note that the rollback is a configuration-level operation; it does not affect the operational state of interfaces or processes directly, but the reverted configuration will take effect upon commit. In troubleshooting workflows, this command is often used after a failed change window or when a configuration error is detected. It is also common to use 'show configuration rollback changes last [n]' to preview the exact changes that will be applied, ensuring the rollback achieves the desired outcome. The command is specific to IOS-XR and differs from the 'configure replace' or 'rollback' commands found in other Cisco platforms.

Syntax·EXEC
rollback configuration last [n]

When to Use This Command

  • Undo an accidental configuration change that caused network instability.
  • Revert to a known good configuration after a failed upgrade or change window.
  • Quickly restore a baseline configuration during troubleshooting.
  • Roll back multiple commits at once to a specific point in the commit history.

Parameters

ParameterSyntaxDescription
nintegerSpecifies the number of previous commits to roll back. The value must be a positive integer. The system will revert the running configuration to the state before the last n commits.

Command Examples

Roll back the last configuration commit

rollback configuration last 1
Rollback operation will revert configuration to the last commit point.
Do you wish to proceed? [no]: yes
Rollback committed successfully.

The command prompts for confirmation. After confirming 'yes', the system reverts the running configuration to the state before the most recent commit.

Roll back the last 3 commits

rollback configuration last 3
Rollback operation will revert configuration to the commit point 3 commits ago.
Do you wish to proceed? [no]: yes
Rollback committed successfully.

This rolls back the last three configuration commits, effectively undoing changes made over those commits.

Understanding the Output

When you issue the 'rollback configuration last [n]' command, the system first displays a warning message indicating the number of commits that will be reverted. It then asks for confirmation with 'Do you wish to proceed? [no]:'. If you type 'yes', the rollback is executed and a success message 'Rollback committed successfully.' is displayed. If you type 'no' or press Enter, the operation is aborted. The output is minimal; there is no detailed per-commit output. To see the changes that will be applied, you can use 'show configuration rollback changes last [n]' before executing the rollback. A healthy output is the success message; any error messages indicate issues such as configuration conflicts or insufficient privileges.

Configuration Scenarios

Rolling back a failed OSPF configuration change

A network engineer added a new OSPF area and redistributed routes, but the change caused routing loops. The engineer needs to revert to the previous configuration.

Topology

N/A

Steps

  1. 1.Connect to the router via SSH or console.
  2. 2.Enter EXEC mode.
  3. 3.Use 'show configuration rollback changes last 1' to preview the changes that will be reverted.
  4. 4.If satisfied, execute 'rollback configuration last 1'.
  5. 5.Confirm the rollback by typing 'yes'.
  6. 6.Verify the configuration with 'show running-config' and check OSPF neighbor states.
Configuration
! No configuration block needed; the rollback command reverts to a previous commit.

Verify: After rollback, use 'show running-config' to confirm the OSPF configuration is as expected. Use 'show ospf neighbor' to verify OSPF adjacencies are restored.

Watch out: If the rollback fails due to a configuration conflict (e.g., an interface reference that no longer exists), the system will not apply the rollback and will display an error. Always preview changes first.

Troubleshooting with This Command

When troubleshooting network issues, the 'rollback configuration last [n]' command can be a lifesaver. If a recent configuration change is suspected to be the root cause of a problem, the first step is to identify the commit that introduced the issue. Use 'show configuration commit list' to view the commit history with timestamps and descriptions. Once the problematic commit is identified, calculate the number of commits to roll back (n). For example, if the issue started after the last commit, use n=1. Before executing the rollback, always preview the changes with 'show configuration rollback changes last [n]' to ensure the rollback will revert only the intended changes. If the preview shows unexpected changes, consider a different n value or manually edit the candidate configuration. After the rollback, verify that the issue is resolved. If the rollback fails, check for configuration dependencies that may prevent the revert. Common errors include references to interfaces or objects that were created after the target commit point. In such cases, you may need to manually remove those dependencies or use a different rollback point. Also, remember that the rollback does not save the configuration to the startup configuration; you must explicitly use 'commit' after the rollback to make the change persistent across reloads. In IOS-XR, the rollback is a commit operation itself, so it is automatically saved to the running configuration but not to the startup configuration unless you issue a separate 'commit' or 'save' command. Always save the configuration after a successful rollback to ensure it survives a reload.

CCNA Exam Tips

1.

Remember that 'rollback configuration last [n]' reverts the running configuration to the state before the last n commits, not the last n changes.

2.

Know that the rollback operation is atomic; if it fails, the configuration remains unchanged.

3.

Be aware that you can use 'show configuration rollback changes last [n]' to preview the changes before applying them.

Common Mistakes

Mistake: Forgetting to commit the current configuration before rolling back. Consequence: The rollback may revert uncommitted changes as well, leading to unexpected results.

Mistake: Using a large value for n without previewing. Consequence: You may revert more changes than intended, causing service disruption.

Mistake: Not saving the configuration after rollback. Consequence: A reload will revert to the previous saved configuration, undoing the rollback.

Platform Notes

The 'rollback configuration last [n]' command is specific to Cisco IOS-XR and is not available in classic Cisco IOS. In IOS, the equivalent functionality is provided by 'configure replace' or 'rollback' commands that use a file-based approach. In IOS-XR, the rollback is based on the commit history, which is a key difference. The commit history is stored in the system and can be viewed with 'show configuration commit list'. The number of commits retained depends on the platform and configuration, but typically the last 100 commits are kept. Another difference is that in IOS-XR, the rollback operation is atomic and does not require a reload. In contrast, some IOS platforms may require a reload for certain rollback operations. For network engineers transitioning from IOS to IOS-XR, understanding the commit model is crucial. The rollback command is also available in other network operating systems like Junos, where it is called 'rollback' and works similarly. However, the syntax and behavior may differ. In IOS-XR, the command is straightforward and does not support additional options like 'rollback to' a specific commit ID; for that, you would use 'rollback configuration to' with a commit ID. The 'last [n]' variant is the most commonly used for quick reverts. Always ensure you have the necessary privileges (typically task group 'system' or 'config') to execute the command.

Practice for the CCNA 200-301

Test your knowledge with hundreds of CCNA practice questions covering all exam domains.

Practice CCNA Questions