On CentOS 7, I’m doing the following:
> /etc/NetworkManager/conf.d/000-hands-of-my-resolv.conf
# -*- ini -*-
[main]
## configure NetworkManager to not manage /etc/resolv.conf, as we'll bring our own
## man NetworkManager.conf
dns=none
> /etc/NetworkManager/dispatcher.d/50-update-dnsmasq-resolv-conf
#!/bin/bash
## script to be executed when dhcp changes are made; maintains /etc/resolv.conf
## man NetworkManager
interface="${1}"
action="${2}"
/bin/logger -t "${0}" \
"invoked for interface ${interface:-<not_provided>} and action ${action} with nameservers '${IP4_NAMESERVERS}', domains '${IP4_DOMAINS}'"
if [ -n "${IP4_NAMESERVERS}" ] && [ -n "${IP4_DOMAINS}" ]; then
echo "# generated by ${0}; do not edit" >| /etc/resolv.conf.dnsmasq
for ns in ${IP4_NAMESERVERS}; do
echo "nameserver ${ns}" >> /etc/resolv.conf.dnsmasq
done
## use IP of eth0, so we can use the same resolv.conf and mount it in
## containers
local_ip=$( ip addr show eth0 | awk '/inet / {print substr($2, 0, index($2, "/") - 1)}' )
echo "# generated by ${0}; do not edit" >| /etc/resolv.conf
echo "nameserver ${local_ip:-127.0.0.1}" >> /etc/resolv.conf
if [ -n "${IP4_DOMAINS}" ]; then
echo "search ${IP4_DOMAINS}" >> /etc/resolv.conf
fi
fi
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
>
> GitHub Issues:
https://github.com/hashicorp/consul/issues
> IRC: #consul on Freenode
> ---
> You received this message because you are subscribed to the Google Groups "Consul" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
consul-tool...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/consul-tool/af5f85ab-4d9e-4a9a-8ad8-2e2edbef3912%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.
—
Brian Lalor
bla...@bravo5.org