Friday, July 10, 2020

Prevent DNS Manager to Overwriting /etc/resolv.conf

Description: Here I have explained how to prevent DNS Manager to Overwriting /etc/resolv.conf after reboot server.

Procedure: In Centos 7 any custom dns store in /etc/resolv.conf, However if we simply add it in file we notice that after server reboot entries overwrite by NetworkManager. 

  • First we configure in NetworkManager for not to overwrite this file. Then, we will go and configure nameserver in  /etc/resolv.conf 
  • Network Configuration file located on /etc/NetworkManager/NetworkManager.conf Open this file on your editor like vi, vim or gedit.
  • Search for [main] section in this file and add entry as follow
  [main]
dns=none
  • Save file and restart network manager service
 # systemctl restart NetworkManager.service
  • Now add your Name Server to /etc/resolv.conf 
 nameserver 8.8.8.8
nameserver 4.4.4.4

  • Verify entries after  restart your server.


No comments:

Post a Comment