Running multiple instances of TFTP server on CentOS 5.x

Posted by Warren Selby on Oct 4, 2009 in Blog, linux | 0 comments

Recently, at a client, I needed to combine two TFTP servers onto one CentOS box. Since there were alread clients spread out across the network hard-coded to use specific IP addresses for their TFTP servers, I needed to be able to serve up files from both IP addresses.  A quick look around the web didn’t provide a whole lot of help, so I had to come up with my own way of doing things.

First, I decided to install atftpd, an advanced tftp server that could run on multiple interfaces on the same machine. Before you can install atftpd, you need to uninstall the base tftpd that comes with CentOS. Using yum, this is rather simple:

# yum remove tftpd-server

This clears the way for us to install atftpd.

# yum install atftpd-server

Once we’ve got that installed, now we need to configure it. By default, yum installs atftpd-server as an xinetd service (this is why we had to remove the tftpd-server package that comes with CentOS). Open the file /etc/xinetd.d/tftp and replace it’s contents with the following, adjusting the IP address and directories for your purposes, of course:

service tftp
{
disable = no
bind                    = 10.10.11.254
socket_type             = dgram
protocol                = udp
wait                    = yes
user                    = root
server                  = /usr/sbin/in.tftpd
server_args             = --logfile /var/log/atftpd_primary.log /home/tftpboot/primary
per_source              = 11
cps                     = 100 2
flags                   = IPv4
}
service tftp
{
disable = no
bind                    = 10.10.10.1
socket_type             = dgram
protocol                = udp
wait                    = yes
user                    = root
server                  = /usr/sbin/in.tftpd
server_args             = --logfile /var/log/atftpd_secondary.log /home/tftpboot/secondary
per_source              = 11
cps                     = 100 2
flags                   = IPv4
}

Once you’ve got this configured, restart your xinetd server and you’re good to go!

# service xinetd restart

Leave a Reply