networking-forum.com
Community BlogCommunity Wiki * Register  * Search  * Login
View unanswered postsView active topics

All times are UTC - 6 hours [ DST ]



Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Fri Jan 27, 2012 10:33 am 
Offline
Senior Member
Senior Member
User avatar

Joined: Thu Sep 17, 2009 3:06 pm
Posts: 272
Is it possible to clear Cisco router/switch running-config without reloading the device?

I tried this:

Code:
R1#write erase !erases "nvram:" where "startup-config" is stored                       
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
[OK]
Erase of nvram: complete
R1#dir nvram:                         
Directory of nvram:/

  190  -rw-           0                    <no date>  startup-config
  191  ----           0                    <no date>  private-config
  192  -rw-           0                    <no date>  underlying-config
    1  -rw-           0                    <no date>  ifIndex-table

196600 bytes total (195524 bytes free)
R1#copy startup-config running-config !tried to copy blank startup-config to running-config, but this wasn't allowed
%% Non-volatile configuration memory invalid or not present
R1#



..and this:

Code:
R1#dir nvram:startup-config
Directory of nvram:/startup-config

  190  -rw-         770                    <no date>  startup-config

196600 bytes total (194749 bytes free)
R1#delete nvram:startup-config
Delete filename [startup-config]?
Delete nvram:startup-config? [confirm]
[OK]
R1#delete nvram:startup-config
Delete filename [startup-config]?
Delete nvram:startup-config? [confirm]
[OK]
R1#dir nvram:startup-config   
Directory of nvram:/startup-config

  190  -rw-           5                    <no date>  startup-config

196600 bytes total (195514 bytes free)
R1#more nvram:startup-config !startup-config contains only word "end"
end

R1#copy startup-config running-config !as you can see, hostname is still "R1" and all the other running configuration is in place as well
Destination filename [running-config]?

5 bytes copied in 0.044 secs (114 bytes/sec)
R1#


Any ideas? :roll: Or is this possible at all?


Top
 Profile  
 
PostPosted: Fri Jan 27, 2012 10:57 am 
Offline
Post Whore
Post Whore
User avatar

Joined: Thu Oct 14, 2010 4:39 am
Posts: 1003
Certs: CCNP (R&S, Security), ITILv3 Foundation
configure replace ought to do it.
there may be some individual processes that need to be reloaded or so I'd expect.

http://www.cisco.com/en/US/docs/ios/12_ ... ollbk.html


Top
 Profile  
 
PostPosted: Fri Jan 27, 2012 1:51 pm 
Online
Post Whore
Post Whore
User avatar

Joined: Tue Aug 21, 2007 2:15 pm
Posts: 8294
Location: Frederick MD
Certs: Instanity
if you erased the running-config
your switch would cease to function.
I don't know why you'd want to do this

_________________
"If you're good at anticipating the human mind. It leaves nothing to chance."
-Jigsaw


Top
 Profile  
 
PostPosted: Sun Jan 29, 2012 2:18 am 
Offline
Ultimate Member
Ultimate Member
User avatar

Joined: Sun Jan 04, 2009 6:28 pm
Posts: 713
Location: Singapore
Certs: CCNA, CCDA, CCNA-SECURITY
you will need to reload. startup config is stored in NVRAM and is loaded upon initial bootup.
99% sure that you cant reset a running config with out undoing all of the configure commands with a "no"
I can see what you are asking to be helpful in a lab environment however, need to reload im affraid.

_________________
CCNA, CCDA, CCNA-SECURITY


Top
 Profile  
 
PostPosted: Sun Jan 29, 2012 2:11 pm 
Offline
Senior Member
Senior Member
User avatar

Joined: Thu Sep 17, 2009 3:06 pm
Posts: 272
As Halo told, it's possible with configure replace. For example I configured few settings under global and interface configuration mode:

Code:
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#no logging console
Router(config)#int fa0/0
Router(config-if)#descr test
Router(config-if)#ip addr 10.10.10.1 255.255.255.252
Router(config-if)#exit
Router(config)#hostname R1
R1(config)#end
R1#


