Tuesday, March 29, 2016

Saving your IOS configuration in Flash rather than the Start up Configuration

Most people that need to save their configuration use "wr mem" or "copy run start" and go about their way. That works and is a classic way to save your config. But for those of us that are not in the set it and forget it mode and need to modify configs on a regular basis, like CCNA prep for instance. We have this nifty configuration option, the "copy run flash:FILENAME.conf".

This gives the ability to save the current configuration in flash but not in the start up configuration. The benefit is that when you need to learn something new or your just getting bored with learning BGP, you can save your config's with "copy run flash:FILENAME.conf" and reload the box. This works on both Routers and Switches of the physical kind, in VIRL and with VMs like CSR1000v and IOS-XRv in ESXi.

When you want to load a saved configuration you can use the "configuration replace flash:FILENAME.conf, answer yes and your saved configuration is loaded!

So how does it work? Simple!

R1#copy run flash:CCNPSP.conf < enter key
Destination filename [CCNPSP.conf]? < enter key
%Warning:There is a file already existing with this name
Do you want to over write? [confirm] < enter key
1463 bytes copied in 0.166 secs (8813 bytes/sec)

R1#dir
Directory of bootflash:/
   20  -rw-             1463  Mar 29 2016 22:23:45 +00:00  CCNPSP.conf

R1#more flash:CCNPSP.conf < will display a text output of the saved configuration file

version 15.5
service timestamps debug datetime msec
service timestamps log datetime msec
no platform punt-keepalive disable-kernel-core
platform console serial
!
hostname R1
!
< output deleted for brevity>

Now, you can reload your device and rest safely knowing that your hard work has not been lost. OK, now your device is backup, or maybe it was power cycled when you were working on something else, processes hang and stuff happens. Not to worry, lets load the that file up!

R1#configure replace flash:CCNPSP.conf < This will replace the running configuration with the saved file in flash!

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]: yes
Total number of passes: 0
Rollback Done

R1#
*Mar 29 22:29:30.499: Rollback:Acquired Configuration lock.

And there you have it. Your previously saved configurations are now loaded to the running configuration. Your limit of saved files is how much space is available in flash.

R1#dir
Directory of bootflash:/
<output deleted for brevity>
7835619328 bytes total (6516903936 bytes free)

This is a virtual machine running in ESXi 6.0 so I have about 8 GB HDD space allocated, not running out of room anytime soon!

Thanks for Reading, hope this was helpful and informative for you!

Rob Riker, CCIE #50693


No comments:

Post a Comment