How-To: Unattended Ubuntu Deployment over Network — page 2 — DHCP server

1 minute read

For the purpose of this tutorial, I decided to choose dnsmasq to act as a DNS/DHCP server. The reason behind this is that dnsmasq is simple to configure and does a good job in providing DNS and DHCP services for a small LAN.

2. DHCP server:

The DHCP server is going to be involved twice in this scenario. First, when our client is going to boot on its network interface, the DHCP server is going to provide the client with an IP address to be able to communicate with other servers. Also, on this first contact, the DHCP server is going to supply our client with a filename and a server address where to get the bootloader using TFTP protocol.

Let’s get started with dnsmasq installation and configuration. In this example, I will consider that our network is using the network address range

2.1. Installing dnsmasq

To install dnsmasq simply type:

$ sudo apt-get install dnsmasq

No, we need to define a pool of IPs to be given through DHCP.

2.2. Configuring dnsmasq

In /etc/dnsmasq.conf make sure the following line is defined:


This will give IP address ranging from to to clients in your network.

You can also define some permanent IPs for certain host with the following:


Which will attribute IP and hostname “tftpserver” to the client with a MAC address of XX:XX:XX:XX:XX:XX.

Finally, in order to inform computers booting using PXE where to get the bootloader, we need to add:


Which tells clients to get pxelinux.0 from host tftpserver which is located at

Now reload dnsmasq settings with the following command:

$ sudo /etc/init.d/dnsmasq restart
Restarting DNS forwarder and DHCP server: dnsmasq.

Now, when our clients will ask for an IP using DHCP, they will be supplied with a location and filename to get in order to boot.

So, next step, setting up our TFTP server.