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
Cisco has created a file system called Cisco IFS that allows you to work with files and directories
just as you would from a Windows DOS prompt. The commands you use are dir, copy,
more, delete, erase or format, cd and pwd, and mkdir and rmdir.
Backing Up and Restoring the Cisco IOS 279
Working with IFS gives you the ability to view and classify all files—even those on remote
servers. And you definitely want to find out if an image on one of your remote servers is valid
before you copy it, right? You also need to know how big it is—size matters here! It’s also a
really good idea to take a look at the remote server’s configuration and make sure it’s all good
before loading that file on your router.
It’s very cool that IFS makes the file system user interface universal—it’s not platform specific
anymore. You now get to use the same syntax for all your commands on all of your routers, no
matter the platform!
Sound too good to be true? Well, it kind of is because you’ll find out that support for all commands
on each file system and platform just isn’t there. But it’s really no big deal since various file
systems differ in the actions they perform; the commands that aren’t relevant to a particular file system
are the very ones that aren’t supported. Be assured that any file system or platform will fully
support all the commands you need to manage it.
Another cool IFS feature is that it cuts down on all those obligatory prompts for a lot of the
commands. If you want to enter a command, all you have to do is type all the necessary info
straight into the command line—no more jumping through hoops of prompts! So, if you want
to copy a file to an FTP server, all you’d do is first indicate where the desired source file is on
your router, pinpoint where the destination file is on the FTP server, determine the username
and password you’re going to use when you want to connect to that server, and type it all
in on one line—sleek! And for those of you resistant to change, you can still have the router
prompt you for all the information it needs and enjoy entering a more elegantly minimized version
of the command than you did before.
But even in spite of all this, your router might still prompt you—even if you did everything
right in your command line. It comes down to how you’ve got the file prompt command
configured and which command you’re trying to use. But no worries—if that happens, the
default value will be entered right there in the command, and all you have to do is hit Enter
to verify the correct values.
IFS also lets you explore various directories and inventory files in any directory you want.
Plus, you can make subdirectories in flash memory or on a card, but you only get to do that
if you’re working on one of the more recent platforms.
And get this—the new file system interface uses URLs to determine the whereabouts of a
file. So just as they pinpoint places on the Web, URLs now indicate where files are on your
Cisco router, or even on a remote file server! You just type URLs right into your commands
to identify where the file or directory is. It’s really that easy—to copy a file from one place to
another, you simply enter the copy source-url destination-url command—sweet! IFS
URLs are a tad different than what you’re used to though, and there’s an array of formats to
use that vary depending on where, exactly, the file is that you’re after.
We’re going to use Cisco IFS commands pretty much the same way that we used the copy
command in the IOS section earlier:
For backing up the IOS
For upgrading the IOS
For viewing text files
280 Chapter 5 Managing a Cisco Internetwork
Okay—with all that down, let’s take a look at the common IFS commands available to us
for managing the IOS. I’ll get into configuration files soon, but for now I’m going to get you
started with going over the basics used to manage the new Cisco IOS.
dir Same as with Windows, this command lets you view files in a directory. Type dir, hit
Enter, and by default you get the contents of the flash:/ directory output.
copy This is one popular command, often used to upgrade, restore, or back up an IOS. But
as I said, when you use it, it’s really important to focus on the details—what you’re copying,
where it’s coming from, and where it’s going to land.
more Same as with Unix, this will give you a text file and let you look at it on a card. You
can use it to check out your configuration file or your backup configuration file. I’ll go over
it more when we get into actual configuration.
show file This command will give you the skinny on a specified file or file system, but it’s
kind of obscure because people don’t use it a lot.
delete Three guesses—yep, it deletes stuff. But with some types of routers, not as well as
you’d think. That’s because even though it whacks the file, it doesn’t always free up the space
it was using. To actually get the space back, you have to use something called the squeeze
command too.
erase/format Use these with care—make sure that when you’re copying files, you say no to
the dialog that asks you if you want to erase the file system! The type of memory you're using
determines whether you can nix the flash drive or not.
cd/pwd Same as with Unix and DOS, cd is the command you use to change directories. Use
the pwd command to print (show) the working directory.
mkdir/rmdir Use these commands on certain routers and switches to create and delete
directories—the mkdir command for creation and the rmdir command for deletion. Use the
cd and pwd commands to change into these directories.
Using the Cisco IFS to Upgrade an IOS
Let’s take a look at some of these Cisco IFS commands on my ISR router (1841 series) with a
hostname of R1.
We’ll start with the pwd command to verify our default directory and then use the dir command
to verify the contents of the default directory (flash:/):
R1#pwd
flash:
R1#dir
Directory of flash:/
1 -rw- 13937472 Dec 20 2006 19:58:18 +00:00 c1841-ipbasemz.
124-1c.bin
2 -rw- 1821 Dec 20 2006 20:11:24 +00:00 sdmconfig-18xx.cfg
3 -rw- 4734464 Dec 20 2006 20:12:00 +00:00 sdm.tar
Backing Up and Restoring the Cisco IOS 281
4 -rw- 833024 Dec 20 2006 20:12:24 +00:00 es.tar
5 -rw- 1052160 Dec 20 2006 20:12:50 +00:00 common.tar
6 -rw- 1038 Dec 20 2006 20:13:10 +00:00 home.shtml
7 -rw- 102400 Dec 20 2006 20:13:30 +00:00 home.tar
8 -rw- 491213 Dec 20 2006 20:13:56 +00:00 128MB.sdf
9 -rw- 1684577 Dec 20 2006 20:14:34 +00:00 securedesktopios-
3.1.1.27-k9.pkg
10 -rw- 398305 Dec 20 2006 20:15:04 +00:00 sslclient-win-
1.1.0.154.pkg
32071680 bytes total (8818688 bytes free)
What we can see here is that we have the basic IP IOS (c1841-ipbase-mz.124-1c.bin).
Looks like we need to upgrade our 1841. You’ve just got to love how Cisco puts the IOS type
in the filename now! First, let’s check the size of the file that’s in flash with the show file command
(show flash would also work):
R1#show file info flash:c1841-ipbase-mz.124-1c.bin
flash:c1841-ipbase-mz.124-1c.bin:
type is image (elf) []
file size is 13937472 bytes, run size is 14103140 bytes
Runnable image, entry point 0x8000F000, run from ram
With a file that size, the existing IOS will have to be erased before we can add our new IOS file
(c1841-advipservicesk9-mz.124-12.bin); it’s over 21MB. We’ll use the delete command,
but remember, we can play with any file in flash memory and nothing serious happens until we
reboot—that is, if we made a mistake. So obviously, and as I pointed out earlier, we need to be
majorly careful here!
R1#delete flash:c1841-ipbase-mz.124-1c.bin
Delete filename [c1841-ipbase-mz.124-1c.bin]?[enter]
Delete flash:c1841-ipbase-mz.124-1c.bin? [confirm][enter]
R1#sh flash
-#- --length-- -----date/time------ path
1 1821 Dec 20 2006 20:11:24 +00:00 sdmconfig-18xx.cfg
2 4734464 Dec 20 2006 20:12:00 +00:00 sdm.tar
3 833024 Dec 20 2006 20:12:24 +00:00 es.tar
4 1052160 Dec 20 2006 20:12:50 +00:00 common.tar
5 1038 Dec 20 2006 20:13:10 +00:00 home.shtml
6 102400 Dec 20 2006 20:13:30 +00:00 home.tar
7 491213 Dec 20 2006 20:13:56 +00:00 128MB.sdf
8 1684577 Dec 20 2006 20:14:34 +00:00 securedesktop-ios-3.1.1.27-k9.pkg
9 398305 Dec 20 2006 20:15:04 +00:00 sslclient-win-1.1.0.154.pkg
22757376 bytes available (9314304 bytes used)
282 Chapter 5 Managing a Cisco Internetwork
R1#sh file info flash:c1841-ipbase-mz.124-1c.bin
%Error opening flash:c1841-ipbase-mz.124-1c.bin (File not found)
R1#
So with the above commands, I deleted the existing file and then verified the deletion by
using both the show flash and show file commands. Let’s add the new file with the copy
command, but again, I’m going to make sure I’m careful because this doesn’t make it safer
than the first method I showed you earlier:
R1#copy tftp://1.1.1.2//c1841-advipservicesk9-mz.124-12.bin/ flash:/
c1841-advipservicesk9-mz.124-12.bin
Source filename [/c1841-advipservicesk9-mz.124-12.bin/]?[enter]
Destination filename [c1841-advipservicesk9-mz.124-12.bin]?[enter]
Loading /c1841-advipservicesk9-mz.124-12.bin/ from 1.1.1.2 (via
FastEthernet0/0): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[output cut]
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 22103052 bytes]
22103052 bytes copied in 72.008 secs (306953 bytes/sec)
R1#sh flash
-#- --length-- -----date/time------ path
1 1821 Dec 20 2006 20:11:24 +00:00 sdmconfig-18xx.cfg
2 4734464 Dec 20 2006 20:12:00 +00:00 sdm.tar
3 833024 Dec 20 2006 20:12:24 +00:00 es.tar
4 1052160 Dec 20 2006 20:12:50 +00:00 common.tar
5 1038 Dec 20 2006 20:13:10 +00:00 home.shtml
6 102400 Dec 20 2006 20:13:30 +00:00 home.tar
7 491213 Dec 20 2006 20:13:56 +00:00 128MB.sdf
8 1684577 Dec 20 2006 20:14:34 +00:00 securedesktop-ios-3.1.1.27-k9.pkg
9 398305 Dec 20 2006 20:15:04 +00:00 sslclient-win-1.1.0.154.pkg
10 22103052 Mar 10 2007 19:40:50 +00:00 c1841-advipservicesk9-mz.124-12.bin
651264 bytes available (31420416 bytes used)
R1#
We can check the file information as well with the show file command:
R1#sh file information flash:c1841-advipservicesk9-mz.124-12.bin
flash:c1841-advipservicesk9-mz.124-12.bin:
type is image (elf) []
file size is 22103052 bytes, run size is 22268736 bytes
Runnable image, entry point 0x8000F000, run from ram
Remember that the IOS is expanded into RAM when the router boots, so the new IOS will
not run until you reload the router. So now let’s take a look at how to use the Cisco SDM to
upgrade a router’s IOS.
Backing Up and Restoring the Cisco IOS 283
I really recommend that you play with the Cisco IFS commands on a router
just to get a good feel for them because, as I’ve said, they can definitely give
you some grief at first!
No comments:
Post a Comment