commit
Commits the candidate configuration to the running configuration in Cisco IOS-XR.
Overview
The 'commit' command in Cisco IOS-XR is a fundamental operation that applies the candidate configuration to the running configuration. Unlike Cisco IOS where changes are immediate, IOS-XR uses a two-phase commit model: changes are first made to a candidate configuration (in config mode) and then explicitly committed. This provides transactional integrity, allowing multiple changes to be applied atomically. The command is used after any configuration modification, whether via CLI, NETCONF, or RESTCONF. It is essential for change management, as it supports comments, labels, and confirmed commits for safe deployment. In troubleshooting workflows, commit is used to apply fixes; if a fix causes issues, 'commit confirmed' allows automatic rollback. Platform-specific behavior includes the ability to commit partial configurations and the use of 'commit replace' to overwrite the entire running config. Understanding commit is critical for IOS-XR network engineers.
commit [comment <line>] [confirmed [<minutes>] [commit-id <id>]] [label <label>] [replace] [force]When to Use This Command
- After making configuration changes in config mode, commit them to make them active.
- Use 'commit confirmed' to test a configuration change with automatic rollback if not confirmed.
- Use 'commit comment' to add a description for auditing or change management.
- Use 'commit replace' to replace the entire running configuration with the candidate.
Parameters
| Parameter | Syntax | Description |
|---|---|---|
| comment | comment <line> | Adds a descriptive comment to the commit for auditing purposes. The comment is stored in the commit history. |
| confirmed | confirmed [<minutes>] [commit-id <id>] | Applies the configuration temporarily. If not confirmed with another 'commit' within the specified minutes (default 10), the configuration is automatically rolled back. |
| label | label <label> | Assigns a user-defined label to the commit, which can be used later for rollback or identification. |
| replace | replace | Replaces the entire running configuration with the candidate configuration. Use with caution as it removes all existing configuration not present in the candidate. |
| force | force | Forces the commit even if there are warnings or non-fatal errors. Use sparingly as it may bypass important checks. |
Command Examples
Basic commit
commitCommit complete.
The candidate configuration is applied to the running configuration.
Commit with comment
commit comment Adding BGP peer 10.1.1.1Commit complete.
The commit is recorded with a comment for audit trail.
Commit confirmed with 5-minute timer
commit confirmed 5Commit complete. Use 'commit' within 5 minutes to confirm, or configuration will be rolled back.
The configuration is applied temporarily. If not confirmed within 5 minutes, it reverts.
Commit with label
commit label config-v1.0Commit complete.
The commit is labeled for easier identification in rollback operations.
Understanding the Output
The commit command typically outputs 'Commit complete.' on success. If there are errors, it will display error messages detailing the issue, such as syntax errors or semantic validation failures. In case of 'commit confirmed', the output includes a reminder to confirm within the specified time. The output is minimal; detailed commit history can be viewed with 'show commit list'. A healthy commit shows no errors; problems are indicated by error messages that must be resolved before the commit succeeds.
Configuration Scenarios
Adding a Loopback Interface
A network engineer needs to add a loopback interface for management purposes.
Topology
Single router: R1Steps
- 1.Enter config mode: configure terminal
- 2.Create loopback interface: interface Loopback0
- 3.Assign IP address: ipv4 address 10.0.0.1 255.255.255.255
- 4.Exit interface config: exit
- 5.Commit the changes: commit
! interface Loopback0 ipv4 address 10.0.0.1 255.255.255.255 ! commit
Verify: Use 'show ipv4 interface brief' to verify the loopback is up.
Watch out: If you forget to commit, the interface will not appear in the running config.
Using Commit Confirmed for BGP Peering
Adding a new BGP peer; engineer wants a safety net in case the peering causes issues.
Topology
R1 (AS 65001) connected to R2 (AS 65002)Steps
- 1.Enter config mode: configure terminal
- 2.Configure BGP: router bgp 65001
- 3.Add neighbor: neighbor 10.1.1.2 remote-as 65002
- 4.Exit BGP config: exit
- 5.Commit confirmed with 5-minute timer: commit confirmed 5
- 6.Test connectivity; if successful, confirm with 'commit'
! router bgp 65001 neighbor 10.1.1.2 remote-as 65002 ! commit confirmed 5
Verify: Use 'show bgp summary' to check peering state.
Watch out: If you do not confirm within 5 minutes, the BGP configuration is removed automatically.
Troubleshooting with This Command
When troubleshooting configuration issues, the 'commit' command is used to apply changes. If a commit fails, error messages indicate the problem, such as invalid syntax or semantic errors (e.g., duplicate IP). Use 'show commit changes' to review what will be committed. For rollback, 'rollback' command can revert to a previous commit. In case of a failed commit, the candidate configuration remains unchanged, and you can correct errors before retrying. The 'commit confirmed' feature is invaluable for testing changes safely; if the change causes loss of connectivity, the router will automatically revert after the timer expires. Always verify the commit with 'show running-config' or relevant show commands. For complex changes, consider using 'commit comment' to document the change for future troubleshooting.
CCNA Exam Tips
Remember that 'commit' is mandatory in IOS-XR; changes are not applied until committed.
Know the difference between 'commit' and 'commit confirmed' for rollback scenarios.
Understand that 'commit replace' can be used to revert to a previous configuration.
Common Mistakes
Forgetting to commit after making changes, leaving them in candidate only.
Using 'commit confirmed' without later confirming, causing unexpected rollback.
Not using 'commit comment' for audit trails in production environments.
Platform Notes
In Cisco IOS-XR, the commit model differs significantly from Cisco IOS. In IOS, changes are immediate; in IOS-XR, they are staged. Equivalent commands on other platforms: Juniper Junos uses 'commit' similarly; Arista EOS uses 'write memory' or 'copy running-config startup-config' but changes are immediate. IOS-XR also supports 'commit replace' which is similar to 'load override' in Junos. Version differences: In older IOS-XR versions, 'commit' was not available in all modes; modern versions support it universally. The 'commit confirmed' feature is similar to 'commit confirmed' in Junos. Always check the specific IOS-XR version for any nuances.
Practice for the CCNA 200-301
Test your knowledge with hundreds of CCNA practice questions covering all exam domains.
Practice CCNA Questions