Skip to content
Indus LeveL
CentOS TFTP SysAdmin PXE Networking Linux

How to Install a TFTP Server on CentOS 7

A complete guide to installing and configuring a TFTP server on CentOS 7 for network booting (PXE) thin clients and automated system deployment.

2 min read
How to Install a TFTP Server on CentOS 7

TFTP stands for Trivial File Transfer Protocol. Unlike FTP, which relies on TCP for connection-oriented transfers, TFTP uses UDP (User Datagram Protocol) to transfer data quickly and with minimal overhead.

TFTP is commonly used for serving boot files to diskless workstations (thin clients) or starting automated network installations of operating systems.

In this article, we will set up a TFTP server with minimal configurations. We will use the same CentOS 7 machine we configured as a DHCP server in the previous guide, leveraging the pre-installed utilities and settings.


1. Installing TFTP & Bootloader Packages

Install the TFTP server along with the syslinux-tftpboot package. The syslinux package provides the necessary PXE bootloaders (like pxelinux.0) which will be served to clients attempting to boot from the network:

yum install tftp-server syslinux-tftpboot -y

2. Basic System Preparation

Enable TFTP on Startup

Ensure the TFTP service starts automatically during system boot:

systemctl enable tftp.service

Open Firewall Ports

Allow incoming TFTP traffic in the local firewall (TFTP relies on UDP port 69):

firewall-cmd --permanent --zone=public --add-service=tftp

Reload Firewall

Force the firewalld daemon to reload and apply the newly added services:

firewall-cmd --reload

Verify Firewall Open Services

Confirm that the tftp service is listed in active firewalld rules:

firewall-cmd --list-all

3. Configuring the TFTP Server

The TFTP server on CentOS 7 is managed via xinetd. Follow these steps to configure it securely.

Backup Default Configuration

cp /etc/xinetd.d/tftp /root/tftp.bak

Reset Configuration File

>/etc/xinetd.d/tftp

Setup Custom TFTP Settings

Paste the following configuration block to set up the xinetd service configuration for TFTP, pointing to /var/lib/tftpboot as the root directory for system files:

cat > /etc/xinetd.d/tftp <<EOF
# default: off
# description: The tftp server serves files using the trivial file transfer
# protocol. The tftp protocol is often used to boot diskless
# workstations, download configuration files to network-aware printers,
# and to start the installation process for some operating systems.
service tftp
{
    socket_type             = dgram
    protocol                = udp
    wait                    = yes
    user                    = root
    server                  = /usr/sbin/in.tftpd
    server_args             = -s -v -v -v /var/lib/tftpboot
    disable                 = no
    per_source              = 11
    cps                     = 100 2
    flags                   = IPv4
}
EOF

4. Starting the Service

Start the TFTP server and confirm that it is active and running under xinetd:

systemctl start tftp.service && systemctl status tftp.service

Troubleshooting Logs

If you encounter any errors starting the service or binding to the UDP interface, audit the system messages log:

tail /var/log/messages

5. Integrating TFTP with your DHCP Server

Your TFTP server is now ready to serve network bootloader files to thin clients!

To allow PXE booting clients to discover your TFTP server, you must update your DHCP server configuration with the filename and server IP.

Below is the specific snippet of the DHCP subnet block we configured in the DHCP Guide, pointing to the pxelinux.0 bootloader and setting the TFTP host IP (next-server):

subnet 172.16.99.0 netmask 255.255.255.0 {
        option broadcast-address 172.16.99.255;
        option routers 172.16.99.1;
        
        # Point PXE clients to the network bootloader file
        filename "/pxelinux.0";
        
        pool {
                range 172.16.99.150 172.16.99.230;
        }
        
        group {
                # IP or hostname of your TFTP Server
                next-server lhr-pxe1.induslevel.com;
                
                host tclient110 {
                        hardware ethernet    00:0c:29:d3:a1:d1;
                        fixed-address        172.16.99.110;
                        option host-name "tclient110.induslevel.local";
                }
        }
}

What's Next?

In the next article in this PXE server series, we will set up and configure a Local Yum Repository. This repository will host the packages required to install a hardened, security-compliant version of CentOS 7 directly over the network, automating system setups completely!

Back to Blog
Share:

Follow along

Stay in the loop — new articles, thoughts, and updates.