Backing up and restoring Cisco IOS image files is one of the subjects of the CCNA exam. In this blog post, you will learn how to back up Cisco switch/router images using a TFTP server. The process is easy and only needs a few simple 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 next sections, 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 download and install a free TFTP server from this link.

How To Backup Cisco Switch Images Using a TFTP Server

Backing up a Cisco switch IOS image file is a straightforward process; just follow these steps:

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

Step 2. Connect the Cisco switch directly or through another network device to the machine hosting the TFTP service.

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

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

Step 4. Ping the TFTP server from the switch to make sure both devices can communicate.

SW1# ping 10.0.0.10

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.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 switch’s CLI via a console cable, Telnet, or SSH.

Step 6. In enable mode, issue the show flash: command to display the current images stored in the flash memory.

SW1# show flash:
Directory of flash:/

    1  -rw-     4670455            2960-lanbasek9-mz.150-2.SE4.bin

64016384 bytes total (59345929 bytes free)

Step 7. In enable mode, issue the copy flash: tftp command to start the backup process. The command prompts you for the name of the Cisco IOS image to copy, the name under which to store the image file on the TFTP server, and the IP address of the TFTP server.

SW1# copy flash: tftp
Source filename []? 2960-lanbasek9-mz.150-2.SE4.bin
Address or name of remote host []? 10.0.0.10
Destination filename [2960-lanbasek9-mz.150-2.SE4.bin]? 2960-lanbasek9-mz.150-2.SE4-copy.bin

Writing 2960-lanbasek9-mz.150-2.SE4.bin...!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 4670455 bytes]

4670455 bytes copied in 0.105 secs (3576073 bytes/sec)

Step 8.  Go to the folder where the TFTP stores files to verify that the Cisco IOS image is there.

How To Backup Cisco Router Images Using a TFTP Server

Here are the steps to back up a Cisco router IOS image file:

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

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

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

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

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

R1# ping 10.0.0.10

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.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’s CLI via a console cable, Telnet, or SSH.

Step 6. In enable mode, issue the show flash: command to display the current router image files stored in the flash memory.

R1# show flash:

System flash directory:
File  Length   Name/status
  3   33591768 c1900-universalk9-mz.SPA.151-4.M4.bin
  2   28282    sigdef-category.xml
  1   227537   sigdef-default.xml
[33847587 bytes used, 221896413 available, 255744000 total]
249856K bytes of processor board System flash (Read/Write)

Step 7. In enable mode, issue the copy flash: tftp command to start backing up a router image file. The command prompts you for the name of the Cisco IOS image to copy, the name under which to store the image file on the TFTP server, and the IP address of the TFTP server.

R1# copy flash: tftp
Source filename []? c1900-universalk9-mz.SPA.151-4.M4.bin
Address or name of remote host []? 10.0.0.10
Destination filename [c1900-universalk9-mz.SPA.151-4.M4.bin]? c1900-universalk9-mz.SPA.151-4.M4-copy.bin

Writing c1900-universalk9-mz.SPA.151-4.M4.bin....!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 33591768 bytes]

33591768 bytes copied in 4.332 secs (814172 bytes/sec)

Step 8.  Go to the folder where the TFTP stores files to verify that the Cisco IOS image file is there.

How To Backup Cisco Switch/Router Images 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 Cisco switch/router images using a TFTP server.

Click here to download the lab file.

Troubleshooting Cisco IOS Image Backup Process

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.
  • An ACL is blocking TFTP traffic between the client and the server.

Related Lessons to How To Backup Cisco Switch/Router Images 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.