I am using a tftp server to hold the boot image for a dev board and the dev board is hard-coded to look at a particular IP address for the server. This all works fine. What I want to do now is be able to set up a second dev board to look at the same IP address for the server, but get a different boot image. I would like to do this by having the tftp server use a different root directory based on the IP address of the client connecting to it. Is there a way to do this?

I realize there may be some way to do this with iptables, but I have to turn the firewall on the server machine off entirely for other reasons, so that may not be terribly practical.

For reference, I'm using Fedora 15 for the server, but that can be changed if need be.

  • What image is the existing board grabbing from the TFTP server? Is that being communicated via DHCP or something else? – slm Mar 5 '14 at 21:03
  • Together with not being totally confident with this statement, I think you will need to run multiple tftpd instances with different root directory configurations as well as different ip addresses, as tftp is pretty dumb at what it does, hence the "t" at the beginning for "trivial". I saw this article a while ago. You might want to take a look at it: selbytech.com/2009/10/… – MelBurslan Mar 5 '14 at 21:23
  • See my answer, you don't need multiple TFTP servers if you can make use of PXELINUX. – slm Mar 5 '14 at 21:38

DHCPD or not?

You don't say but I'm assuming that you have some PXE configuration file that this DEV board is setup to look for. Typically you'd tell the DHCP clients what PXE image to use like so via a DCHP server:

subnet netmask {
        option subnet-mask;
        option broadcast-address;
        option routers;
        filename "pxelinux.0";

The TFTP server would be the next-server, and the file to load would be filename "pxelinux.0". But since you don't have this setup your DEV board is looking for a the "next-server" at a specific IP address, I'm going to assume that it's looking for a specific PXE file too.


This solution would assume you have control over pointing the DEV board at a particular "filename", in this case I'm suggesting you use PXELINUX, the file would be pxelinux.0.

PXELINUX allows you to have custom images based on a system's MAC address is the more typical way to do it, since system generally don't have an actual IP address assigned to them in a static way, whereas the MAC addresses are static.


On the TFTP server's root directory you'd then create something like this:


Each MAC address above is a file with the appropriate boot stanza in it for each system. Here's mine from my Cobbler setup:

$ ls -l /tftpboot/pxelinux.cfg/
total 88
-rw-r--r-- 1 root root 292 Jul  9  2012 01-54-52-00-05-5a-ab
-rw-r--r-- 1 root root 288 Jul  9  2012 01-54-52-00-17-a6-cd

Along with a sample file:

$ more /tftpboot/pxelinux.cfg/01-54-52-00-05-5a-ab
default linux
prompt 0
timeout 1
label linux
        kernel /images/Centos56-x86_64/vmlinuz
        ipappend 2
        append initrd=/images/Centos56-x86_64/initrd.img ksdevice=bootif lang=  console=ttyS0,115200 text serial kssendmac  ks=

The above can be paired down to suit your needs, but should be enough of an example to get you started, there additional examples up on the PXELINUX website as well!

  • No, I'm not using a PXE config file. The filename is hard-coded into the dev board's boot code as is it's IP address and the IP address of the tftp server. – JonS Mar 5 '14 at 22:46
  • @JonS - you can play games and create a comprable setup by making a symbolic link to whatever you want on the TFTP sever, for example. Can you provide us more info on the actual DEV boards? – slm Mar 5 '14 at 23:20
  • It's more than just dev boards, I want to use this on our custom boards too. I believe we can make them all have unique MAC addresses, but we wouldn't be using DHCP with any of them. I'll have to look into whether we can use PXE or not. – JonS Mar 5 '14 at 23:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.