RSS Feed for This PostCurrent Article

How to Install a tftp Server on Red Hat Enterprise Linux

I install a tftp server about once every three years. As such I never remember what needs to happen, and this time a Google search didn’t have a nice answer for me. So, as my latest contribution to the world of HOWTOs, I present the non-idiot’s concise guide to installing and configuring a tftp server.

As always if you have suggestions or corrections just add them as comments, and I’ll update the text here.

This will give you the default /tftpboot directory. I assume that if you need a filesystem there you can handle adding one there on your own. :-) If you want to change the filesystem you can do that in /etc/xinetd.d/tftp, in the server_args field. Don’t forget to reload xinetd after you change it.

1. Install the tftp server software and enable it:

/usr/bin/up2date tftp-server
/sbin/chkconfig tftp on

3. Because it runs via xinetd reload that to pick up the configuration file change:

/sbin/service xinetd reload

4. Edit /etc/sysconfig/iptables-config and edit the IPTABLES_MODULES line to read:

IPTABLES_MODULES="ip_conntrack_tftp"

If you already have something in that line just add the new module with a space as a delimiter, like:

IPTABLES_MODULES="ip_conntrack_ftp ip_conntrack_tftp"

5. Add firewall rules to /etc/sysconfig/iptables. You probably only need UDP, though I always add the TCP rules, too (they’re both listed in /etc/services for port 69):

-A RH-Firewall-1-INPUT -s 10.1.0.0/16 -m tcp -p tcp --dport 69 -j ACCEPT
-A RH-Firewall-1-INPUT -s 10.1.0.0/16 -m udp -p udp --dport 69 -j ACCEPT

(two lines here if it’s wrapping)

6. Restart iptables to pick up the changes from steps 4 and 5:

/sbin/service iptables restart

7. Add the proper lines to /etc/hosts.allow:

in.tftpd: 10.1.

8. Put something in /tftpboot to retrieve with a client, for testing.

9. Use a client from an allowed IP range to test:

$ tftp my.tftp.server.com
tftp> get filename.bin

9. If you get an error check /var/log/secure and /var/log/messages on the server, and start eliminating potential problems one at a time (disable iptables, put ALL in hosts.allow, etc.) until you find the problem.

Have fun!

>> Comments | ShareThis

Trackback URL

  1. 2 Comment(s)

  2. By vince on Jan 30, 2008 | Reply

    Great help! thank you.

  3. By servet on May 14, 2008 | Reply

    Hi
    i completed setup of tftpd server, and i give permissions to necessary folders, i dont use iptables, it is stopped, but still i dont use tftp server, connection opened but it closed suddenly, i could not find issue of this problem

    logs are below

    /var/log/messages
    May 14 15:40:01 unicorn crond(pam_unix)[4962]: session opened for user root by (uid=0)
    May 14 15:40:02 unicorn crond(pam_unix)[4962]: session closed for user root
    May 14 15:41:00 unicorn sshd(pam_unix)[4971]: session opened for user root by root(uid=0)
    ———————————-
    /var/log/secure
    May 14 15:40:33 unicorn xinetd[4717]: START: tftp pid=4964 from=192.168.254.12
    May 14 15:40:37 unicorn xinetd[4717]: START: tftp pid=4965 from=192.168.254.12
    May 14 15:40:42 unicorn xinetd[4717]: START: tftp pid=4966 from=192.168.254.12
    May 14 15:40:48 unicorn xinetd[4717]: START: tftp pid=4967 from=192.168.254.12
    May 14 15:40:55 unicorn xinetd[4717]: START: tftp pid=4968 from=192.168.254.12

Post a Comment

 

Please note that while in principle I don't mind promotion of a non-personal web site or blog in the fields below, any comments that are off-topic, derogatory, or spam-like will likely be removed at my discretion.

 

Close
Powered by ShareThis