Welcome to bytebang » The blog about all and nothing » TFTP boot with OpenWRT and a Synology NAS as storage

TFTP boot with OpenWRT and a Synology NAS as storage

Dec 29 2018

The Problem

From time to time I have to troubleshoot computers for friends or customers. Therefore I am using a lot of different live systems which can be booted via USB or from a DVD drive. I do not want to burn a DVD for every new release, and I also think that it is unhandy to create a bootable USB stick with every software I need.

Life would be so much easier if I could just save the image of a DVD onto my NAS and then be able to boot it via the network.

pxe_setup.png

I am using OpenWrt 18.06.1 on a TP-Link Archer C7 as my firewall because it is modular, cheap and fast enough. The firewall is (besides many other things) also responsible to serve IP addresses via DHCP to all network clients.

The Synology NAS is a DS713+ with 8GB RAM and 3TB Disk space running the DSM 6.2.1-23824 firmware.

The Solution

There are multiple solutions to this problem. I want to describe my solution for it:

The idea is, that a PXE enabled client sends a DHCP request into the network and the DHCP server assigns an address an also a pointer where the client should look for its preboot environment. The TFTP transfer is then handled by ma NAS because there are (in contrast to the Firewall) no 'real' storage limits.

Settings on the Synology NAS

  1. Create a shared folder (mine is called tftp)
  2. Enable the TFTP server
  3. Tell the server where the tftp -root is
  4. Copy the files into the share

Create a share

Setup TFTP

Make sure that the DHCP server on the Synology is turned off. Otherwise (with 2 DHCP servers who are not aware of each other) you will run into some 'interesting' problems !

After these steps, the NAS is able to serve files via TFTP. The problem is, that there are no files there (yet). I placed a copy of Paul Maunders TFTP-PXE Boot server into the directory /tftp/boot  and started to play around with it. Finally, I found an article how to boot from iso images via tftp which works fine.

Directory structure within /tftp/boot

Settings in OpenWRT

My firewall is already configured as DHCP server. The last step is to tell the DHCP server to serve the pointer to my TFTP Server (running on my NAS with the IP 192.168.5.253).

TFTP settings in OpenWRT

We do not host the TFTP server on the firewall - therefore we can leave the TFTP server root setting blank. The Network boot image Setting tells the PXE client to contact my NAS with the IP 192.168.5.253 and to boot the file pxelinux.0

The double comma between pxelinux.0 and the IP address of my synology is NOT a typo !

Test it (with virtualbox)

The final step is to test the setup. I use a blank virtualBox machine with PXE enabled.

PXE Test with virtualbox

You can edit your boot menu by editing the /tftp/boot/pxelinux.cfg file on the synology.

Get Social


(c) 2019, by bytebang e.U. - Impressum - Datenschutz / Nutzungsbedingungen
-