0

Centos 7.5, nmcli version 1.20.2

Whenever I try to remove entries from /etc/resolv.conf I get the following errors.

[root@client ~]# cat /etc/resolv.conf 
# Generated by NetworkManager
search home
nameserver 8.8.8.8
nameserver 192.168.1.1
[root@client ~]# nmcli connection modify enp0s3 -ipv4.dns 8.8.8.8
Error: failed to remove a value from ipv4.dns: the property doesn't contain DNS server '8.8.8.8'.
[root@client ~]# nmcli device show enp0s3 
GENERAL.DEVICE:                         enp0s3
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         08:00:27:FA:EE:AC
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected)
GENERAL.CONNECTION:                     enp0s3
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/4
WIRED-PROPERTIES.CARRIER:               on
IP4.ADDRESS[1]:                         192.168.1.8/24
IP4.GATEWAY:                            192.168.1.1
IP4.ROUTE[1]:                           dst = 0.0.0.0/0, nh = 192.168.1.1, mt = 100
IP4.ROUTE[2]:                           dst = 192.168.1.0/24, nh = 0.0.0.0, mt = 100
IP4.DNS[1]:                             8.8.8.8
IP4.DNS[2]:                             192.168.1.1
IP6.ADDRESS[1]:                         fe80::18c:3f05:dcaf:65fd/64
IP6.GATEWAY:                            --
IP6.ROUTE[1]:                           dst = ff00::/8, nh = ::, mt = 256, table=255
IP6.ROUTE[2]:                           dst = fe80::/64, nh = ::, mt = 256
IP6.ROUTE[3]:                           dst = fe80::/64, nh = ::, mt = 100
[root@client ~]# systemctl is-active NetworkManager
active
0

I seemed to have gotten it to work by adding the dns=none to the /etc/NetworkManager/NetworkManager.conf file under the [main] section and then restarting NetworkManager

I can then add DNS entries to the /etc/sysconfig/network-scripts/ifcfg* files like so

DNS1=192.168.1.175
DNS2=192.168.1.176

Or directly to /etc/resolv.conf using vim

0

Those values in capital letters are calculated - fetched from the DHCP if not provided manually. Have a look at the entry ipv4.dns. I bet yours is empty.

If you wish - add them yourself by setting the DNS entries:

nmcli connection modify enp0s3 ipv4.dns 192.168.1.1
nmcli connection down enp0s3
nmcli connection up enp0s3

EDIT: Indeed I made a typo here. Have look above.

  • Am I not doing that? I get the error seen above – Timothy Pulliam Mar 1 at 13:49
  • Right. I've copied the line but did not make the very basic editing. My bad. – Szczad Mar 1 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.