Unable to set DNS with nmcli ipv4.dns

nmcli> set ipv4.dns 192.168.1.254
nmcli> save persistent
Saving the connection with ‘autoconnect=yes’. That might result in an immediate activation of the connection.
Do you still want to save? (yes/no) [yes] yes
Error: Failed to save ‘mgtbridge’ (c4bab3d4-c3bf-4af6-b870-d4034bbdc6cb) connection: ipv4.dns-data: unknown property
nmcli>

Hi Support, is there any news?

What is the connection.type of mgtbridge? Does that type of connection have an ipv4.dns property? Is there another interface on the system it makes more sense to apply this configuration to? I don’t have any experience configuring bridges, but if they’re supposed to pass traffic between other interfaces at layer 2, it wouldn’t make any sense to me for them to have layer 3 configurables like IPv4. You’d configure DNS on the interface that has the host’s primary IP address instead.

In general I think you may need to back up and explain what it is you’re trying to accomplish with what components rather than try to address this specific error, i.e. we may be having the XY Problem.

Maybe this is a case of Unable to modify DNS settings with nmcli - General - Rocky Linux Forum? One suggestion there is that you edit the connection file. You could then nmcli con reload and see if it takes that way.

Hello,

I’ve had the same problem on a Rockylinux9.

It looks that there was a legacy configuration file in /etc/sysconfig/networkscripts/ifcfg-enp0s1 and there was some conflict.

So here are the steps I used to fix it:

  1. sudo dnf install NetworkManager-initscripts-updown
  2. sudo ifdown enp1s0
  3. sudo mv /etc/sysconfig/network-scripts/ifcfg-enp1s0 /root
  4. sudo systemctl restart NetworkManager
  5. sudo nmcli con mod enp1s0 ipv4.method manual ipv4.addresses 192.168.X.X/24 ipv4.gateway 192.168.X.X ipv4.dns X.X.X.X

I hope this can help anyone.

Regards!