Monday, 6 May 2013

Setting up tftp server on Redhat Linux and allow write access to tftpboot

A TFTP Server is often used by Cisco devices to manage their file transfers. Here is a quick guide on how to setup a TFTP server on Centos/Redhat.
First obtain the RPM. In Centos, use yum to search and install tftp-server.
yum search tftp
yum install tftp-server
After it's installed, the RPM creates a new folder named 'tftpboot' in the root partition. You must change the access rights for it be read and write accessible.
chmod 777 /tftpboot
The tftp-server is controlled by xinetd which is a Linux daemon that handles certain lightweight network applications. Edit the file name 'tftp' located in /etc/xinetd.d/ . The TFTP service is defaulted to off so change the disable option to 'no'
# 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 -c /tftpboot
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
Make sure the "disable = yes" option is set to "no" to enable the service.
TFTP server also comes default read only. In order to enable write access the -c argument needs to be added to the server_args.
server_args = -s -c /tftpboot
Ensure you restart the xinetd service when making changes to this file.
service xinetd restart
You may verify the server is started by verifying that it's listening on UDP port 69.
netstat -nap |grep :69
The output should look like this:
udp        0      0 0.0.0.0:69                  0.0.0.0:*                               19141/xinetd
If you have a firewall, make sure that UDP port 69 is opened.
----
End of posting.
Reliable and unexpensive web hosting and domain names at http://www.netlinecorp.com