As always, the first thing you have to ask yourself is that why do you want to set up a DNS server? Here are a few of mine:
- Access web services via custom domains instead of IP addresses
- Update multiple devices (including mobile devices) is time consuming and inconvenient
- Router does not provide a DNS server
I run many web services in the local network, for example, GitLab for code repository and Ghost for blogging. Instead of typing IP address for each service, it will be much easier to use custom domain names, for example, accessing my blog via http://ghost/, not dot com nor localhost.
This can be easily done if there is just one machine. You can update the host configuration file in the local machine such as
/etc/hosts in Linux or
C:\Windows\System32\drivers\etc\hosts in Windows. But I have multiple devices: a laptop, a tablet, and of course a smartphone. Updating multiple devices is a pain. And for many mobile devices running systems such as iOS or Android, it is not easy to edit the host configuration file without rooting the devices. Therefore, we will opt to update a single DNS configuration file.
DNS configuration can be inherited from the DHCP server from the local network router. Unfortunately, the router I have does not provide a built-in DNS server. I have to setup my own DNS server. Once the DNS server has been setup, the router will use the server as the primary DNS server, and falls back to default gateway IP as the secondary DNS server, or we can use either Google’s public DNS server with IP address
184.108.40.206 or any other alternatives.
- Primary DNS server:
- Secondary DNS server:
I am going to setup a DNS server in a Debian Jessie machine. Here is a summary of steps:
- Install BIND
- Add custom zone