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: 176.58.121.5,109.74.193.20,109.74.192.20
ipv4.dns-search: members.linode.com

nmcli con mod eth0 ipv4.dns 127.0.0.1

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?

Thanks.

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
/etc/NetworkManager/system-connections/

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 "176.58.121.5 109.57.193.20 109.74.192.20" ?
No colon and no commas?
Also, you’ve added a 4th name server, the 127.0.0.1, 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 127.0.0.1

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 127.0.0.1” 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.