Assume having a host with single, IPv4 only connection, named ens192, which has statically configured network settings (IP, DNS, gateway), named vm1.example.invalid
. NetworkManager will add the following string to /etc/resolv.conf:
search example.invalid
Sometimes you don't want that or want to replace search domain with some other domain. When you do
nmcli connection modify ens192 ipv4.dns-search foo.invalid
/etc/resolv.conf will contain
search foo.invalid example.invalid
The question is:
How can i unset default search example.invalid
in generated /etc/resolv.conf, using NetworkManager only?
What i tried:
- Explicitly setting
ipv4.dns-search
, like in example above, setting ipv6.dns-search failed with this property is not allowed for 'method=ignore'
. Default domain search
still appended to new dns-search.
- Reconfiguring server using nm-tui
- Setting search domain to
.
which is not only useless due to p.1, but also ignored in source code
- removing offending domain from /etc/resolv.conf. After restarting NetworkManager - it regenerates back
- Tried messing with network-scripts - but unsuccessfully
Workaround:
In my case, due to existing *.example.invalid wildcard A DNS record, this default search domain setting messed with resolving of non-existing domains and with kubernetes nodes, which are using ndots 5
by default (relevant issue for openshift and an article), resulting in broken dns within cluster. I resorted to manual management of /etc/resolv.conf, which is covered by Redhat docs, and while it works - I'd like to manage networking from one obvious place (NetworkManager), and to understand, why exactly this default record is even added? I tried skimming through NM source code, but not being a C programmer - haven't found a part where this default domain is being set.