Use a Cisco Router as a TFTP Server

I often forget about the ability to TFTP file between routers by configuring one as a TFTP server.  This comes in pretty handy when you have remote routers and you need to copy code from one to another.  The config is simple, but totally worth talking about.

Router A (The Source)
Take a look at flash to get the file name you want to send to the other router.  In this case, we’ll be sending some of IOS code. 

Router_A# show flash
-#- –length– —–date/time—— path
1         1408 Mar 13 2009 00:00:00 +00:00 backup-config
2     22824684 Mar 13 2009 00:00:00 +00:00 RouterCodePickMe.bin
3     22824684 Mar 13 2009 00:00:00 +00:00 RouterCodePickMe2.bin

71180288 bytes available (56999936 bytes used)

Enter config mode and use the ‘tftp-server’ command to specify which files you want to host on the local TFTP Server.

2800-1# config t
Enter configuration commands, one per line.  End with CNTL/Z.
2800-1(config)#
tftp-server flash:RouterCodePickMe.bin
2800-1(config)# tftp-server flash:RouterCodePickMe2.bin
2800-1(config)# do show run | i tftp
tftp-server flash:c2800nm-spservicesk9-mz.124-13b.bin
tftp-server flash:c2800nm-advsecurityk9-mz.124-13b.bin

As you can see, it stores the tftp-server statements in the running config. 

Router B (The Destination)

Now jump onto the second router and use your standard ‘copy tftp flash’ statement to copy the code into local flash.

Router_B# copy tftp flash
Address or name of remote host []? <Accessible IP on the other router>
Source filename []? RouterCodePickMe.bin
Destination filename [RouterCodePickMe.bin]?
Accessing tftp://192.168.127.1/RouterCodePickMe.bin…
Loading RouterCodePickMe.bin from 192.168.127.1 (via Multilink1): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK – 22824684 bytes]

Same for the second file….

Router_B# copy tftp flash
Address or name of remote host []? <Accessible IP on the other router>
Source filename []?
RouterCodePickMe2.bin
Destination filename [RouterCodePickMe2.bin]?
Accessing tftp://192.168.127.1/RouterCodePickMe2.bin…
Loading RouterCodePickMe2.bin from 192.168.127.1 (via Multilink1): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK – 22824684 bytes]

That’s it!  As a best practice you should go and ‘no’ the ‘tftp-server’ statements out of the other router so that no one else can TFTP your code off.

Leave a Reply

Your email address will not be published.