I've successfully installed DNSMasq on a Debian machine and everything seems to be working. Here's what I did:

  1. install DNSMasq with sudo apt-get install dnsmasq

  2. update file /etc/dnsmasq.d/home.dns with the following contents:

     # General configuration
     # Device IPs
     dhcp-host=00:00:5e:00:52:12,android, is my ISP router's IP.

  1. turn off DHCP on my ISP router
  2. restart DNSMasq service with sudo service dnsmasq restart

That's all great, but I'm new to networking and have a bunch of questions:

  1. how does DNSMasq communicate with the router? I mean, how does it tell the router that it should start using DNSMasq's DHCP server from that point on? Is there a specific protocol for that, whereby DNSMasq communicates with the router, or is it DHCP itself?

  2. why didn't I have to configure my devices (an android phone and a desktop computer) to use DNSMasq's DNS server? [The answer to this one may be the same as from the question above, but anyways...]

  3. is there a way of using DNSMasq for DNS only and have the router's DHCP server "talk to" or "use" DNSMasq's DNS server? This way I wouldn't need to turn the router's DHCP server off.

As I said, I'm a newbie, but I couldn't find answers to these questions anywhere on the web.


DNSmasq does not need to communicate with your router. The DNSmasq service just took over the service of DNS and DHCP and your router does not have to provide that anymore. Since you have disabled the DHCP service on your router, only the DHCP server of the computer running DNSmasq will answer DHCP requests.
Your DHCP clients (android phone and desktop) get all needed information from the DHCP server, like IP address and netmask, DNS server and default router. From man dnsmasq:

By default, dnsmasq sends some standard options to DHCP clients, the netmask and broadcast address are set to the same as the host running dnsmasq, and the DNS server and default route are set to the address of the machine running dnsmasq.

In your case, you have set


which tells the clients to use as the default route. DNSmasq will also pick up the configuration in /etc/resolv.conf form the machine it is running to configure upstream DNS servers to resolve addresses outside your LAN.

You can run the DHCP server on a different server than your DNS server is running. But you will have to keep track of the clients and their IPs and corresponding names. In small networks you can easily assign static IP addresses and names, but that is nothing you want to do. There is also the option to dynamically update the DNS records from the DHCP server which is called dynamic DNS updates (DDNS) but needs a bit more configuration.

  • Wow, that was a great answer! "Your DHCP clients (android phone and desktop) get all needed information from the DHCP server." Could you explain a bit more how this happens? I'm still confused as to how my devices know about the new DHCP server ("inside" DNSMasq) out of the box, with no explicit configuration on their side. For instance, my android phone connects to the LAN through wi-fi, so I thought it had to talk to the router first and only then with DNSMasq. – Panos Jul 15 '18 at 17:49
  • 2
    Well, clients send DHCP requests which is broadcast on the net, either over wire or after joining a WiFi network. At that point the clients do not have an IP address yet and they send a DHCP request including their MAC address. A DHCP server then answers depending on its configuation and normally assigns an IP address the client accepts. Additionally the DHCP server will tell the client which DNS servers and search pathes to use and which default router to use for the network. In IPv6 things are a bit different. – Thomas Jul 15 '18 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.