We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

40
2.275.031,80

Cart

Quantity 42,00
Quantity 6.300,00
Quantity 5.700,00
Quantity 52,00
Quantity 1.300,00

Learn how to – Using Dnsmasq DHCP Server in Proxmox for VMs IP

Learn how to – Using Dnsmasq DHCP Server in Proxmox for VMs IP.

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 ownyourlife.com.ng @localhost
nslookup ownyourlife.com.ng 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.

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

Select OS installation disc.

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

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

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:

40
2.275.031,80

Cart

Quantity 42,00
Quantity 6.300,00
Quantity 5.700,00
Quantity 52,00
Quantity 1.300,00