Cannot set ndots with nmcli.
Hi All,
I am using RHEL 8.6. (But even on RHEL 9 I have the same problem)
I need to use ndots option for nslookup.
On my servers, I use nmcli settings with NetworkManager keyfiles; I do not use old ifcfg scripts (/etc/sysconfig/network-scripts/).
Thus I have added ndots option with command :
nmcli connection modify ens192 ipv4.dns-options "ndots:5"
It adds well ndots:5 option to active connection, and I can see it with nmcli -p connection show ens192.
Then I reload and restart network services, even reboot the server, I still cannot resolve host host1.mylab.abc.zone1.com
But when I do nslookup command like => nslookup -ndots:5 host1.mylab.abc.zone1.com it resolves the host.
How to correctly enable ndots in nslookup ?
I cannot manually add this option to /etc/resolv.conf, because my /etc/resolv.conf is automatically Generated from NetworkManager, and I need to keep it as such. I've even tried dns-options paragraph in NetworkManager conf files - no luck.
Actually, what I really need is, to find where and how to put ndots option in NetworkManager conf files.
Can you help me?
Responses
Your steps work fine for me with NetworkManager-1.40.16-4.el8_8
and NetworkManager-1.42.2-6.el9_2
:
# nmcli con show net0 | grep ipv4.dns-options
ipv4.dns-options: ndots:5
/etc/NetworkManager/system-connections/net0.nmconnection
...
[ipv4]
dns=192.0.2.1;
dns-options=ndots:5;
/etc/resolv.conf
# Generated by NetworkManager
search local
nameserver 192.0.2.1
options ndots:5
My /etc/resolv.conf
is an actual file, not a symlink. This is required so NM manages the contents, as described in man NetworkManager.conf
section dns
. Make sure your NM config files do not have something like dns=none
. Check with:
# grep -RHn dns /etc/NetworkManager/