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

Answered Question
Jun 8th, 2008

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.

I have this problem too.
0 votes
Correct Answer by Joe Clarke about 8 years 5 months ago

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.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (4 ratings)
Loading.
Joe Clarke Sun, 06/08/2008 - 23:31

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.

er_yogendrasingh Sun, 06/08/2008 - 23:39

thnx Joe,

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

Joe Clarke Sun, 06/08/2008 - 23:42

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.

er_yogendrasingh Sun, 06/08/2008 - 23:49

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 Mon, 06/09/2008 - 00:07

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

er_yogendrasingh Mon, 06/09/2008 - 00:46

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

Correct Answer
Joe Clarke Mon, 06/09/2008 - 07:56

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.

Actions

This Discussion