Code: Select all
address=/example.com/127.0.0.1
Code: Select all
timeout 300;
retry 60;
prepend domain-name-servers 127.0.0.1;
Code: Select all
[main]
dns=none
What is the right way to do this in CentOS 8?
Code: Select all
address=/example.com/127.0.0.1
Code: Select all
timeout 300;
retry 60;
prepend domain-name-servers 127.0.0.1;
Code: Select all
[main]
dns=none
You have two things there:OnlyTwentyCharacters wrote: ↑2020/07/20 13:26:45I'm trying to get subdomains to resolve to localhost in CentOS 8. In CentOS 7 I had a dnsmasq config file which would say
Then in dhclient.conf I hadCode: Select all
address=/example.com/127.0.0.1
This allowed all the example.com subdomains to resolve to the localhost. In CentOS 8 everything is run by NetworkManager and I have not found a way to achieve the same behaviour.Code: Select all
timeout 300; retry 60; prepend domain-name-servers 127.0.0.1;
Code: Select all
# nmcli -f ipv4 c s $conn_name
ipv4.method: auto
ipv4.dns: --
ipv4.dns-search: --
ipv4.dns-options: --
ipv4.dns-priority: 0
...
ipv4.ignore-auto-dns: no
...
That option dns has many possible values, including dnsmasq (systemd-resolved and unboud). See man NetworkManager.confOnlyTwentyCharacters wrote: ↑2020/07/20 13:26:45If I add the a NetworkManager configuration file with the following contentand manually run "dhclient" then NetworkManager no longer overwrites /etc/resolve.conf on every boot. Does anything update resolve.conf anymore if DNS servers happen to change or do I need to keep running dhclient manually?Code: Select all
[main] dns=none
It is possible to pass custom options to the dnsmasq instance by adding them to files in the "/etc/NetworkManager/dnsmasq.d/" directory.
Code: Select all
address=/example.com/127.0.0.1
addn-hosts=/etc/hosts
Code: Select all
[main]
dns=dnsmasq
The 'ps' output in that Hale's blog (and comments in file) shows that NetworkManager gives option '--no-hosts' to the dnsmasq.OnlyTwentyCharacters wrote: ↑2020/07/21 11:03:45If I didn't add "addn-hosts=/etc/hosts" to the configuration, for example "dig" would fail to resolve addresses from the hosts file.
I do guess the rationale behind that.man dnsmasq wrote:-h, --no-hosts
Don't read the hostnames in /etc/hosts.