Tuesday, March 29, 2016

Using TFTP to download and upload files from Cisco IOS Routers

One thing I often struggled with when I first got into Cisco Networking prior to having a CCNA was uploading and downloading files from the routers and switches. Fear Not! I have a solution! It's really easy to use. The idea is that you can use the existing IP network to upload files or download files from your network devices, rather easily I might add.

TFTP or Trivial File Transfer Protocol utilizes UDP port 69 to send traffic to and from TFTP enabled devices. First thing you'll need is TFTPD32. Download by clicking on the link. Then you'll need to make sure your device can reach the laptop/computer/server you installed TFTP on and the TFTP port - UDP 69 is open and listening

R1#sh ip int br
Interface              IP-Address      OK? Method Status                Protocol
GigabitEthernet1       10.255.1.38     YES DHCP   up                    up    

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

The . in the !!!! is the ARP resolution, you can ignore that.

Now what we'll need to do is copy the configuration from flash to TFTP. But first we need to tell the TFTP server where to store the files, essentially we need to give it a directory to download to and upload from. Click browse and navigate to the appropriate file. The Show Dir will show the contents of that folder.



R1#copy flash:iosxe-remote-mgmt.03.15.00.S.155-2.S-std.ova tftp:
Address or name of remote host []? 10.255.1.17
Destination filename [iosxe-remote-mgmt.03.15.00.S.155-2.S-std.ova]


The file is now being downloaded to the TFTP server as a potential backup. In this case, I don't need the file, this was for demo purposes, but you can see that you can download any file from flash or upload a file to flash. Like a new or backup IOS image. I often will keep the IPBase or other vanilla IOS image in flash, if space permits, and then upload the IOS image I intend to use and keep them both in flash.

If you accidentally choose the wrong interface or directory on your TFTP server, the network device will display the following, it's not a dead giveaway why the transfer failed but it's 1 possibility.

R1#copy flash:CCNPSP.conf tftp:
Address or name of remote host []? 10.255.1.17
Destination filename [CCNPSP.conf]?
%Error opening tftp://10.255.1.17/CCNPSP.conf (Permission denied)

Now we'll fix the interface and the directory on the TFTP server and download the configuration file.

R1#copy flash:CCNPSP.conf tftp:
Address or name of remote host []? 10.255.1.17                
Destination filename [CCNPSP.conf]?
!!
1465 bytes copied in 0.101 secs (14505 bytes/sec)

Now we'll upload the config file, essentially just reversing the process.

R1#copy tftp:CCNPSP.conf flash:
Address or name of remote host []? 10.255.1.17
Destination filename [CCNPSP.conf]?
%Warning:There is a file already existing with this name
Do you want to over write? [confirm]
Accessing tftp://10.255.1.17/CCNPSP.conf...
Loading CCNPSP.conf from 10.255.1.17 (via GigabitEthernet1): !
[OK - 1465 bytes]

1465 bytes copied in 0.067 secs (21866 bytes/sec)

And That is really it.

Thanks for reading!

Rob Riker, CCIE #50693




No comments:

Post a Comment