SLAC CPE Software Engineering Group
Stanford Linear Accelerator Center
System Admin

TFTP Configuration

 

 

 

 

14-Mar-2024


RHEL7

 

  • The following approach is simple and  close to what we have for RHEL6.

    yum install tftp

    yum install tftp-server

    systemctl enable tftp.service  -Not needed

    systemctl start tftp.service      -Not needed

     

    OLD Way:

    update /etc/xinetd.d/tftp

    $ cat /etc/xinetd.d/tftp service

    tftp

    { ..

    server_args             = -s /usr/local/common/tftpboot         disable                 = no

    .. }

    systemctl restart tftp

     

    RHEL7:

    Copy the configuration from /usr/lib/ to /etc/systemd/

    # cp /usr/lib/systemd/system/tftp.service /etc/systemd/system/tftp.service
    Change the default directory to required directory

    Development:  /afs/slac/g/lcls/tftpboot

    Production:      /usr/local/common/tftpboot

    # vi /etc/systemd/system/tftp.service

    [Service]
    ExecStart=/usr/sbin/in.tftpd -s /afs/slac/g/lcls/tftpboot
    Load the unit file

    # systemctl daemon-reload

    $ systemctl list-unit-files | grep tftp
    tftp.service disabled
    tftp.socket enabled


 

 

CHECK:

The nature of confusion is that tftp is very special, not really a standalone service. It is part of xinetd.service; that is to say,  tftpd daemon gets started by xinetd only when tftp clients make request.  In this case, tftp can’t be tracked by  “systemctl status”.  So, it is very misleading.  There are other ways to start tftpd daemon e.g., by systemd socket – even in this approach, “systemctl status tftp” will not show any, or will become inactive if not in use. 

 For example, after I reboot jingchen-rhel7,

ps -ef  | grep tftpd

showing nothing. As soon as I make tftp request from mccfs7,

[jingchen@mccfs7 ~]$ tftp jingchen-rhel7

tftp> get linuxRT/boot/undionly.kpxe

tftp> quit

[jingchen@mccfs7 ~]$ ls undionly.kpxe

undionly.kpxe

On jingchen-rhel7,  as you can see tftpd started:

[root@jingchen-rhel7 jingchen]$ ps -ef | grep tftp

root      9478  2248  0 13:10 ?        00:00:00 in.tftpd -s /usr/local/common/tftpboot

----------------------------------------------------------------------------------------------------

[root@lcls-srv47 ~]# systemctl status tftp.socket
  tftp.socket - Tftp Server Activation Socket
Loaded: loaded (/usr/lib/systemd/system/tftp.socket; enabled; vendor preset: disabled)
Active: active (listening) since Mon 2023-02-13 11:56:01 PST; 15min ago
Listen: [::]:69 (Datagram)

Feb 13 11:56:01 lcls-srv47 systemd[1]: Listening on Tftp Server Activation Socket.

 

 

 

 

 

RHEL6

Our TFTP server is used by IOCs to load bootloader (for linuxRT)  and OS stored in /usr/local/common/tftpboot for LCLS and FACET.

TFTP Server Installation:

yum install tftp
yum install tftp-server


TFTP Server Configuration:

For LCLS and FACET, we use lcls-builder as a TFTP server. TFTP is a service managed by xinetd.

The TFTP server configuration is done in /etc/xinetd.d/tftp:

[jingchen@lcls-builder ~]$ cat /etc/xinetd.d/tftp
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /usr/local/common/tftpboot
per_source = 11
cps = 100 2
flags = IPv4
}

Note:

disable = no means to enable TFTP server.

files served by TFTP server is in /usr/local/common/tftpboot

TFTP Server startup and check:

- start tftp server
/etc/init.d/xinetd restart

[jingchen@lcls-builder ~]$ /sbin/chkconfig --list tftp
tftp on

on a client machine (make tftp client is installed):

tftp lcls-builder

tftp> get linuxRT/boot/undionly.kpxe
tftp> quit
ls undionly.kpxe

 




 


Created by: Jingchen Zhou   17-July-2015;