How to configure manual entries in /etc/resolv.conf instead of DNS1/DNS2 in ifcfg-ens192

                                  by Jephe Wu  - http://linuxtechres.blogspot.com


Summary

There are two things in RHEL7 which will use DNS1/DNS2 in /etc/sysconfig/network-scripts/ifcfg-ens192 instead of manual configuration for /etc/resolv.conf for nameserver lines.

1)  use NetworkManager in ifcfg-ens192 and also update dns in /etc/NetworkManager/NetworkManager.conf under main section by default

2) PEERDNS in ifcfg-ens192 will overwrite /etc/resolv.conf nameserver with DNS1/DNS2 anyway although IP is static not dhcp


Steps

You need to disable networkmanager and also PEERDNS


1) disable networkmanager


[root@server1 network-scripts]# grep -i nm_controlled ifcfg-ens192
NM_CONTROLLED=no

2) or disable dns in NetworkManager.conf

[root@server2 network-scripts]# grep dns /etc/NetworkManager/NetworkManager.conf
dns=none


3) also you need to disable PEERDNS


[root@server1 network-scripts]# grep -i peerdns /etc/sysconfig/network-scripts/ifcfg-ens192
PEERDNS=no


4) reload NetworkManager and restart network to make sure /etc/resolv.conf is not being emptied first before reboot

systemctl reload NetworkManager

systemctl restart network


5) reboot

No comments:

Post a Comment