Image of Jeremy L. Gaddis, CCNA, CCNP (and Cortney, in case you were wondering)

Backing Up Cisco IOS Configurations to a TFTP Server

by Jeremy L. Gaddis on September 19, 2011 · 0 comments

Post image for Backing Up Cisco IOS Configurations to a TFTP Server

In the previous article, you learned what TFTP is used for and how to install a TFTP server. While preparing for the CCNA test, you’ll use TFTP primarily for these purposes:

  • Backing up and restoring IOS configuration files
  • Backing up Cisco IOS software
  • Upgrading IOS on routers and switches

There are a few other ways we can use TFTP as well (such as booting an IOS image from a TFTP server instead of flash after a Bad Thing™ happens), but in this article we’ll going to focus just on backing up our configuration files.

Why Back Up Configuration Files?

Have you ever lost an important file on your computer or had a hard drive crash? It can be either a minor inconvenience or a major catastrophe, depending on the data that was lost. Unfortunately, when — not if — a router or switch fails it can affect tens, hundreds, or potentially even thousands of users.

As a network engineer, your job is to keep the network up and running. When problems arise, getting things working again as quickly as possible is key.

Because files are important to the company, server administrations back up the data and files on the servers that they’re responsible for (otherwise, they won’t be server administrators for very long!). As network engineers, the configuration files on our routers and switches are quite possibly the most important pieces of data that we’re responsible for. We simply can’t afford not to have backups of them.

Even though they’re (usually) quite reliable, routers and switches do occasionally fail. At some point in your career, it will almost certainly happen to you. Other times, a simple mistake when changing the configuration may take the network down. When we have backups of our configurations, getting the network up and running again is much easier.

copy startup-config tftp

Back in Erasing and Saving Configurations on Cisco Devices, you learned how to save the running-configuration and make it your startup-configuration using the copy running-config startup-config command (or copy run start, for short).

Variations of the copy command are used to copy device configurations to a TFTP server, using either copy run tftp or copy start tftp. As you might guess, the former copies your running-configuration and the latter copies your startup-configuration. You’ll generally make your changes, save them (by copying the running-configuration to the startup-configuration) and then copy the startup-configuration to the TFTP server.

We need something useful to actually back up for this article and subsequent ones, so I’ve created a small two-router network based off of the Free CCNA Labs Topology. I’m using the PHOENIX and DALLAS routers, connected via their Serial 1/1 interfaces. In addition, PHOENIX’s Ethernet 0/0 interface is connected to a physical network where the TFTP server resides. Here’s what our topology looks like:

TFTP Topology

If you wish to follow along (which I encourage), here are the relevant parts of the configuration of the two routers:

PHOENIX:

!
interface Ethernet0/0
 description CONNECTION TO PHYSICAL ETHERNET NETWORK
 ip address 192.0.2.236 255.255.255.0
!
interface Serial1/1
 description CONNECTION TO DALLAS SERIAL 1/1
 ip address 192.168.12.1 255.255.255.252
!

DALLAS:

!
interface Serial1/1
 description CONNECTION TO PHOENIX SERIAL 1/1
 ip address 192.168.12.2 255.255.255.252
!

As you can see, this is the bare minimum configuration we need to facilitate the connections but it is sufficient to demonstrate the concept. Backing up the startup-configuration on PHOENIX to our TFTP server is actually quite simple.

First, let’s verify that we actually have connectivity between the router and the TFTP server. We’ll do this using the ping command, which you learned about in Using ping for Troubleshooting and Verification.

PHOENIX# ping 192.0.2.235
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.0.2.235, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/16 ms
PHOENIX#

The pings were successful, indicating that we can communicate with the TFTP server. Once we know that we have connectivity we can proceed with backing up the startup-configuration:

PHOENIX# copy startup-config tftp
Address or name of remote host []? 192.0.2.235
Destination filename [phoenix-confg]? phoenix.cfg
!!
1282 bytes copied in 0.027 secs (47481 bytes/sec)

PHOENIX#

Upon issuing the copy startup-config tftp command, the router prompted me for the IP address of the TFTP server (the “remote host”) which is 192.0.2.235. Next, I was asked what I would like the file to be named when it is saved on the TFTP server. I could have simply pressed <ENTER> and the router would have used the filename “phoenix-confg” (you can see the default listed in the output above), but I chose to name it “phoenix.cfg”.

NOTE: Because you’ll often retain multiple backups of a device’s configuration over time, choosing meaningful names for the backup files is important.

If you view the files on your TFTP server, you would see that a file named “phoenix.cfg” now exists. If you open that file with a text editor (such as Notepad++), you’ll be able to view the configuration, such as in the screenshot below:

Startup configuration on TFTP server

 

In addition, instead of having the router prompt us for the IP address and filename, we can simply tell the router what they are at the same time we issue the copy command (although we’ll still have to confirm them). We do this simply by passing the router a complete URL instead of just the tftp parameter.

Using the same IP address and filename as above, our URL would look like this:

tftp://192.0.2.235/phoenix.cfg

Summary

Since routers and switches do fail, having backups of their configurations is absolutely critical. In this article, you learned how to back up your configurations to a TFTP server. In the next few articles, we’ll look at restoring the IOS configuration file, backing up Cisco IOS software, and how to upgrade Cisco IOS on a router.

Image Source

Previous post:

Next post: