Backing up and restoring Cisco router/switch configuration files using TFTP is one of the topics of the CCNA certification exam. In this guide, you will learn how to back up and recover Cisco switch/router configurations using a TFTP server. These procedures are easy and require a few straightforward steps. But first, let’s take a look at how TFTP works.

What is TFTP and How Does it Work?

TFTP stands for Trivial File Transfer Protocol. It is a pretty simple file transfer protocol that is used to share files through a network.

TFTP uses UDP as its Layer 4 protocol and port 69 to initiate file transfer requests. Unlike FTP, TFTP does not support authentication.

TFTP client and server exchange files using ephemeral port numbers, ranging from 1024 to 65535. Both the client and server independently choose the UDP port to transfer data during the negotiation of the transfer request.

TFTP uses five packet types:

  • Read request (RRQ)
  • Write request (WRQ)
  • Data (DATA)
  • Acknowledgment (ACK)
  • Error (ERROR)

Here are the steps a TFTP connection goes through when downloading a file from a TFTP server to a TFTP client:

Step 1. The client initiates a read request by sending an RRQ packet to the server at port number 69. The request includes a filename and a transfer mode.

Step 2. The server acknowledges the RRQ packet using a DATA packet that is sent from a random UDP port number in the range 1024 to 65535. The client uses that port number to send upcoming TFTP DATA packets to the server.

Step 3. The server starts sending numbered DATA packets to the destination host. Each data packet, except the last one, has a unique sequence number and includes a full-sized block of data.

Step 4. The client confirms the reception of each DATA packet using numbered ACK packet.
The server confirms the reception of the ACK of the first sent data block with the DATA packet of the next block.

Step 5. If an ACK is not eventually received from the client, the server runs a retransmit timer to send the corresponding DATA packet.

Step 6. The server signals the end of the file transfer to the client by sending a DATA packet with a size equal to 0 or smaller than the full size. If the size of the file being sent is not multiple of a full-sized block, the DATA packet’s size would not be equal to 0; otherwise, it would.

When uploading a file to a TFTP server, the client and the server go through similar steps, except that the client uses a WRQ packet to initiate the file transfer session.

In the rest of this tutorial, I will be using the following network diagram. The network consists of three devices: a Cisco router, a Cisco Switch, and a TFTP server. You can get and install a free TFTP server app from this link.

How To Backup Cisco Router/Switch Configuration Files Using a TFTP Server

Backing up a Cisco router/switch configuration file is a straightforward procedure; here are the steps to follow:

Step 1. Configure a TFTP server. There are several free TFTP software online like Tftpd64 and 3Com Daemon.

Step 2. Connect the Cisco router/switch to the computer hosting the TFTP server app.

Step 3. Configure IP addresses on both the router/switch and the TFTP server.

Switch> enable
Switch# conf t
Switch(config)# hostname SW1
SW1(config)# interface vlan 1
SW1(config-if)# ip address 172.16.0.2 255.255.255.0
SW1(config-if)# no shutdown

Step 4. Ping the TFTP server from the router/switch to ensure both devices can connect.

SW1# ping 172.16.0.10

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.0.10, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/0 ms

Step 5. Access the Cisco router/switch’s CLI via a console cable, Telnet, or SSH.

Step 6. In enable mode, issue the copy startup-config tftp: command or the copy running-config tftp: command to backup the startup configuration file or the running configuration file, respectively. Both commands would prompt you for a name under which to store the configuration file on the TFTP server, and the IP address of the TFTP server.

In this example, we save SW1’s running configuration file using the name “SW1-running-config.cfg” to the TFTP server with IP address 172.16.0.10.

SW1# copy running-config tftp:
Address or name of remote host []? 172.16.0.10
Destination filename [SW1-confg]? SW1-running-config.cfg

Writing running-config...!!
[OK - 1089 bytes]

1089 bytes copied in 0 secs

Step 8.  Open the folder where the TFTP server stores files to check that a copy of the configuration file is there. If you are using Packet Tracer, click the icon of the TFTP server, open the services tab, and then click TFTP in the Services section. You will get a screen like this.

How To Restore Cisco Router/Switch Configuration Files from a TFTP Server

Restoring a configuration file from a TFTP is similar to backing up a file from a TFTP server. Here are the steps to restore a Cisco router/switch configuration file (startup/running configuration):

Step 1. Set up a TFTP server.

Step 2. Connect the Cisco router/switch directly or through another network device to the TFTP server.

Step 3. Configure IP addresses on both the router/switch and the TFTP server.

Router> enable
Router# conf t
Router(config)# hostname R1
R1(config)# interface gigabitEthernet 0/0
R1(config-if)# ip address 172.16.0.1 255.255.255.0
R1(config-if)# no shutdown

Step 4. Ping the TFTP server from the router/switch to make sure both devices can connect.

R1# ping 172.16.0.10

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.0.10, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/0 ms

Step 5. Connect to the Cisco router/switch’s CLI via a console cable, Telnet, or SSH.

Step 6. In privileged EXEC mode, issue the copy tftp: startup-config command or the copy tftp: running-config command to recover the startup configuration file or the running configuration file, respectively. Both commands would ask you to supply the name of the source file that will be used to replace the content of the chosen configuration file, confirm the name of the configuration file to restore, and enter the IP address of the TFTP server.

R1# copy tftp: startup-config
Address or name of remote host []? 172.16.0.10
Source filename []? R1-running-config.txt
Destination filename [startup-config]?      ! press Enter key

Accessing tftp://172.16.0.10/R1-running-config.txt...
Loading R1-running-config.txt from 172.16.0.10: !
[OK - 18057 bytes]

18057 bytes copied in 1 secs

Step 8.  Using the more command, display the current content of the recovered file. Also, review all lines that are starting with “AAA” to make sure that authentication is properly configured so that you don’t risk being locked out of the router/switch.

Backup and Restore Cisco Switch/Router Configuration Files Using a TFTP Server in Packet Tracer

Here is a Packet tracer lab file that you can download in order to practice the Cisco IOS commands used to backup and restore Cisco switch/router configurations using a TFTP server.

Click here to download the lab file.

Troubleshooting Backing up and Restoring Cisco Router/Switch Configurations Using a TFTP Server

The backup process may fail because of one of these reasons:

  • The TFTP service is down
  • The TFTP server is unreachable because of bad IP addressing on the client or the server, or due to routing issues in the network.
  • Incorrect or inexistent source/destination file name.
  • An ACL is blocking TFTP traffic between the client and the server.

151 Labs to Help You Pass the CCNA Exam and Make Yourself More Competitive in The Job Market. Download Now!

Related Lessons to How To Backup and Restore Cisco Switch/Router Configuration Files Using TFTP Server

Conclusion

I hope this blog post helps you learn something.
Now I’d like to turn it over to you:
What did you like about this tutorial?
Or maybe you have an excellent idea that you think I need to add.
Either way, let me know by leaving a comment below right now.

Mohamed Ouamer
Mohamed Ouamer is a computer science teacher and a self-published author. He taught networking technologies and programming for more than fifteen years. While he loves to share knowledge and write, Mohamed's best passions include spending time with his family, visiting his parents, and learning new things.