Previous | Next | Table of Contents

Setting up the tftpd server, Diskless NetBSD HOW-TO

TFTP (or Trivial File Transfer Protocol) is used by the boot rom in several vendors' machines to download the boot loader and/or the kernel. This service runs over TCP/IP, so the client must first obtain an IP address, typically via rarp, bootp, or dhcp.

First, you need to make sure that you haven't denied any host access via TCP wrappers. Look in /etc/hosts.deny and /etc/hosts.allow for tftp entries. If you're using these files to restrict tftp access, then you need to either comment out the tftp entry in hosts.deny or add an entry for your client in hosts.allow

Next, you should copy all of the files necessary for your architecture to /tftpboot, as specified in the client architecture-specific introduction. For example, for a sparc client with IP address 192.168.1.10, you'd run:

# mkdir -p /tftpboot
# cp /export/client/root/usr/mdec/boot /tftpboot/C0A8010A.SUN4C

Note, some tftp daemons do not support chroot'ing into /tftpboot, and you may need to specify in bootparams, bootpd, or dhcpd the entire path to the bootloader. This is something you should test using the tftp(1) client before getting frustrated that netbooting doesn't work.

If all else fails, you can set your directories up such that a request for /tftpboot/C0A8010A.SUN4C works on a chroot'ed tftpd:

# cd /tftpboot
# ln -s . tftpboot

Setting up tftpd, NetBSD
Setting up tftpd, OpenBSD
Setting up tftpd, FreeBSD
Setting up tftpd, MacOS X and Darwin
Setting up tftpd, Linux (using inetd.conf)
Setting up tftpd, Linux (using xinetd.conf)
Setting up tftpd, NEXTSTEP
Setting up tftpd, HP-UX

[If you have details for any other platform, please let us know]


NetBSD and OpenBSD

  1. Edit /etc/inetd.conf and remove the # from the following line:
    tftp            dgram   udp     wait    root    /usr/libexec/tftpd      tftpd -s /tftpboot

  2. Ensure that the last item on the line is /tftpboot

  3. # ps -aux | grep inetd
    kill -HUP that process to force it to reread /etc/inetd.conf.

You can test your tftpd from any unix machine, by running:

# tftp tftpserver.test.net
tftp> get C0A8010A.SUN4C
Received 683 bytes in 0.3 seconds
tftp> quit
In this case, we use C0A8010A.SUN4C, the sparc kernel name as the test file to get.

Continue on to setting up nfs


FreeBSD

  1. Edit /etc/inetd.conf and remove the # from the following line:
    tftp   dgram   udp     wait    nobody  /usr/libexec/tftpd      tftpd /tftpboot

  2. Ensure that the last item on the line is /tftpboot

  3. # ps -aux | grep inetd
    kill -HUP that process to force it to reread /etc/inetd.conf.

You can test your tftpd from any unix machine, by running:

# tftp tftpserver.test.net
tftp> get C0A8010A.SUN4C
Received 683 bytes in 0.3 seconds
tftp> quit
In this case, we use C0A8010A.SUN4C, the sparc kernel name as the test file to get.

Continue on to setting up nfs


MacOS X and Darwin

These systems recommend placing your tftpd files in /private/tftpboot due to their inherently clustered behavior. Newer version of the OS use xinetd instead of inetd to handle the tftpd service. If you're running MacOS X 10.2.X or earlier or Darwin 6.X or earlier, then you should follow the inetd instructions.

  1. # mkdir -p /private/tftpboot

  2. (xinetd) # /sbin/service tftp start

  3. (inetd) Edit /etc/inetd.conf and remove the # from the following line:
    tftp    dgram   udp     wait    nobody  /usr/libexec/tcpd               tftpd /private/tftpboot

  4. (inetd) Ensure that the last item on the line is /private/tftpboot
    Even though the tftpd(8) man page says it supports the -s chroot(2) flag, it has permission problems.

  5. # ps aux | grep inetd
    kill -HUP that process to force it to reread /etc/inetd.conf.

You can test your tftpd from any unix machine, by running:

# tftp tftpserver.test.net
tftp> get C0A8010A.SUN4C
Received 683 bytes in 0.3 seconds
tftp> quit
In this case, we use C0A8010A.SUN4C, the sparc kernel name as the test file to get.

