The word “NetBoot” can refer to multiple concepts - see also NetBoot Pointers. This page is for booting an OpenWRT device by cabling it to some server, desktop or laptop.

In embedded development work it is often either practical or needed to boot a device from a kernel or image placed on the local network. Some examples of common devices requiring netboot (bootp, pxe-boot), when installing OpenWrt, are Routerboard, Soekris etc. This howto is based on the use of Ubuntu 9.10, or similar Debian based desktop distribution with apt-get.

Read about Bootp and PXEBoot and probably best, if you understand them well.

First, determine whether your bootloader even supports netbooting: start a wireshark capture on your PC interface that you intend to use to serve the device, if it doesnt make a DHCP/BOOTP request, setting up a dhcp server on your PC is pointless. NB: some devices do this selectively - the Soekris 4801 for example has a BIOS where you can set to boot from CF (80,81=compact flash) or from network (F0, if the author recalls correctly). Other devices may also be modal (i.e. if ethernet is plugged in at boot, etc..)

Doing a wireshark capture will also tell you if your device has a TFTP client (it will make a TFTP request for a file) or a TFTP server (it will silently wait (briefly) for your client to connect)

Client (OpenWrt)

  • none ⇒ the functionality is already contained in the bootloader

Server (your PC)

You need to install the following packages:

  • Option 1:
    • tftpd-hpa
    • dhcp3-server
    • netkit-inetd
  • Option 2:
    • dnsmasq
sudo apt-get update
# option 1
sudo apt-get install tftpd-hpa dhcp3-server openbsd-inetd
# option 2
sudo apt-get install dnsmasq

Option 1


TFTPd is typically run as needed, by inetd or xinetd. To chheck the setup of the tftpd server via inetd.conf, either confirm or add the following line in /etc/inetd.conf:

tftp           dgram   udp     wait    root  /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot

Or, if your box runs xinetd (check for /etc/xinetd.conf and /etc/xinetd.d/tftp), then add following, or comment out the disable item.

# 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 /var/lib/tftpboot
#	disable			= yes
	per_source		= 11
	cps			= 100 2
	flags			= IPv4

Don't forget to check if the tftp directory /var/lib/tftpboot was created correctly (add it if it hasn't already been created).

Edit /etc/default/tftpd-hpa to show the following:

OPTIONS="-l -s /var/lib/tftpboot"

Start the tftpd daemon with the command:

 sudo /etc/init.d/tftpd-hpa start

Verify that inetd is listening on the right port:

netstat -lu

should show a line with:

udp        0      0 *:tftp                  *:*      

You need to decide on what network interfaces the DHCP server (dhcpd) is supposed to serve DHCP requests? First list available interfaces with ifconfig then edit the line in /etc/default/dhcp3-server file. Separate multiple interfaces is done with adding simple spaces, e.g. “eth0 eth1”. like this:

INTERFACES="eth1 eth2"

The setup in this case is basic, and only utilizes one wired interface (eth0), and the file looks like this:


To configure the dhcp server you need to edit the /etc/dhcp3/dhcpd.conf file. The below lines needs to be added to the default file. Hereby substituting IP and MAC address as needed. Beware not to forget the semicolons (“;”) at the end of lines. In this case the setup is based on the use of the IP range, and the device which is to boot has a fixed Ip-address ( based on its MAC address validation.


max-lease-time 604800;
default-lease-time 3100;

ddns-update-style none;
ddns-ttl 7200;

allow booting;
allow bootp;
one-lease-per-client true;

subnet netmask {
	option routers;
	option subnet-mask;
	option broadcast-address;
	ignore client-updates;

group {
	host (your device) {
		hardware ethernet (mac address of device);
		filename "name of bootfile";


Hereafter it is good to ensure that the eth0 interface is up and active, with:

sudo ifup eth0

Check if the eth0 interface has recieved the correct static IP-address:

ifconfig eth0

If the configuring of your dhcp server is correct, it will start with the following command (the options are stop, start, restart):

sudo /etc/init.d/dhcp3-server start

The dhcp3 server will either reply with an [OK] or [fail], but you can do an extra check and verify it runs (if not, you may have a problem in the dhcpd config file):

ps ax | grep dhcpd

Option 2

Dnsmasq is a DNS resolver, but also includes a DHCP server and a TFTP server too! Add the following configuration to /etc/dnsmasq.conf, or in a file in /etc/dnsmasq.d/ for recent Debian/Ubuntu versions:

# deactivate DNS
# listen on specific interface and/or address
## DHCP configuration
# detect PXE clients
# MACs we serve
# do not send default route and DNS server options
# ignore request from unknown hosts
# and ignore non-PXE booting
## TFTP configuration

You can remove the PXE filter if you are serving non-PXE hosts (comment the right dhcp-ignore line). You can also not restrict MAC addresses you are responding to, but it's better to spot right.

You must of course have configured your interface with some IP address; see below.

Then simply sudo service dnsmasq restart, and enjoy your all-in-one netbooting server.

Edit interface file

I found that I needed to edit the /etc/network/interfaces file to fix an issue between the Gnome Networkmanager and the dhcp3 server. Without adding the below lines the dhcp server could not identify the correct interface to listen on:

iface eth0 inet static
auto eth0
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2023/02/15 11:54
  • by tobixen