resolv.conf is replaced after every reboot
search cancel

resolv.conf is replaced after every reboot

book

Article ID: 265601

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

Changed the nameserver from  SSGCONFIG menu. 

Added search domain and two DNS server IP 

 After a server reboot is get replaced with only the domain search 

/etc/resolv.conf

Environment

Release : 10.1

Cause

networkmanager is overwriting on each reboot

Resolution

Followed the 3 steps in this link - no longer getting replaced:

https://wiseindy.com/blog/linux/how-to-set-dns-in-centos-rhel-7-prevent-network-manager-from-overwriting-etc-resolv-conf/

Step 1

The NetworkManager configuration is located here: /etc/NetworkManager/NetworkManager.conf Open this file using vim or your favorite text editor.

Search for the [main] section in this file. It should look something like this:

[main]

#plugins=ifcfg-rh,ibft

Add dns=none just after the [main] tag like this:

[main]

dns=none

#plugins=ifcfg-rh,ibft

Go ahead and save the file.

Step 2

Let’s restart the NetworkManager.service service so that it picks up the changes we made to the configuration.

# sudo systemctl restart NetworkManager.service

Note that the service name NetworkManager.service is case-sensitive.

Step 3

Now, let’s add our nameservers to /etc/resolv.conf

Open this file in you favorite text editor and specify the name

REBOOT to verify