Continue on to setting up nfs


Linux (using inetd.conf)

  1. Edit /etc/inetd.conf and remove the # from the following line:
    tftp  dgram   udp     wait    nobody  /usr/sbin/tcpd  in.tftpd /tftpboot

  2. Ensure that the last item on the line is /tftpboot

  3. # ps aux | grep inetd
    kill -HUP that process to force it to reread /etc/inetd.conf.

You can test your tftpd from any unix machine, by running:

# tftp tftpserver.test.net
tftp> get C0A8010A.SUN4C
Received 683 bytes in 0.3 seconds
tftp> quit
In this case, we use C0A8010A.SUN4C, the sparc kernel name as the test file to get.

Under some circumstances, you will need to insert a static ARP entry on your tftp server. This may be what you need if the client gets to the point that it is trying to tftp the bootloader but it never receives it. This is apparently common when tftpd is on a Linux server. Under Linux, add the ARP entry using:

# arp -s 192.168.1.10 aa:bb:cc:dd:ee:ff
Where both the IP address and MAC address is the client's.

Continue on to setting up nfs


Linux (using xinetd.conf)

Note, xinetd is not used by default. These are instructions for Debian 2.1

  1. # adduser tftp

  2. # vi /etc/shadow to change tftp's password to be *.

  3. Edit /etc/xinetd.conf and add the following entry:
    service tftp
    {
            socket_type = dgram
            protocol = udp
            wait = yes
            user = tftp
            server = /usr/sbin/in.tftpd
            server_args = -l /tftpboot
            only_from = client.test.net
    }

  4. # ps aux | grep xinetd
    kill -HUP that process to force it to reread /etc/xinetd.conf.

You can test your tftpd from any unix machine (assuming you add it to the only_from line), by running:

# tftp tftpserver.test.net
tftp> get C0A8010A.SUN4C
Received 683 bytes in 0.3 seconds
tftp> quit
In this case, we use C0A8010A.SUN4C, the sparc kernel name as the test file to get.

Under some circumstances, you will need to insert a static ARP entry on your tftp server. This may be what you need if the client gets to the point that it is trying to tftp the bootloader but it never receives it. This is apparently common when tftpd is on a Linux server. Under Linux, add the ARP entry using:

# arp -s 192.168.1.10 aa:bb:cc:dd:ee:ff
Where both the IP address and MAC address is the client's.

Continue on to setting up nfs


NEXTSTEP

Note, NEXTSTEP uses /private/tftpboot as the location for tftp served files. Make sure your bootloaders are placed in this directory.

  1. Edit /etc/inetd.conf and remove the # from the following line:
    tftp    dgram   udp     wait    root    /usr/etc/tftpd          tftpd -s /private/tftpboot
    

  2. Ensure that the last item on the line is /private/tftpboot

  3. # ps -aux | grep inetd
    kill -HUP that process to force it to reread /etc/inetd.conf.

You can test your tftpd from any unix machine, by running:

# tftp tftpserver.test.net
tftp> get C0A8010A.SUN4C
Received 683 bytes in 0.3 seconds
tftp> quit
In this case, we use C0A8010A.SUN4C, the sparc kernel name as the test file to get.

Continue on to setting up nfs


HP-UX

  1. Edit /etc/passwd and create a new user for the tftpd account:
    tftp:*:9999:9999:tftp server:/tftpboot:/bin/false

  2. Edit /etc/inetd.conf and remove the # from the following line:
    tftp         dgram  udp wait   root /etc/tftpd    tftpd
    Under HP-UX 10, the path is /usr/lbin/tftpd instead of /etc/tftpd

  3. # inetd -c
    This tells the inetd process to re-read its configuration file

You can test your tftpd from any unix machine, by running:

# tftp tftpserver.test.net
tftp> get C0A8010A.SUN4C
Received 683 bytes in 0.3 seconds
tftp> quit
In this case, we use C0A8010A.SUN4C, the sparc kernel name as the test file to get.

Continue on to setting up nfs


Previous | Next | Table of Contents
NetBSD Home Page
NetBSD Documentation top level

(Contact us) $NetBSD: tftpd.html,v 1.28 2004/10/30 22:33:31 jschauma Exp $
Copyright © 1998-2004 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.