Running Xubuntu 16.04 here. My problem is that dnsmasq, as started by NetworkManager, ignores the dnsmasq.conf files in /etc/dnsmasq, /etc/NetworkManager/dnsmasq.d, and /etc/NetworkManager/dnsmasq-shared.d. Instead, NetworkManager starts dnsmasq with this command:

9949 ?        S      0:00 /usr/sbin/dnsmasq --conf-file --no-hosts --keep-in-foreground --bind-interfaces --except-interface=lo --clear-on-reload --strict-order --listen-address= --dhcp-range=,,60m --dhcp-option=option:router, --dhcp-lease-max=50 --pid-file=/var/run/nm-dnsmasq-wlan1.pid --conf-dir=/etc/NetworkManager/dnsmasq-shared.d

I can find nowhere on my system where an address range of,,60m is specified.

Where is this coming from???

  • Do you have the file /etc/dnsmasq.conf or /etc/dnsmasq? Looks like the manual expects the former. A restart would be necessary of the service after a change as well.
    – 111---
    Aug 8, 2017 at 16:41
  • Yup, I have /etc/dnsmasq.conf. And /etc/NetworkManager/dnsmasq.d/dnsmasq.conf. Both are ignored. And yes, there have been several system restarts. Aug 8, 2017 at 22:36
  • I believe that the problems is caused by the "--conf-file (blank)" directive being issued by NetworkManager when it starts dnsmasq. How can I remove this directive from the command line that NetworkManager is issuing? Apparently a test that NetworkManager is performing is not working properly: strings /usr/sbin/NetworkManager|grep conf_file conf_file != NULL Sep 17, 2017 at 19:15
  • On my system dnsmasq is not being started by init, but by NetworkManager. NetworkManager (a binary) is generating the command internally and (I believe) blowing it when checking for the definition of an environment variable called 'conf_file'. Oct 7, 2017 at 15:41
  • Exporting "conf_file=dnsmasq.conf" in the NetworkManager startup script didn't work. Here's the two relevant lines from syslog: Oct 6 11:19:44 localhost dnsmasq-dhcp[13278]: DHCP, IP range --, lease time 12h Oct 6 11:19:44 localhost dnsmasq-dhcp[13278]: DHCP, IP range --, lease time 1h Apparently, the environment variable was detected and used to produce the first line, which was immediately undone by the second line. Oct 7, 2017 at 15:41

2 Answers 2


OK, got it. direct from the source, file : nm-dnsmasq-manager.c

/* dnsmasq may read from it's default config file location, which if that location is a valid config file, it will combine with the options here and cause undesirable side-effects. Like sending bogus IP addresses as the gateway or whatever. So tell dnsmasq not to use any config file at all. */

NetworkManager is jealous of dnsmasq configuration values, and will not allow outside interference with them. NetworkManager internally builds and issues the command line that starts dnsmasq, and in doing so, includes the --conf-file (blank) directive, which prevents use of any user or system-supplied dnsmasq configuration file.

  • 2
    Explain it to me like I’m five years old — how does this answer the question? Do not respond in comments; edit your answer to make it clearer and more complete. Oct 10, 2017 at 16:24

Context/Cause: NetworkManager, being a Lennard Poettering project, is openly hostile towards Unixy things, and tries to replace GNU and call itself “the Linux”. Therefore, it shuns tried and tested principles like “everything is a file”. Leading to it offering command line interfaces for configuration, that are using some “automagical” state files in the back (because Linux is still Unixy, imagine that).

Intended solution

So the way it is intended to be configured, is to either

nmcli connection modify MyConnection ipv4.addresses # Set the IP range here
nmcli connection up MyConnection # Restart the connection to apply it

Which, on Linux Mint, can be done via the GUI too, by editing the connection, and adding a line to the table below “Address(es)” in the IPv4 and IPv6 tabs. (Though this is confusing, and may result in merely assigning secondary addresses without removing the “automagic” one.)

Professional solution

Or we can just alter the files that these commands modify, and gain the ability to apply such changes even when we don’t want to execute anything. (Like when provisioning machines in a company network.) Which, on Linux Mint, would be:

vi /etc/NetworkManager/system-connections/MyConnection.nmconnection # Or in my case, is just copy the file over from my central storage.
nmcli connection reload # Only necessary when there is no boot following
nmcli connection up MyConnection # ditto


In any case, replace MyConnection by the name of your connection, that you can find via nmcli connection or in the id field of the [connection] section of your .nmconnection file. (Note that the file name may escape some special characters and hence not be exactly the same. And if done manually, does not need to be the same at all.)

It seems e.g. would set the server’s own IP to and give the clients an IP in the range to I’d prefer it if the server’s IP could be set separately, but at least it does the job.

What I haven’t included here, is how to do it when you need to bridge two networks so they have the same IP range. (Like a laptop usually connecting via WIFI, but getting the same server IP address when connecting via Ethernet cable for speed.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .