Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

Overwrite Running Config Rather Than Merge On A Cisco Router using CWCLI

is there any command available in cwcli in which directly I can overwrite Running Config Rather Than Merge On A Cisco Router managed by Ciscoworks.

  • Network Management
1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

Re: Overwrite Running Config Rather Than Merge On A Cisco Router

write2start would be the best way to go as it would absolutely ensure you a clean running config after reload. I didn't mention it because I had assumed you did want a reload.

As mermel said, write2run comes the closest without a reload, but may still leave some residual cruft. Depending on the config it might be sufficient. Else, you can use my import idea, and do the cleaning yourself.

7 REPLIES
Cisco Employee

Re: Overwrite Running Config Rather Than Merge On A Cisco Router

Not directly, but you could create a file which contains all the necessary commands to overwrite a device's config with a new config. For example, use cwcli config export to export an archived version of a device's config. Modify this file with the necessary commands to backout any unwanted changes on the device, then push the file back using cwcli config import.

New Member

Re: Overwrite Running Config Rather Than Merge On A Cisco Router

thnx Joe,

but would in this case also configuration at router will be appended or overwritten?

Cisco Employee

Re: Overwrite Running Config Rather Than Merge On A Cisco Router

It will still be merged, but the result would be that unwanted commands would be removed. For example, if you wanted to remove aaa new-model from a device, you would add:

no aaa new-model

To your import file along with other commands you wish to add. The net result is that the device's config will no longer have aaa new-model after the import.

New Member

Re: Overwrite Running Config Rather Than Merge On A Cisco Router

suggestion looks great joe, but in automation user might not be knowing which commands to be remove from the file,

as part of automation; desired file should be applied to the router without any un-wanted commands.

One method could be... to copy the config directly to startup config and reloading router without saving the running conf.. is there any method available to copy a config file directly to start up config??

Re: Overwrite Running Config Rather Than Merge On A Cisco Router

you should be able to perform a 'write2start' [cwcli config write2start ...] followed by a 'reload' job [cwcli config reload ...]

@ jclarke

what is about the

'write2run' job [cwcli config write2run ...]

the online help says

[...]

write2run compares the latest running configuration for the device in the configuration archive with the configuration in the file specified by the -f argument to generate a new configuration that is downloaded to the device, so that the end result is that the configuration specified in the file is available on the running configuration of the device.

[...]

ok, there is a caveat mentioned, but in general it should do what er_yogendrasingh wants to do or is there any rub in it ?

the online help for details and the caveat for the 'write2run' option:

http://your_LMS_server:1741/help/rme/fundamentals/index.html?config_PrfConfigMgmtAdminTsks.html

New Member

Re: Overwrite Running Config Rather Than Merge On A Cisco Router

Hey Joe,mermel , I must say your suggestions always work for me :-)

requirement is to have a fresh configuration on the router whatever specified in the config file. but write2run, I guess would again merge the configuration , yes, after executing write2run Job i would be having all the configuration i want but there would be other un wanted configuration also. am I right.

I feel write2start would solve the purpose but this approach of course would require router to reboot...

Cisco Employee

Re: Overwrite Running Config Rather Than Merge On A Cisco Router

write2start would be the best way to go as it would absolutely ensure you a clean running config after reload. I didn't mention it because I had assumed you did want a reload.

As mermel said, write2run comes the closest without a reload, but may still leave some residual cruft. Depending on the config it might be sufficient. Else, you can use my import idea, and do the cleaning yourself.

2287
Views
15
Helpful
7
Replies