Network Bulls
www.networkbulls.com
Best Institute for CCNA CCNP CCSP CCIP CCIE Training in India
M-44, Old Dlf, Sector-14 Gurgaon, Haryana, India
Call: +91-9654672192
I was going to call this section “Using SDM to Upgrade/Restore/Back Up the IOS on Your
Router,” but the SDM allows management of all the files in flash memory (as well as NVRAM),
not just the IOS. It can be an easier method of flash file management, but for what it’s worth,
you won’t find it safer to do it this way. It is a way to manage your files though. Let’s check it out.
I mention “safer methods” a lot in this chapter. Clearly, I’ve caused myself
some serious pain not being careful enough when working in flash memory!
I cannot tell you enough—pay attention when messing around with flash
memory!
I’m going to connect to my other 1841 router (named R3) and upgrade that IOS using the
SDM. Let’s connect and see what’s in flash. Looking at the first screen, we can see that IP is
the only feature available and that Firewall, VPN, IPS, and NAC are “X’d” out. Let’s fix that!
284 Chapter 5 Managing a Cisco Internetwork
The next screen shows how to open the file management for flash. Chose File File
Management.
At this point, the screen shows all the files in flash, and we can see that we have the
“ipbase” IOS.
Backing Up and Restoring the Cisco IOS 285
Click Load File from PC on the top of the screen to add a new file. When I tried to load the
new IOS, I received the message shown in the next screen shot.
I clicked OK, tried to delete the existing file, and then received this message.
I chose yes, and then looked at the File Management window again to verify that the file
was deleted.
286 Chapter 5 Managing a Cisco Internetwork
I then chose Load File from PC again and the file started uploading into flash memory.
Woo-hoo—finally, success!
After rebooting, we can see that IP, Firewall, VPN, IPS, and NAC are all available with this
new IOS!
Backing Up and Restoring the Cisco Configuration 287
One of the brilliant features of the ISR routers is that they use the physical
flash cards that are accessible from the front or back of any router. You can
pull these flash cards out, put them in an appropriate slot in your PC, and the
card will show up as a drive. You can then add, change, and delete files. Just
put the flash card back in your router and power up—instant upgrade. Nice!
Backing Up and Restoring
the Cisco Configuration
Any changes that you make to the router configuration are stored in the running-config file. And
if you don’t enter a copy run start command after you make a change to running-config, that
change will go poof if the router reboots or gets powered down. So you probably want to make
another backup of the configuration information just in case the router or switch completely dies
on you. Even if your machine is healthy and happy, it’s good to have a copy for reference and
documentation reasons.
In the following sections, I’ll describe how to copy the configuration of a router to a TFTP
server and how to restore that configuration.
Backing Up the Cisco Router Configuration
To copy the router’s configuration from a router to a TFTP server, you can use either the copy
running-config tftp or the copy startup-config tftp command. Either one will back up the
router configuration that’s currently running in DRAM or that’s stored in NVRAM.
Verifying the Current Configuration
To verify the configuration in DRAM, use the show running-config command (sh run for
short) like this:
Router#show running-config
Building configuration...
Current configuration : 776 bytes
!
version 12.4
The current configuration information indicates that the router is running version 12.4 of
the IOS.
288 Chapter 5 Managing a Cisco Internetwork
Verifying the Stored Configuration
Next, you should check the configuration stored in NVRAM. To see this, use the show
startup-config command (sh start for short) like this:
Router#show startup-config
Using 776 out of 245752 bytes
!
version 12.4
The second line shows you how much room your backup configuration is using. Here,
we can see that NVRAM is 239KB (again, memory is easier to see with the show version
command when you’re using an ISR router) and that only 776 bytes of it are used.
If you’re not sure that the files are the same and the running-config file is what you want
to use, then use the copy running-config startup-config. This will help you verify that
both files are in fact the same. I’ll go through this with you in the next section.
Copying the Current Configuration to NVRAM
By copying running-config to NVRAM as a backup, as shown in the following output, you’re
assured that your running-config will always be reloaded if the router gets rebooted. In the
new IOS version 12.0, you’re prompted for the filename you want to use:
Router#copy running-config startup-config
Destination filename [startup-config]?[enter]
Building configuration...
[OK]
Router#
The reason the filename prompt appears is that there are now so many options you can use
when using the copy command:
Router#copy running-config ?
archive: Copy to archive: file system
flash: Copy to flash: file system
ftp: Copy to ftp: file system
http: Copy to http: file system
https: Copy to https: file system
ips-sdf Update (merge with) IPS signature configuration
null: Copy to null: file system
nvram: Copy to nvram: file system
rcp: Copy to rcp: file system
running-config Update (merge with) current system configuration
scp: Copy to scp: file system
startup-config Copy to startup configuration
Backing Up and Restoring the Cisco Configuration 289
syslog: Copy to syslog: file system
system: Copy to system: file system
tftp: Copy to tftp: file system
xmodem: Copy to xmodem: file system
ymodem: Copy to ymodem: file system
We’ll go over the copy command again in a minute.
Copying the Configuration to a TFTP Server
Once the file is copied to NVRAM, you can make a second backup to a TFTP server by using
the copy running-config tftp command (copy run tftp for short), like this:
Router#copy running-config tftp
Address or name of remote host []?1.1.1.2
Destination filename [router-confg]?todd-confg
!!
776 bytes copied in 0.800 secs (970 bytes/sec)
Router#
In the preceding example, I named the file todd-confg because I had not set a hostname
for the router. If you have a hostname already configured, the command will automatically use
the hostname plus the extension -confg as the name of the file.
Restoring the Cisco Router Configuration
If you’ve changed your router’s running-config file and want to restore the configuration to
the version in the startup-config file, the easiest way to do this is to use the copy startupconfig
running-config command (copy start run for short). You can also use the older
Cisco command config mem to restore a configuration. Of course, this will work only if you
first copied running-config into NVRAM before making any changes!
If you did copy the router’s configuration to a TFTP server as a second backup, you can
restore the configuration using the copy tftp running-config command (copy tftp run
for short) or the copy tftp startup-config command (copy tftp start for short), as
shown here (the old command that provides this function is config net):
Router#copy tftp running-config
Address or name of remote host []?1.1.1.2
Source filename []?todd-confg
Destination filename[running-config]?[enter]
Accessing tftp://1.1.1.2/todd-confg...
Loading todd-confg from 1.1.1.2 (via FastEthernet0/0): !
[OK - 776 bytes]
776 bytes copied in 9.212 secs (84 bytes/sec)
Router#
290 Chapter 5 Managing a Cisco Internetwork
*Mar 7 17:53:34.071: %SYS-5-CONFIG_I: Configured from
tftp://1.1.1.2/todd-confg by console
Router#
The configuration file is an ASCII text file, meaning that before you copy the configuration
stored on a TFTP server back to a router, you can make changes to the file with any text editor.
Last, notice that the command was changed to a URL of tftp://1.1.1.2/todd-config.
This is the Cisco IOS File System (IFS)—as discussed earlier—and we’ll use that to back up and
restore our configuration in a minute.
It is important to remember that when you copy or merge a configuration
from a TFTP server to a router’s RAM, the interfaces are shut down by default
and you must manually go and enable each interface with the no shutdown
command.
Erasing the Configuration
To delete the startup-config file on a Cisco router, use the command erase startup-config,
like this:
Router#erase startup-config
Erasing the nvram filesystem will remove all configuration files!
Continue? [confirm][enter]
[OK]
Erase of nvram: complete
*Mar 7 17:56:20.407: %SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram
Router#reload
System configuration has been modified. Save? [yes/no]:n
Proceed with reload? [confirm][enter]
*Mar 7 17:56:31.059: %SYS-5-RELOAD: Reload requested by console.
Reload Reason: Reload Command.
This command deletes the contents of NVRAM on the router. If you type reload at privileged
mode and say no to saving changes, the router will reload and come up into setup mode.
Using the Cisco IOS File System to Manage
Your Router’s Configuration (Cisco IFS)
Using the old, faithful copy command is still useful and I recommend it. However, you still
need to know about the Cisco IFS. The first thing we’ll do is use the show file command to
see the contents of NVRAM and RAM:
R3#show file information nvram:startup-config
nvram:startup-config:
Backing Up and Restoring the Cisco Configuration 291
type is config
R3#cd nvram:
R3#pwd
nvram:/
R3#dir
Directory of nvram:/
190 -rw- 830 <no date> startup-config
191 ---- 5 <no date> private-config
192 -rw- 830 <no date> underlying-config
1 -rw- 0 <no date> ifIndex-table
196600 bytes total (194689 bytes free)
There really are no other commands that actually show us the contents of NVRAM. However,
I am not sure how helpful it is to see them either. Let’s look at the contents of RAM:
R3#cd system:
R3#pwd
system:/
R3#dir ?
/all List all files
/recursive List files recursively
all-filesystems List files on all filesystems
archive: Directory or file name
cns: Directory or file name
flash: Directory or file name
null: Directory or file name
nvram: Directory or file name
system: Directory or file name
xmodem: Directory or file name
ymodem: Directory or file name
<cr>
R3#dir
Directory of system:/
3 dr-x 0 <no date> lib
33 dr-x 0 <no date> memory
1 -rw- 750 <no date> running-config
2 dr-x 0 <no date> vfiles
Again, not too exciting. Let’s use the copy command with the Cisco IFS to copy a file from
a TFTP host to RAM. First, let’s try the old command config net that was used for the last
10 years or so to accomplish this same feat:
R3#config net
Host or network configuration file [host]?[enter]
292 Chapter 5 Managing a Cisco Internetwork
This command has been replaced by the command:
'copy <url> system:/running-config'
Address or name of remote host [255.255.255.255]?
Although the command tells us that it has been replaced with the new URL command, the
old command will still will work. Let’s try it with the Cisco IFS:
R3#copy tftp://1.1.1.2/todd-confg system://running-config
Destination filename [running-config]?[enter]
Accessing tftp://1.1.1.2/todd-confg...Loading todd-confg from 1.1.1.2
(via FastEthernet0/0): !
[OK - 776 bytes]
[OK]
776 bytes copied in 13.816 secs (56 bytes/sec)
R3#
*Mar 10 22:12:59.819: %SYS-5-CONFIG_I: Configured from tftp://1.1.1.2/toddconfg
by console
I guess we can say that this was easier than using the copy tftp run command—Cisco says
it is, so who am I to argue? Maybe it just takes some getting used to. Let’s see if we can make
this a bit easier by connecting to our router through HTTP or HTTPS and using the SDM to
manage our configuration files.
Using the SDM to Back Up/Restore and
Edit the Router’s Configuration
Honestly, there really isn’t anything special about how the SDM handles configurations on a
router. Basically, if you were to telnet to a router, perform a show run, and copy this output
to a text file on your PC, you’ve just performed (more or less) what SDM and its configuration
management tools can do. But this is still a less-confusing way to manage files than doing so
through the Cisco IFS.
Why? Well, what’s easier about using the SDM rather than the copy command we covered
earlier in this chapter is that no TFTP host is needed. By using the SDM, you can http or https
to a router and keep all files local on your PC instead of having to configure a TFTP host. As
I mentioned in Chapter 4, SDM is best used for advanced configurations like security, IPS,
QOS, and NAT. As you can tell by now, I am a command-line interface (CLI) guy. What can
I say? Old habits die hard!
Let’s take a quick look at how the SDM can back up and restore your configuration from
your host. From the main menu, choose File Write to Startup Config to back up your configuration
to NVRAM.
Backing Up and Restoring the Cisco Configuration 293
Then choose File Save Running Config to PC.
294 Chapter 5 Managing a Cisco Internetwork
One last option for managing your files is to use the Configuration Management screens
under Additional Tasks.
The Config Editor allows you to change the running-config, but before it will let you do that,
you have to agree that you can screw up your router’s configuration and that this is okay with you!
Backing Up and Restoring the Cisco Configuration 295
It’s best to select the Save Running Configuration check box. You can then choose to
import the file from RAM or from your PC.
Last, from Configuration Management, you can choose Reset to Factory Default. This will
place the HTTPS management back on the router.
296 Chapter 5 Managing a Cisco Internetwork
As you can see, there are many different ways to screw up, umm, I mean, change the files
in flash, NVRAM, and even RAM. Practice on the SDM demo I showed you in Chapter 4, or
try to borrow a friend’s router. (You don’t want to practice these commands on your own
router, do you?)
No comments:
Post a Comment