dnsmasq listen on 0.0.0.0 when started by NetworkManager

0

Is it possible to configure NetworkManager or dnsmasq to listen on 0.0.0.0 when dnsmasq is started by NetworkManager process ?

I have noticed whatever I put in /etc/NetworkManager/dnsmasq.d/00-example.conf file, like:

listen-address=0.0.0.0

dnsmasq is started with following arguments by NetworkManager:

/usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/var/run/NetworkManager/dnsmasq.pid --listen-address=127.0.1.1 --cache-size=0 --conf-file=/dev/null --proxy-dnssec --enable-dbus=org.freedesktop.NetworkManager.dnsmasq --conf-dir=/etc/NetworkManager/dnsmasq.d

Any idea how to change --listen-address option ?

Igor Delac

Posted 2020-02-05T09:52:14.293

Reputation: 1

Answers

0

I think you are on Ubuntu, what happens here is that dnsmasq is used by Network Manager as plugin to cache your local dns queries, reason why it's predefined on the command line :

--listen-address=127.0.0.1

So in order to make a configuration for your local network, you will need to disable the default dnsmasq, by commenting out the line under the above file /etc/NetworkManager/NetworkManager.conf :

#dns=dnsmasq

Once done, restart NM :

systemctl restart NetworkManager

Then you will need to install a standard version of dnsmasq and use it for your own purpose.

COMPLEMENTARY : Once the standard version installed on one of your servers, this will be your DNS server, it should have a fixed ip since you are using dhcp server for your network, finally to make your dns server listening on all its ips not only on the loopback (127.0.0.1) ** you should put under the config file **/etc/dnsmasq.conf :

listen-address=0.0.0.0

Reda Salih

Posted 2020-02-05T09:52:14.293

Reputation: 144

but then I need to know in advance IP address(es) of DNS server(s). If I switch on another network, NetworkManager will get new IP address from dhcp server, and update dnsmasq with new IPs of DNS servers. If I use standalone dnsmasq, I need to configure DNS servers in advance. Right ? Or there is a way to configure NetworkManager to update /etc/resolve.conf file with new DNS servers everytime I join new network. – Igor Delac – 2020-02-06T07:01:50.943