I would like to use only dnsmasq to forward all dns requests to google's dns server and disable dhcp...

How can I achieve this result?

4 Answers 4


dnsmasq has dhcp server disabled by default. To enable it you have to uncomment dhcp-related lines in /etc/dnsmasq.conf

to forward all requests to it's sufficient to add (without touching dnsmasq config) in /etc/resolv.conf:

# In order to configure dnsmasq to act as cache for the host on which  it
# is  running, put [as the first line] "nameserver" in /etc/resolv.conf to force
# local processes to send queries to dnsmasq. [...]
# dnsmasq is smart enough to ignore this line and forward all queries appropriately, 
# while all other applications will send all their queries to dnsmasq. 

That's it :)

  • @CraigHicks Please explain better. The question here is: "Disable dhcp service in dnsmasq"
    – Pitto
    Apr 17, 2019 at 7:17
  • 1
    My mistake - sorry. Apr 17, 2019 at 7:42

Just comment out the dhcp-related lines in your dnsmasq.conf file and then restart dnsmasq.


To disable DHCP, comment out all of the "dhcp-range" settings in the dnsmaq.conf file, and remove all "--dhcp-range" command line options used when starting the "dnsmasq" executable program/daemon.

Example filename: /etc/dnsmasq.conf

Example commented out line:


Source: dnsmasq doc


On Ubuntu [18.04]: comment out all


lines in both files:




Then just restart the service: sudo systemctl restart dnsmasq

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.