Tftp times out on localhost

hosts-filelocalhosttftptimeout

On the same server, I can't connect to my in.tftp over localhost name:

$ tftp localhost -c put test.file && echo Sent\!
Transfer timed out.

$ tftp 127.0.0.1 -c put test.file && echo Sent\!
Sent!

Does the tftp centos client ignore the hosts file? Other things seem to work as expected:

$ echo quit|nc localhost 25
220 my.ser.ver ESMTP Postfix
221 2.0.0 Bye

Best Answer

Looking at the strace of the failing command, it turns out that 'localhost' was resolving to '::1' which was a secondary IPv6 entry in the hosts file. My xinet.d/tftp definition had a flag for IPv4 only.

The solution is to either remove the IPv6 hosts entry or remove the IPv4 from the tftp server. This now works:

$ tftp localhost -c put test.file && echo Sent\!
Sent!
Related Topic