There is nothing wrong with the “default files” approach.
The dnsmasq.service
starts /usr/sbin/dnsmasq
– no command-line options, so it goes with defaults and reads the /etc/dnfmasq.conf
that contains:
user=dnsmasq
group=dnsmasq
interface=lo
bind-interfaces
conf-dir=/etc/dnsmasq.d,.rpmnew,.rpmsave,.rpmorig
One should not edit that file, but add a file with your options into /etc/dnsmasq.d/
When you tell NetworkManager.service
to use dns=dnsmasq
, it will start its own instance of dnsmasq, with some options:
/usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/run/NetworkManager/dnsmasq.pid --listen-address=127.0.0.1 --cache-size=400 --clear-on-reload --conf-file=/dev/null --enable-dbus=org.freedesktop.NetworkManager.dnsmasq --conf-dir=/etc/NetworkManager/dnsmasq.d
Just like with the dnsmasq.service
one can add custom config by adding into directory, but now the conf-dir
points to directory /etc/NetworkManager/dnsmasq.d/
Note also that “all” files in the conf-dir are read – I had Emacs leave *~ files in there to mess up.
Another difference is that NetworkManager passes DNS-options that it has for connections to the dnsmasq (via DBus), but for standalone dnsmasq.service
you do pass the upstream DNS server addresses by other means.
It is thus more convenient to use the NetworkManager, since you most probably want the dnsmasq to both resolve names for this host and provide DNS/DHCP/TFTP service for others.
If the “fedora howto” does show config for instance of dnsmasq started by NetworkManager, then it is probably more approriate to start from.
The man dnsmasq
tells that there is option --test
that one can use to hunt syntax errors from config files:
dnsmasq --conf-file=/dev/null --conf-dir=/etc/NetworkManager/dnsmasq.d --test