Dnsmasq is an easy to configure and lightweight DHCP Server and DNS forwarder. Dnsmasq is designed primarily to provide DNS service and optionally, DHCP, in a small network setup. The DHCP server in Dnsmasq integrates with the DNS server seamlessly. The machines with IP addresses allocated by DHCP server appear in the DNS with names configured either in each host or in a central configuration file.

Dnsmasq support dynamic and static DHCP leases. On top of stated features it has support for BOOTP/TFTP which can be used for network booting of diskless machines. Dnsmasq can be used in Proxmox virtualization platform to assign IP addresses dynamically or statically, and also to manage DNS. We’ll run Dnsmasq in one Proxmox hypervisor, with the service bound to specific network interface / bridge.

Step 1: Install dnsmasq on Proxmox VE 6.x

I’ll install dnsmasq in one Proxmox hypervisor from the default upstream repositories.

sudo apt update
sudo apt install dnsmasq

Proceed to install dnsmasq on Proxmox VE 6.x

Reading state information... Done
The following additional packages will be installed:
  dns-root-data dnsmasq-base
Suggested packages:
  resolvconf
The following NEW packages will be installed:
  dns-root-data dnsmasq dnsmasq-base
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 463 kB of archives.
After this operation, 1,027 kB of additional disk space will be used.
Do you want to continue? [Y/n] y

Also install dnsutils package which provides dig command:

sudo apt install dnsutils -y

Test your installation:

dig computingforgeeks.com @localhost
nslookup computingforgeeks.com localhost

The DNS function in Dnsmasq is configured to forward all requests to your system’s default DNS settings as configured in /etc/resolv.conf file.

Step 2: Configure DHCP Server using Dnsmasq

After successful installation of Dnsmasq on your Proxmox server you can the start to configure DHCP service.

sudo vim /etc/dnsmasq.conf

Set domain for dnsmasq:

domain=example.com

Let dnsmasq know which ethernet interface it will use to listen for DHCP requests:

#Around line 106
interface=vmbr1
# Or which to listen on by address (remember to include 127.0.0.1 if you use this.)
#listen-address=

Set DHCP server range of IP addresses to hand out.

#around line 159
dhcp-range=192.168.50.50,192.168.50.200,12h

Set default route supplied by dnsmasq:

#around line 337
dhcp-option=vmbr1,3,192.168.50.1
#dhcp-option=eth0,3,192.168.50.1

Provide upstream DNS servers:

#line 66
# You can use Google's open DNS servers
server=8.8.8.8
server=8.8.4.4

Set path to a file for the DHCP lease database:

dhcp-leasefile=/var/lib/misc/dnsmasq.leases

Test your configurations:

$ sudo dnsmasq --test
dnsmasq: syntax check OK.

Restart dnsmasq service:

sudo systemctl restart dnsmasq
sudo systemctl enable dnsmasq

Step 3: Create a VM on the network with DHCP service

Create a new Virtual Machine from Proxmox web console.

dnsmasq dhcp server proxmox 01

Let’s give it a name and choose node where it will run.

dnsmasq dhcp server proxmox 02

Select OS installation disc.

dnsmasq dhcp server proxmox 03

Pick correct network (should be same as one used in dnsmasq DHCP configurations)

dnsmasq dhcp server proxmox 04

Install the operating system and once completed reboot and check IP address if from DHCP.

dnsmasq dhcp server proxmox 05

If the interface didn’t get IP address assigned by DHCP server automatically you can try manual request:

sudo dhclient interface

That marks the end of our article. Feel free to share your setup and test results via comments section.

Also check:

Create Private Network Bridge on Proxmox VE 6 with NAT

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!


As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.

LEAVE A REPLY

Please enter your comment!
Please enter your name here