This article offers a 5 min howto about configuring your own DNS server (perhaps for your company or maybe for your home network) using DNSmasq. Obviously, only the surface is covered on this post.

Given my router does not allow me to add host entries for local DNS resolution, I decided to use DNSMasq on one of my internal network servers to be able to do it. Once configured, I would make all internal devices use this “personal” DNS server instead of the router one.


For Debian based distributions, it can be installed via apt package manager:

sudo apt install dnsmasq

Service scripts


service dnsmasq start


service dnsmasq stop

Enable automatic start

systemctl enable dnsmasq

Cache DNS

The goal is to make DNS cache act as DNS proxy for non-internal DNS names. To do it so, we must set the DNS server we want DNSmasq to ask to in order to resolve those external names. It can be either, your ISPs, a public one like googles or, like in my case, my routers.

This is done in /etc/resolv.conf. For example, to set google’s DNS server:


Or to set more than one (my router’s and google’s):


DNS entries

Each time you want a new internal DNS name to be resolved, all you have to do is add a new line on /etc/hosts testhost

and reload the service

sudo service dnsmasq reload

Test it

Test it and confirm both the internal and external names are being resolved

$ nslookup
> server
Default server:
> testhost

Name:   testhost


Non-authoritative answer:
Addresses: 2a00:1450:4003:80b::200e 

Configure your devices

Now you have a working new DNS server, just configure your internal network devices to use it.