I was recently copying a fairly large 400 MB IOS image to one of our ASR routers and it was taking forever via TFTP. I had seen this before but never really took any time to look into it further. I always switched to FTP, the transfer went faster, and I never looked back. This time I decided to go to Wireshark and take a deeper look. In this post I’ll show you why it’s slow and how to improve the speed, but perhaps more importantly, how to get to the bottom of something like this using Wireshark.
Default TFTP Setting
I performed a packet capture on a TFTP session using the default Cisco router and TFTP server settings. It immediately became clear what the issue was. Here is a screenshot as well as a link to part of the capture file on Cloudshark.
The length of each of the frame is ~500 bytes. This was being transferred over Ethernet, which has a max frame size of 1518 bytes. This means we weren’t fully taking advantage of our available frame size. It’d be the equivalent if I told you to empty a swimming pool and you had the option to use a small plastic cup or a 5 gallon bucket for each trip you took to the pool. The 5 gallon bucket would require far less trips back and forth and decrease the total time needed to empty the pool.
According to the RFC for TFTP, TFTP will transfer data in blocks of 512 bytes at a time, which is what we were seeing with our default settings.
Make it faster
So how do we make this go faster? Well, besides using one of the other TCP based alternatives like SCP or FTP, there is an option in IOS available to increase the TFTP blocksize. In my case I am using an ASR router and the option was there. I didn’t look into seeing which other platforms/ IOS versions this is supported in.
The command you are interested in is: ip tftp blocksize <blocksize> In my case I chose to set the blocksize to 1200 bytes because I have the Cisco VPN client installed which changes your MTU size to 1300 bytes and I didn’t want to deal with fragmentation. Here’s a screenshot of the transfer with the updated block size and link to capture on Cloudshark.org.
Confirming the increase
Besides seeing the bigger blocksize in the capture and noticing the speed was faster, let’s back it up with some real data. If you click the Statistics – Summary menu you can see an average rate for each capture.
Here’s the ‘before’ rate with the default block size:
And here is the summary using the increased block size of 1200 bytes:
That’s almost a 2.5 time increase in performance just by changing the block size for TFTP! Depending on your MTU you may be able to increase this even further, above the 1200 bytes I chose for this example.
Hope this was helpful in not only seeing how you can increase the speed of your transfers with TFTP, but also to see how to troubleshoot what causes issues like this and use tools like Wireshark to get to the bottom of it. One thing to note, TFTP is often the go to default for transferring files to routers and switches but depending on your use case there may be other options that are better. If you are using an unreliable link you may be better off going with the TCP based FTP option, or if you need to securely transfer something SCP is a solid bet. It all depends on what your requirements are.