Cisco IOS XR Configuration Management: Commit, Rollback and Replace - 夜莺博客

Cisco IOS XR Configuration Management: Commit, Rollback and Replace

Cisco IOS XR on ASR 9000, NCS and CRS platforms uses a commit-based configuration model that is completely different from classic IOS: changes go into a candidate configuration and only take effect when you commit them, which gives you atomic, reversible configuration changes. This article explains the model, the safety commands every engineer should use before a risky change (commit confirmed, rollback, commit replace), and the exact steps to recover when a commit breaks the box.

The Commit Model in 60 Seconds

In IOS XR, every session edits a candidate configuration. Nothing changes on the device until commit. Commits are numbered and stored as commit sets, so you can always return to a previous state:

RP/0/RSP0/CPU0:router(config)# interface GigabitEthernet0/0/0/0
RP/0/RSP0/CPU0:router(config-if)# ipv4 address 10.0.0.1 255.255.255.0
RP/0/RSP0/CPU0:router(config-if)# commit
Commit complete.

commit confirmed: Self-Rolling Safety Net

Before any change that could lock you out or break routing, use commit confirmed. The commit is applied, but if you do not re-commit within the timer, the router automatically rolls back:

RP/0/RSP0/CPU0:router(config)# commit confirmed 120
Commit complete.
RP/0/RSP0/CPU0:router(config)# commit
Commit complete.

If you lose connectivity, after 120 seconds the previous configuration returns automatically - the single most valuable command for remote work.

Rollback: Going Back to a Previous Commit

RP/0/RSP0/CPU0:router# show configuration commit list
1  2026-08-29 09:12:41  user  interface GigabitEthernet0/0/0/0
2  2026-08-29 09:15:03  user  BGP neighbor 10.0.0.2
3  2026-08-29 09:20:55  user  OSPF area 0
RP/0/RSP0/CPU0:router# rollback configuration commit 2
Generating configuration...
Rollback committed.

rollback configuration commit <number> reverts the running configuration to the state after that commit. You can also inspect what a rollback would change first:

show configuration rollback changes 2

commit replace: Full Configuration Replacement

When you need to load a complete new configuration (migration, config from a template), use commit replace - it atomically swaps the entire running configuration:

RP/0/RSP0/CPU0:router# configure
RP/0/RSP0/CPU0:router(config)# load /harddisk:/new-config.cfg
RP/0/RSP0/CPU0:router(config)# commit replace
Commit complete.

Anything not in the loaded configuration is removed - use commit confirmed combined with replace for safety.

Automatic Backup and Recovery

RP/0/RSP0/CPU0:router# show configuration history
RP/0/RSP0/CPU0:router# show configuration rollback changes last 5
RP/0/RSP0/CPU0:router# config-register 0x2102

Enable commit auto-save to survive a bad commit followed by a reboot:

RP/0/RSP0/CPU0:router(config)# configuration commit auto-save
RP/0/RSP0/CPU0:router(config)# commit

If the device reboots after a bad commit, auto-save restores the last committed configuration automatically.

Disaster Recovery: Locked Out of the Box

  1. Reboot the router and interrupt the boot to get to the ROMMON/Boot prompt.
  2. Load the IOS XR image with boot system or let it boot normally.
  3. If the config is broken, boot with the ignore startup-config equivalent: config-register 0x2102 at the ROMMON prompt.
  4. After boot, show configuration commit list and rollback to the last good commit.

Best Practices

  • Always commit confirmed for remote changes - set a timer longer than your expected window.
  • Use show configuration commit list to keep track of what you changed.
  • Keep a backup of show running-config on a server before major changes.
  • Never commit a candidate you did not review - show configuration displays the pending changes.

Related: Cisco IOS XR TAC command list and Cisco ASR 9000 troubleshooting commands.

原文链接:https://www.cisco.com/c/en/us/td/docs/routers/asr9000/software/asr9k-r6-4/system-management/configuration/guide/b-sysman-cg-asr9k-64x.html