I am setting up a new server for my home. In earlier server versions i did setup a separate dns and dhcp-server, and configured it to update dhcp records into dns. Now is this not the easiest thing to accomplish, especially when you do it one time in about 3 or 4 years…
So for my new server i was looking for an easier solution.. And its there! it’s called dnsmasq, and here is how…
First of all, you need to install dnsmasq:
sudo apt-get install dnsmasq
After that you need to configure /etc/dnsmasq.conf
servacc@xerus:~$ cat /etc/dnsmasq.conf | grep -v "#" | grep -v "^$" domain-needed bogus-priv no-poll server=212.45.32.3 server=212.45.33.3 local=/doornenbal.lan/ address=/double-click.net/127.0.0.1 no-hosts addn-hosts=/etc/dnsmasq_static_hosts expand-hosts domain=doornenbal.lan dhcp-range=192.168.1.101,192.168.1.150,255.255.255.0,72h dhcp-host=78:25:44:00:06:89,192.168.1.40 dhcp-option=option:router,192.168.1.1 dhcp-option=option:ntp-server,83.247.2.80
For the meaning of all options i refer to the link above (dnsmasq)
As you can see, i am using a separate hosts file: /etc/dnsmasq_static_hosts. It seems better for me to use a separate one, to prevent confusion.. This file contains all static hosts inside my netwerk, written i a style of a normal host file:
127.0.0.1 localhost 192.168.1.1 router fritzbox 192.168.1.3 wifi tplink
As you can see in this partial example, i have multiple host names after a ip-address, and this works like a charm! Happy
if you want to see what leases are given away, you can have a look here:
cat /var/lib/misc/dnsmasq.leases 1519239181 48:e2:44:f4:f0:43 192.168.1.132 XPS15 01:48:e2:44:f4:f0:43 1519239148 00:04:20:f1:dd:cc 192.168.1.141 HarmonyHub 01:00:04:20:f1:dd:cc 1519239144 78:25:44:00:06:89 192.168.1.40 plugwise *
As you can see, this file is easy to read. The latest result is from the configured dhcp-host entry in the dnsmasq.conf.
For SOHO is dnsmasq really easy to implement, i am very happy with the result.