How to disable dnsmasq offered DNS service ?

As you know dnsmasq is a lightweight DNS, TFTP and DHCP server. It is intended to provide coupled DNS and DHCP service to a LAN.

[root@humbles-lap qemu]# ps aux |grep dnsmasq
nobody 1992 0.0 0.0 12968 496 ? S Nov21 0:00 /usr/sbin/dnsmasq –strict-order –bind-interfaces –pid-file=/var/run/libvirt/network/default.pid –conf-file= –listen-address 192.168.122.1 –except-interface lo –dhcp-range 192.168.122.2,192.168.122.254 –dhcp-lease-max=253

Dnsmasq accepts DNS queries and either answers them from a small, local, cache or forwards them to a real, recursive, DNS
server. It loads the contents of /etc/hosts so that local hostnames which do not appear in the global DNS can be resolved
and also answers DNS queries for DHCP configured hosts.

The dnsmasq DHCP server supports static address assignments and multiple networks. It automatically sends a sensible
default set of DHCP options, and can be configured to send any desired set of DHCP options, including vendor-encapsulated
options. It includes a secure, read-only, TFTP server to allow net/PXE boot of DHCP hosts and also supports BOOTP.

Dnsmasq supports IPv6 for DNS, but not DHCP.

[root@humbles-lap qemu]# netstat -talupan|grep dns
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 1992/dnsmasq
udp 0 0 192.168.122.1:53 0.0.0.0:* 1992/dnsmasq
udp 0 0 0.0.0.0:67 0.0.0.0:* 1992/dnsmasq
[root@humbles-lap qemu]#

If you want to disable dnsmasq offered DNS and to use your external DNS server , you can do it using port option/flag .. Specify port as “zero” :

-p, –port= Listen on instead of the standard DNS port (53). Setting this to zero completely disables DNS function, leav‐
ing only DHCP and/or TFTP

5 thoughts on “How to disable dnsmasq offered DNS service ?”

      1. If yes, Something like below

        [root@humbles-lap~]# netstat -talupan|grep dns
        tcp 0 0 0.0.0.0:53 0.0.0.0:* LISTEN 21377/dnsmasq
        tcp 0 0 :::53 :::* LISTEN 21377/dnsmasq
        udp 0 0 0.0.0.0:53 0.0.0.0:* 21377/dnsmasq
        udp 0 0 :::53 :::* 21377/dnsmasq

        [root@humbles-lap~]# kill -9 21377

        [root@humbles-lap~]# dnsmasq -p 0
        [root@humbles-lap~]# netstat -talupan|grep dns
        [root@humbles-lap~]#

        Or in libvirt way,

        nobody 21727 0.0 0.0 12880 444 ? S 15:41 0:00 dnsmasq -p 0 strict-order –bind-interfaces –pid-file=/var/run/libvirt/network/default.pid –conf-file= –listen-address 192.168.122.1 –except-interface lo –dhcp-range 192.168.122.2,192.168.122.254 –dhcp-lease-max=253

    1. Anoop , I havent tried.. how-ever did u get a chance to configure below parameters and give a try ?

      “no-resolv” and “dns-forward-max” parameters?

      from man page:

      -R, –no-resolv
      Don’t read /etc/resolv.conf. Get upstream servers only from the command line or the dnsmasq configuration file.

      -0, –dns-forward-max=
      Set the maximum number of concurrent DNS queries. The default value is 150, which should be fine for most setups. The only known
      situation where this needs to be increased is when using web-server log file resolvers, which can generate large numbers of concur‐
      rent queries.

      Other than atm , I can refer one more url;

      lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2009q3/003289.html

Leave a Reply

Your email address will not be published. Required fields are marked *