17

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?

Pitto
  • 2,009
  • 10
  • 33
  • 49

4 Answers4

17

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 208.67.222.222 it's sufficient to add (without touching dnsmasq config) in /etc/resolv.conf:

nameserver 127.0.0.1 
# In order to configure dnsmasq to act as cache for the host on which  it
# is  running, put [as the first line] "nameserver  127.0.0.1" 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. 
nameserver 208.67.222.222

That's it :)

Pitto
  • 2,009
  • 10
  • 33
  • 49
7

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

EEAA
  • 108,414
  • 18
  • 172
  • 242
0

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:

#dhcp-range=192.168.0.50,192.168.0.150,12h

Source: dnsmasq doc

Jason
  • 101
0

On Ubuntu [18.04]: comment out all

dhcp-*
dhcp-range=

lines in both files:

/etc/dnsmasq.d/dhcp-settings

and

/etc/dnsmasq.conf

Then just restart the service: sudo systemctl restart dnsmasq

Kostyantyn
  • 211
  • 2
  • 4