cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
54067
Views
20
Helpful
0
Comments
ashirkar
Level 7
Level 7

 

Introduction:

Command syntax of IOS XR is different than classic IOS. In this document you will learn about “Commit” command used in IOS XR. To understand this command first you need to know configuration concepts of IOS XR.

Configuration concept of IOS XR:

Cisco classis IOS support single-stage model. In single-stage model, each line of configuration that enters in the router takes immediate effect. Example: if you assign IP address to any interface, it will immediately apply as running configuration. This kind of approach doesn’t scale properly ,there could be many potential problems occurs like when you apply configuration from a file or script, It is possible for only part of the user-intended configuration to take effect due to syntax or transport error that can leaves the router configuration in an inconsistent state. 

 

Cisco IOS XR support two–stage model. In two-stage model, first stage is target configuration where user builds his configuration. In this stage, you can address both, command syntax and transport error to ensure your entire target configuration has entered in the router successfully. This target configuration doesn’t affect your router running configuration. Second stage called commit stage. In this stage, your entire target configuration will be committed using “commit” command and it will become part of your running config.

The advantages of two-stage configuration model are what configuration will become your router running config. Also when you apply your bulk configuration on router, this model helps you in doing subsequent operation such as verification, checkpointing and logging. We will see all this very closely in below configuration example.

 

comit.jpg

 

Configuration Example:

 

First, we will see single-stage model of classic IOS. As we discuss earlier, in classic IOS when we configure each line on CLI it will become part of its running config. To demonstrate, I have cisco 7200 and we will configure simple IP address on interface and verify its running config.

 

Initial running configuration:

Router#

Router#sh run int e0/0

Building configuration...

Current configuration : 54 bytes

!

interface Ethernet0/0

no ip address

shutdown

end

Router#

 

Configuring and verifying running config:

Router#conf t

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#int e0/0

Router(config-if)#ip add 10.1.1.1 255.255.255.0

Router(config-if)#no sh

*Nov 24 07:24:45.674: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up

*Nov 24 07:24:46.674: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up

 

Router(config-if)#do sh run int e0/0

Building configuration...

Current configuration : 64 bytes

!

interface Ethernet0/0

ip address 10.1.1.1 255.255.255.0

end

Router(config-if)#

 

Now let’s see IOS XR two-stage model. As you know, in IOS XR 1st stage is building config called target configuration which will not take effect immediately and become part of your running configuration unless you pass second stage called “commit”.

 

So let’s get into XR CLI and verify initial configuration.

RP/0/0/CPU0:ios#sh run int gig0/0/0/0

Sun Nov 24 17:30:18.259 TLT

interface GigabitEthernet0/0/0/0

shutdown

!

RP/0/0/CPU0:ios#

 

As you can see interface has no configuration, now let’s build target configuration.

RP/0/0/CPU0:ios#conf t

Sun Nov 24 19:34:00.708 TLT

RP/0/0/CPU0:ios(config)#hostname PE1

RP/0/0/CPU0:ios(config)#int gig0/0/0/0

RP/0/0/CPU0:ios(config-if)#description #TO CE1

RP/0/0/CPU0:ios(config-if)#ipv4 address 10.1.1.1 255.255.255.0

RP/0/0/CPU0:ios(config-if)#no sh

RP/0/0/CPU0:ios(config-if)#exit

RP/0/0/CPU0:ios(config)#

 

From the below output you can see, we have done configuration on router but still it will not apply to running config.

 

RP/0/0/CPU0:ios(config)#do sh run int gig0/0/0/0

Sun Nov 24 19:34:41.043 TLT

interface GigabitEthernet0/0/0/0

shutdown

!

RP/0/0/CPU0:ios(config)#

RP/0/0/CPU0:ios(config)#do sh ip int brie | ex un

Sun Nov 24 17:31:29.600 TLT

Interface                     IP-Address     Status                Protocol

RP/0/0/CPU0:ios(config)#

 

