In CentOS 7 you will often find /etc/resolv.conf overwritten after each reboot or network service restart. It’s done the NetworkManager. If you check your resolv.conf after reboot you will see that your changes are gone and it will look something like this
[root@cpanel ~]# cat /etc/resolv.conf search domain.tld # Generated by NetworkManager nameserver 184.108.40.206 [root@cpanel ~]#
This happens because of the DNS entries present in the network interface files. Check for DNS1 and DNS2 entries in the network config files and and remove them.
[root@cpanel ~]# cd /etc/sysconfig/network-scripts [root@cpanel network-scripts]# grep DNS ifcfg-* ifcfg-ens160:PEERDNS=yes ifcfg-ens160:IPV6_PEERDNS=yes ifcfg-ens160:DNS1=220.127.116.11 [root@cpanel network-scripts]#
I above example removing the “DNS1=18.104.22.168” entry from the ifcfg-ens160 file will solve the problem.