I recently setup my raspberry pi as a pi-hole server, however, before this I used to use it as a DNS and DHCP server using dnsmasq, luckily Pi-hole comes with its own fork of dnsmasq which made this process super easy.
Let's get to it.
Firstly, I use archlinux arm so you would need to consult the documentation to install pihole.
Once you have your Pi-hole and your web administration server running you can now begin setting up your DHCP and DNS server, I have used the default Pi-hole blocklists you can choose to use additional ones.
Once you have the DHCP server enabled pi-hole will add its custom configuration to
Make sure you have
commented out in
~$ ls /etc/dnsmasq.d/ 01-pihole.conf 02-pihole-dhcp.conf 03-pihole-custom.conf
Once you have your dhcp server enabled you can add additional commands by creating a file like
Make sure you restart dnsmasq using
~]$ sudo systemctl restart dnsmasq.service
~]$ pihole restartdns
This is how my custom file looks like, since I want to push my raspberry-pi IP's as DNS servers to my clients.
~$ cat /etc/dnsmasq.d/03-pihole-custom.conf dhcp-option=option:dns-server,192.168.31.2,192.168.31.3 dhcp-host=medusa-arch.demodomain,192.168.31.4,36h
You can add static hosts using the
dhcp-host option like I did above and all the things that dnsmasq supports.
This helps in resolving local domains for example, or to resolve IP addresses to hostnames.
~]$ dig +short a medusa-arch 192.168.31.4 ~]$ dig +short -x 192.168.31.4 medusa-arch.demodomain.
Pi-hole basically does most of the heavy lifting using dnsmasq.
I hope this helps, I would be writing up a detailed post on how to install Pihole later.
Thank you for reading.