To view target configuration use “show configuration” command.

RP/0/0/CPU0:ios(config)#sh configuration

Sun Nov 24 19:35:23.137 TLT

Building configuration...

!! IOS XR Configuration 0.0.0

hostname PE1

interface GigabitEthernet0/0/0/0

description #TO CE1

ipv4 address 10.1.1.1 255.255.255.0

no shutdown

!

end

 

You can also see your target configuration and running using “show configuration  merge” command, which will be your next running config after you do commit.

Let’s now move to second stage “commit. After you build your target config you will need to use “command” to apply your target configuration to running configuration.

 

Following events take place for every successful commit operation:

1) Before committing, it must first lock configuration session.

2) Save config changes in the commit change database as well create rollback point.

3) Add commit changes entry into configuration history

4) Generate config change notification using syslog

5) Target config integrated into running config

6) Unlock the configuration session.

 

Let’s do commit and see what happens on router.

RP/0/0/CPU0:ios(config)#commit

Sun Nov 24 20:04:38.557 TLT

RP/0/0/CPU0:Nov 24 20:04:39.736 : config[68379]: %MGBL-CONFIG-6-DB_COMMIT : Configuration committed by user 'UNKNOWN'. Use 'show configuration commit changes 1000000015' to view the changes.

RP/0/0/CPU0:PE1(config)#

RP/0/0/CPU0:PE1(config)#do sh running-config

Sun Nov 24 20:14:33.759 TLT

Building configuration...

!! IOS XR Configuration 0.0.0

!! Last configuration change at Sun Nov 24 20:04:38 2013 by UNKNOWN

!

hostname PE1

interface GigabitEthernet0/0/0/0

description #TO CE1

ipv4 address 10.1.1.1 255.255.255.0

!

end

 

RP/0/0/CPU0:PE1(config)#

RP/0/0/CPU0:PE1(config)#do sh ip int bri | ex un

Sun Nov 24 20:15:13.561 TLT

 

Interface                     IP-Address     Status               Protocol

GigabitEthernet0/0/0/0         10.1.1.1       Up                   Up

RP/0/0/CPU0:PE1(config)#

 

From the above output you can see target config apply to running config. Also after commit command, router generate syslog message. Default the commit operation assign a commit change ID, allowing you to check the detail of the point commit. In our case commit ID is 1000000015. This ID can used to view what changes done during this commit and you can also use this to roll back your configuration.

Below output shows rollback to previous config using commit Id.

RP/0/0/CPU0:PE1#rollback configuration to ?

1000000015 Commit ID

1000000014 Commit ID

1000000013 Commit ID

1000000012 Commit ID

1000000011 Commit ID

1000000010 Commit ID

1000000009 Commit ID

1000000008 Commit ID

1000000007 Commit ID

1000000006 Commit ID

1000000005  Commit ID

1000000004 Commit ID

1000000003 Commit ID

1000000002 Commit ID

1000000001 Commit ID

RP/0/0/CPU0:PE1#rollback configuration to 1000000015

Sun Nov 24 20:25:50.455 TLT

Loading Rollback Changes.

Loaded Rollback Changes in 1 sec

Committing..

3 items committed in 2 sec (1)items/sec

Updating.

Updated Commit database in 1 sec

Configuration successfully rolled back to '1000000015'.

RP/0/0/CPU0:ios#

 

There are bunch of options available in commit operation as shown below. To get more information about these option please go through XR command guides.

RP/0/0/CPU0:PE1(config)#commit ?

best-effort   Commit the configuration changes via best-effort operation

comment       Assign a comment to this commit

confirmed     Rollback this commit unless there is a confirming commit

force         Override the memory checks

label         Assign a label to this commit

replace       Replace the contents of running configuration

save-running Save running configuration to a file

<cr>         Commit the configuration changes via pseudo-atomic operation

 

Related Information:

Cisco ASR 9k Configuration Guides

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: