I am on CentOS 7.4 attempting to configure dnsmasq for DNS caching and per-zone DNS servers for running Consul. Essentially, the dnsmasq configuration boils down to this:
# filter everything with consul in the name and send to local consul resolver server=/consul/127.0.0.1#8600
The problem I'm having is getting the local resolver into
/etc/resolv.conf without replacing any other resolvers in the file.
I used to be able to do this using
dhclient configuration like so:
prepend domain-name-servers 127.0.0.1;
Since everything is NetworkManager now, I have discovered that the way to use dnsmasq is to add the following line to the
[main] section of
Before restarting NetworkManager, I see that my
/etc/resolv.conf contains the network DNS server received by DCHP:
# Generated by NetworkManager search nowhere nameserver 10.0.2.3 options single-request-reopen
Upon restarting NetworkManager with the above configuration change, it supersedes my network DNS server with 127.0.0.1:
# Generated by NetworkManager search nowhere nameserver 127.0.0.1 options single-request-reopen
Since dnsmasq uses the
/etc/resolv.conf to detect local resolvers, I'd like to leave the resolver(s) in
/etc/resolv.conf so that dnsmasq can discover them.
Is there a way to achieve the previous functionality of having NetworkManager just prepend the local resolver instead?