Unable to modify DNS settings with nmcli

cat /etc/rocky-release

Rocky Linux release 9.2 (Blue Onyx)

nmcli con show eth0

connection.id: eth0

ipv4.method: manual
ipv4.dns-search: members.linode.com

nmcli con mod eth0 ipv4.dns

Error: Failed to modify connection ‘eth0’: ipv4.dns-data: unknown property

I specified ipv4.dns, not ipv4.dns-data.
Anyone else had/having this problem?


Others on here might not like this reply, but I just do it the old way.

on older EL releases everything to do with network connections used to be in /etc/sysconfig/network-scripts, and were known as ifcfg format.
in the newer EL linux and fedora its in

just edit the file and either restart network manager or reboot.

I really dont care to learn nmcli.

regards peter

Isn’t it
nmcli con mod etho ipv4.dns "" ?
No colon and no commas?
Also, you’ve added a 4th name server, the, I think (but not sure if it holds for nmcli) that you can only have 3 name servers.
Also, of course, you could use nmtui.

The ‘con mod’ replaces, rather than adds to list. For adding, you would:
nmcli con mod eth0 +ipv4.dns

That limit (three) is in the resolver in glibc, not on front-ends. (presumably).
One can change the resolver that NetworkManager does use, with dns= option in NM’s config.

I do use dns=dnsmasq, where NM starts a dnsmasq process and writes only “nameserver” into resolv.conf. Then NM passes actual nameservers to the dnsmasq process via DBus.

Google finds more than just this thread with same error message. No clear solutions, as far as I did browse.

The rpm -q --changelog NetworkManagershows:

* Wed Jul 05 2023 Wen Liang <wenliang@redhat.com> - 1:1.42.2-5
- make sure that the IP and DNS configuration gets applied when it changes (rh #2219847)

If I had to guess (and I have to), I would bet that that update has something to do with it.

The connections are in in-file format, so should be easy to edit. Edit&restart will avoid the issue that the tools may have.

One should reproduce the issue in CentOS Stream 9 and then fill a bug report for Red Hat to chew on.