Using A Raspberry PI As A DNS Server

#raspberrypi #sysadmin

Goal: to have a central place to store hostnames so I don’t have to manually enter them on each computer on my home network.

$ sudo apt-get install -y dnsmasq

/etc/dnsmasq.d/home.conf

domain-needed
bogus-priv

domain=home

interface=eth0
listen-address=127.0.0.1
listen-address=192.168.0.3
bind-interfaces

expand-hosts

server=127.0.0.1
server=8.8.8.8
server=8.8.4.4

/etc/hosts

192.168.0.2  host host.home

Since I’m just using this for DNS and not DHCP there is a small issue with Windows and IPv6. My router lets me set the IPv4 DNS addresses, but I can’t set the IPv6 ones. So on Windows, the IPv6 servers are used to resolve the local names and timeout. Disabling IPv6 on Windows client was the quickest way to resolve this issue.