cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5955
Views
15
Helpful
7
Replies

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.

1 Accepted Solution

Accepted Solutions

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.

View solution in original post

7 Replies 7

Joe Clarke
Cisco Employee
Cisco Employee

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.

thnx Joe,

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

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.

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??

Martin Ermel
VIP Alumni
VIP Alumni

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

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...

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.

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:

Innovations in Cisco Full Stack Observability - A new webinar from Cisco