can't change DNS to add 127.0.0.1 to the list of DNS servers

After fighting Centos7 for over a week I created a new cloud server running Ubuntu 14.04.3 . I immediately installed Virtualmin version 4.18.gpl and post congifured it. All looked really promising till the configuration check where I got -"Virtualmin is configured to setup DNS zones, but this system is not setup to use itself as a DNS server. Either add 127.0.0.1 to the list of DNS servers, or turn off the BIND feature on the module config page."

I tried many time to add 127.0.0.1 but the error remains. On the Hostname and DNS Client screen I can add 127.0.0.1 to the DNS list but it isn't saved.

I can alter and save hostname and resolution order but not DNS list or "search" domains.

I can change and save these settings on the centos7 server Virtualmin but not the Ubuntu version.

Turning off Bind didn't seem to work either.

I guess some permissions are wrong somewhere.

Status: 
Active

Comments

You are working in a VM for sure. If you set up the IP address to static, having direct access to Internet, you won't get this problem. Servers with dhcp interface configuration encounter this issue because autoconfiguration means to change /etc/resolv.conf file content. Even you add some nameservers into this file, they will be deleted.

You can edit /etc/resolv.conf having these lines:

nameserver 8.8.8.8 # Google NS1

nameserver 8.8.4.4 # Google NS2

nameserver 127.0.0.1 #If you plan using BIND on this computer for your virtual servers

To keep content of the file you have to protect it. I did not try this yet because I don't have this issue but you can do as follows:

  • change permission for user not writing into this file (chmod u-w /etc/resolv.conf)
  • if first option is not working use chattr command (chattar +i /etc/resolv.conf to immutable the file, to revert use -i).

Watch /var/log/syslog after you changed /etc/resolv.conf. If these files don't have the same content

/var/spool/postfix/etc/resolv.conf /etc/resolv.conf

you will get a warning. Try keeping both with the same content.

Thanks, That's getting close. Adding 127.0.0.1 does get me past that error. However chmod u-w /etc/resolv.conf didn't stop the file being over-written. Chattr says - chattr: Operation not supported while reading flags on /etc/resolv.conf More /etc/resolv.conf is a link to /run/resolvconf/resolv.conf Tried to use chattr there and got chattr: Inappropriate ioctl for device while reading flags on /run/resolvconf/resolv.conf

Howdy -- that issue is usually the result of an IP address being obtained via DHCP, which would indeed overwrite the DNS servers. I posted some thoughts on that issue in your Forum post here:

https://www.virtualmin.com/node/38101