Networking

Lock IT Down: Making backups and restoring them on a Cisco router

Learn how to back up and restore your router and how to update the IOS.


After you've learned to find your way around a Cisco router, it’s a good idea to make a backup. Contrary to popular belief, your stable, reliable router’s Internetwork Operating System (IOS) can become corrupt, so creating a backup is an important skill to master. I'll show you how to back up and restore your router and how to update the IOS. Then, I'll present an overview of some additional commands you'll find useful when you need to determine configuration and status information.

Back up and restore
You'll use the Trivial File Transfer Protocol (TFTP) to copy the router’s configuration files to a TFTP server. There are two types of configuration files: startup and running. The two are the same unless you’ve made changes to the running configuration. In that case, you have to save the running configuration to the startup configuration to ensure the changes are still there after the next reboot.

Note
To create these backups, you must be in Privileged Exec mode (the one that uses the hash sign prompt).

Use this command to copy the startup configuration to a TFTP server:
RouterName#copy start tftp

You can also copy the running configuration to the TFTP server (if, for example, you’ve just made changes to the running configuration and want to back that up to a TFTP server right away):
RouterName#copy run tftp

To copy a backed-up configuration into the router again, just reverse the source and destination. You’ll use the commands copy tftp start or copy tftp run, depending on whether you're copying to the startup or running configuration.

Back up and update the IOS
The IOS is stored in flash memory, an erasable programmable read-only memory chip (EPROM IC). To back that up to a TFTP server, issue the following command from Privileged Exec mode:
RouterName#copy flash tftp

You can also apply an IOS update to a router using a TFTP server. Once you’ve downloaded the latest version from Cisco’s site, store it on the TFTP server and use the following command to copy it to the router’s flash memory:
RouterName#copy tftp flash

Before you update, check what version of the IOS you’re running. You do that using the shortened form of the show version command:
RouterName#sh ver

Figure A shows a sample output.

Figure A


When the copying process starts, the router will prompt you for some important information:
  • Address or name of remote host? Here, you have to supply the IP address or host name of the TFTP server.
  • Source file name? This should be the name of the IOS file you want to copy (for example, c4500-d-mz.120-5.bin).
  • Destination file name? You can keep this the same as the source filename.
  • Erase flash device before writing? The router is trying to establish two things here: whether there is space in flash memory and whether you want to erase the old files in flash. As with any major change, it's best to back up your IOS from flash before you update.

Other helpful commands
To wrap up this introduction to working with Cisco routers, here are some handy commands you can use to determine configuration and status information:
  • show config displays the startup configuration and information on the interfaces and routing protocols that are configured.
  • show ip route shows the current routing information on the router. Here’s a sample output:
 
Router#sh ip route
Codes: C – connected, S – static, I – IGRP, R – RIP, M – mobile, B – BGP,
D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area, E1 – OSPF external type 1, E2 – OSPF external type 2, E – EGP, I – IS-IS, L1 – IS-IS level 1, L2 – IS-IS level 2, * - candidate default, U – per-user static route
Gateway of last resort is not set
       10.0.0.0/24 is subnetted, 5 subnets
S      10.1.3.0 [1/0] via 10.1.130.253
S      10.1.2.0 [1/0] via 10.1.128.252
C      10.1.1.0 is directly connected, Ethernet0
C      10.1.130.0 is directly connected, Serial1
C      10.1.128.0 is directly connected, Serial0
 

The command sh ip interface provides detailed information about the interface you specify, including the status of the line. So if you need detailed information about your serial 1 line, you would issue the command sh ip interface serial 1. If you don’t need that level of detail, use the brief parameter for a summary view: sh ip interface brief. You can use the same commands for information about ipx interfaces by replacing ip with ipx in these commands.
  • debug is an indispensable troubleshooting command. Learn 10 ways to mitigate problems using this command.
  • show cdp is another useful command. CDP, short for Cisco Discovery Protocol, discovers information about neighboring (directly connected) Cisco bridges, routers, and switches. It does this without your having to know the passwords of the neighboring devices. CDP is enabled by default, but if it is disabled, you can enable it with the command cdp enable or cdp run.
    Among the useful pieces of information you can obtain with the cdp command are the type of device, host names, network and data-link addresses, port identifiers (interfaces), and the model and OS version of a device. The command sh cdp neighbor gives an overview of information about neighboring devices, while the command sh cdp neighbor detail provides a more detailed output.

Editor's Picks