..copied running-config to startup-config:

Code:
R1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
R1#


..then deleted startup-config:

Code:
Router#delete nvram:startup-config
Delete filename [startup-config]?
Delete nvram:startup-config? [confirm]
[OK]
Router#


..and finally replaced the running-config with empty startup-config:

Code:
Router#conf replace nvram:startup-config
This will apply all necessary additions and deletions
to replace the current running configuration with the
contents of the specified configuration file, which is
assumed to be a complete configuration, not a partial
configuration. Enter Y if you are sure you want to proceed. ? [no]: y
Overwriting with a file sized 50% or less than running config's. Proceed? [no]:
Rollback:Acquired Configuration lock.y

The rollback configlet from the last pass is listed below:
********

!List of Commands:
default service timestamps debug uptime
default service timestamps log uptime
default service password-encryption
no hostname Router
no boot-start-marker

no boot-end-marker

default ip cef
interface FastEthernet0/0
 no duplex auto
 no speed auto
interface FastEthernet1/0
 no duplex auto
 no speed auto
interface FastEthernet2/0
 no duplex auto
 no speed auto
interface FastEthernet3/0
 no duplex auto
 no speed auto
default ip http server
default ip forward-protocol nd
line vty 0 4
 default login
end
********


Rollback aborted after 5 passes
Router#



However, for example on Cisco 7200(Version 15.0(1)M) replacing the running-config with blank startup-config doesn't work:

Code:
R1#configure replace nvram:startup-config
This will apply all necessary additions and deletions
to replace the current running configuration with the
contents of the specified configuration file, which is
assumed to be a complete configuration, not a partial
configuration. Enter Y if you are sure you want to proceed. ? [no]: y

%The input file is not a valid config file.

R1#


In lab environment it's good to have some sort of archived configuration template and once work is done one can reload the default configuration with it:

Code:
R1#show archive
The maximum archive configurations allowed is 14.
There are currently 1 archive configurations saved.
The next archive file will be named disk0:/conf-1
 Archive #  Name
   1        disk0:/conf-0 <- Most Recent
   2         
   3         
   4         
   5         
   6         
   7         
   8         
   9         
   10       
   11       
   12       
   13       
   14       
R1#conf replace disk0:/conf-0
This will apply all necessary additions and deletions
to replace the current running configuration with the
contents of the specified configuration file, which is
assumed to be a complete configuration, not a partial
configuration. Enter Y if you are sure you want to proceed. ? [no]: y
% Warning: use /31 mask on non point-to-point interface cautiously
Total number of passes: 1
Rollback Done

Router#


Top
 Profile  
 
PostPosted: Tue Jan 31, 2012 9:33 am 
Online
Post Whore
Post Whore
User avatar

Joined: Tue Aug 21, 2007 2:15 pm
Posts: 8294
Location: Frederick MD
Certs: Instanity
in my lab, I store a base config in NVRAM, then when I want to clear the configs
I use the configure replace nvram:saved.config, reload and its back to the base config.

_________________
"If you're good at anticipating the human mind. It leaves nothing to chance."
-Jigsaw


Top
 Profile  
 
PostPosted: Tue Jan 31, 2012 7:01 pm 
Offline
Post Whore
Post Whore
User avatar

Joined: Thu Oct 14, 2010 4:39 am
Posts: 1003
Certs: CCNP (R&S, Security), ITILv3 Foundation
Another one I learned about is configure confirm. I think that one even saves a temporary version of the running config prior to the user making changes.


Top
 Profile  
 
PostPosted: Thu Feb 02, 2012 4:25 am 
Offline
Senior Member
Senior Member
User avatar

Joined: Thu Sep 17, 2009 3:06 pm
Posts: 272
Halo wrote:
Another one I learned about is configure confirm. I think that one even saves a temporary version of the running config prior to the user making changes.


Yes, it's possible to rollback your changes using the kron and configure replace nvram:startup-config force. Basically it provides something similar to commit confirm in Juniper devices :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group