0

I cannot find my DNS configuration definition on Centos7+NetworkManager :

$ cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)
$ cat /etc/resolv.conf
# Generated by NetworkManager
search myLAN.lan
nameserver x.y.z.t
$ systemctl status NetworkManager -n 1
● NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2022-08-12 17:48:36 CEST; 6min ago
     Docs: man:NetworkManager(8)
 Main PID: 127429 (NetworkManager)
   CGroup: /system.slice/NetworkManager.service
           └─127429 /usr/sbin/NetworkManager --no-daemon

Aug 12 17:48:42 DC-SCALITY-17 NetworkManager[127429]: <info>  [1660319322.9291] manager: startup complete

EDIT0 : It seems there is no NetworkManager plugin defined here, therefore the ifcfg-rh plugin will be used by default on RedHat/CentOS :

$ grep plugins /etc/NetworkManager/NetworkManager.conf
#plugins=ifcfg-rh,ibft
$ man NetworkManager.conf | sed -n '/ifcfg-rh/,/^$/ p'
       ifcfg-rh
           This plugin is used on the Fedora and Red Hat Enterprise Linux distributions to read and write configuration from the standard /etc/sysconfig/network-scripts/ifcfg-* files.
           It currently supports reading Ethernet, Wi-Fi, InfiniBand, VLAN, Bond, Bridge, and Team connections. Enabling ifcfg-rh implicitly enables ibft plugin, if it is available.
           This can be disabled by adding no-ibft. See /usr/share/doc/initscripts/sysconfig.txt and nm-settings-ifcfg-rh(5) for more information about the ifcfg file format.

So let's look into the /etc/sysconfig/network-scripts/ifcfg-* files :

$ egrep -i 'dns[12]=' /etc/sysconfig/network-scripts/ifcfg-*
$ for iface in bond0 em{1..4};do echo "=> DNS server IP for iface = $iface :";nmcli connection show $iface | egrep -i "ipv?4.dns.*:\s*[1-9]+\.";done
=> DNS server IP for iface = bond0 :
=> DNS server IP for iface = em1 :
=> DNS server IP for iface = em2 :
=> DNS server IP for iface = em3 :
=> DNS server IP for iface = em4 :
$ 

EDIT1 : The last egrep yielded nothing for all the network interfaces, therefore it seems the DNS ip has been defined somewhere else.

EDIT2 : Looking for the DNS ip in /etc/ :

$ sudo grep -r x.y.z.t /etc/
/etc/resolv.conf:nameserver x.y.z.t
/etc/ntp.conf:server x.y.z.t iburst
$

Although the /etc/resolv.conf file still mentions the # Generated by NetworkManager line, it seems that the nameserver x.y.z.t line was added there manually when it should have been added to /etc/sysconfig/network-scripts/ifcfg-bond0.

1
  • 1
    Please find on /etc/NetworkManager/ in there directory you fill see NetworkManager conf file, for a simple way, set value dns=none on /etc/NetworkManager/NetworkManager.conf and then set the DNS on /etc/resolv.conf
    – YonzLeon
    Aug 12, 2022 at 16:48

0

Your Answer

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