DNS Servers keep resetting back

10 posts / 0 new
Last post
#1 Sun, 06/29/2014 - 05:16
amityweb

DNS Servers keep resetting back

Hi

I tried changing DNS servers in "Hostname and DNS Client" to add in an extra 2 (Googles) for backup (because Linode DNS went down earlier), BUT when I Apply the changes, and go back in its reset them back to the original ones. This only happens on some of my virtualmin servers.

Does anyone know why the DNS servers keep resetting back??

Thanks

Mon, 06/30/2014 - 13:31
andreychek

Howdy,

Are you by chance using DHCP on those servers where the DNS settings get overwritten?

If so, take a peek at the following link, in the section named "Received Virtualmin error that 127.0.0.1 isn't listed in /etc/resolv.conf":

https://www.virtualmin.com/documentation/dns/faq

Tue, 07/01/2014 - 04:51
amityweb

Looks like the servers are DHCP, they're Linode https://library.linode.com/networking/configuring-static-ip-interfaces#s...

But I am a little confused as to what I should change to stop resolv.conf overwriting. The link you sent is mainly instructions about adding 127.0.0.1 to a /etc/dhclient.conf file. I guess thats not my issue?

Some of my servers overwrite resolv.conf and some dont which is weird. I can see eth0 differences as follows, should I change eth0 as per the Linode static network guide??

eth0 on server that resolve.conf overwrites:

####
# eth0 default configuration
#

DEVICE="eth0"
BOOTPROTO="dhcp"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
ONBOOT="yes"
TYPE="Ethernet"

eth0 on server that resolve.conf is not overwritten:

# Configuration for eth0
DEVICE=eth0
BOOTPROTO=none

# This line ensures that the interface will be brought up during boot.
ONBOOT=yes

# eth0 - This is the main IP address that will be used for most outbound connections.
# The address, netmask and gateway are all necessary.
IPADDR=xxx.xxx.xxx.xxx
NETMASK=255.255.255.0
GATEWAY=xxx.xxx.xxx.xxx
Tue, 07/01/2014 - 09:40
andreychek

Howdy,

One way to correct it would be just to change it to use static IP's. We recommend static IP's when possible.

If you wish to use DHCP, the instructions mentioned in that link are what you're after... except, instead of "127.0.0.1" as your DNS server, you'd replace that with your desired nameserver's IP address.

-Eric

Tue, 07/01/2014 - 09:50
amityweb

Thanks, but to use static IPs I just change the eth0 file to like the second one above? I think thats my issue, I dont actually know what to change. I guess making the eth0 like the second one above would work, as I am sure thats all I did on the servers that do have static.

Tue, 07/01/2014 - 13:02
andreychek

Howdy,

You could either make the change from within Webmin/Virtualmin (by going into Webmin -> Networking -> Network Configuration -> Network Interfaces), or you could use a text editor to change the interface file that you're looking at... the CentOS documentation for that is available here:

http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-networkscrip...

In your case, the configuration that is not overwriting the resolv.conf file is indeed using a static IP.

-Eric

Wed, 07/02/2014 - 10:42
amityweb

Thanks for that, but when I changed it in Network Configuration -> Network Interfaces the server went down :(. Had to login to the Linode console and set it manually like the above eth0 config like another static server and worked OK. So a bit reluctant to do it in Webmin. Will do the others by command. Revisiting Networking Interfaces it looks the same as what I entered. I dont have the eth0 file anymore to show you what it looked like.

Thu, 07/03/2014 - 04:46
amityweb

To confirm, creating the following eth0 config file works fine and fixes this issue for me:

# Configuration for eth0
DEVICE=eth0
BOOTPROTO=none

# This line ensures that the interface will be brought up during boot.
ONBOOT=yes

# eth0 - This is the main IP address that will be used for most outbound connections.
# The address, netmask and gateway are all necessary.
IPADDR=xxx.xxx.xxx.xxx
NETMASK=255.255.255.0
GATEWAY=xxx.xxx.xxx.xxx
Mon, 01/21/2019 - 17:19
haydent

any one wondering about this on openvz, you can edit your resolv.conf and then use chattr +i on it to make it read only even to root, i had to do the same thing to my /etc/hostname

Tue, 01/22/2019 - 14:58 (Reply to #9)
adamjedgar

I have to do this with google cloud instances otherwise i have problems with hostname if i have changed it from that assigned by google cloud.

AJECreative is the home of $5 webhosting, $15/month VPS servers (1cpu,1gb RAM, 25GB storage)
Centos7, Debian9, or Ubuntu18LTS
Available Control Panels = Centos-Webpanel, Cyberpanel, or Virtualmin

https://ajecreative.com.au

Topic locked