Home Installing and Configuring DNSMasq
Post
Cancel

Installing and Configuring DNSMasq

DNSMasq (dnsmasq) is a wonderful package that combines a DHCP server and a DNS server in one package. All of the configuration is done in one configuration file.

Installation:

1
2
3
4
sudo dnf update -y
sudo dnf install dnsmasq -y
sudo systemctl enable dnsmasq
sudo reboot

The first configuration file is in /etc/dnsmasq.conf. This file is almost entirely comments. I would suggest not modifying it.

This file includes the following files:

/etc/dnsmasq.d/,*.conf

So I would suggest creating your own configuring your own configuration file.

nano /etc/dnsmasq.d/dnsmasq.conf

In that file put the folling informtion:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#group=dnsmasq # One of the few options set in /etc/dnsmasq.conf
#user=dnsmasq # One of the few options set in /etc/dnsmasq.conf
listen-address=10.0.1.1
bogus-priv
#conf-dir=/etc/dnsmasq.d/,*.conf
dhcp-authoritative
dhcp-option=option:dns-server,10.0.1.1
dhcp-option=option:router,10.0.1.1  # gateway, not always needed
#dhcp-option=23,50 # TTL
#dhcp-option=option:ntp-server,192.168.0.4,10.10.0.5
#dhcp-leasefile=/var/lib/dnsmasq/dnsmasq.leases
dhcp-range=10.0.1.10,10.0.1.250,255.255.255.0,12h
#dhcp-range=10.0.1.10,statis,255.255.255.0,12h # no dynamic address available
domain-needed
domain=domain.local
expand-hosts
local-service
#local=domain.local
no-resolv  # Do not use /etc/resolv.conf
server=8.8.8.8  # DNS server to forward to if not found locally

# Static IP reservations
dhcp-host=BC:24:11:0D:FE:60,thedoctor.domain/local,10.0.1.13

Then (re)start dnsmasq:

1
servicectl restart dnsmasq

Sources:
https://carpie.net/articles/setting-up-a-home-network-dhcp-dns-server-with-dnsmasq/

This post is licensed under CC BY 4.0 by the author.