Virtualmin is configured to setup DNS zones, but this system is not setup to use itself as a DNS server.

I did do that as root.

Howdy,

What output do you receive when typing the following commands:

id ls -ld /etc/sysconfig/ ls -ld /etc/sysconfig/networking/ ls -la /etc/sysconfig/networking/devices/
[root@ns1 ~]# id uid=0(root) gid=0(root) groups=0(root),501(vboxusers)

[root@ns1 ~]# ls -ld /etc/sysconfig/
drwxr-xr-x. 9 root root 4096 Jan 9 07:18 /etc/sysconfig/

[root@ns1 ~]# ls -ld /etc/sysconfig/networking/
drwxr-xr-x. 4 root root 4096 Nov 22 13:20 /etc/sysconfig/networking/

[root@ns1 ~]# ls -la /etc/sysconfig/networking/devices/
total 16
drwxr-xr-x. 2 root root 4096 Jan 5 20:23 .
drwxr-xr-x. 4 root root 4096 Nov 22 13:20 

-rw-r–r-- 2 root root 364 Jan 5 20:04 ifcfg-eth0
-rw-r–r-- 2 root root 224 Jan 5 20:23 ifcfg-eth0:1

Howdy,

Hmm, so I’m interested in seeing the contents of the file “ifcfg-eth0”.

According to the permissions of that file, and the various directories leading up to it – it shouldn’t even require root to root it, any user should be able to see it’s contents. So I’m not sure why you received that error


Let’s try this, perhaps rather than using a wildcard in that command to view it, try running this:

cat /etc/sysconfig/networking/devices/ifcfg-eth0

reinstalled virtualmin on a new VPS, and im having this problem again. Every restart, i have to re-enter the dns 127.0.0.1. Same error as the 1st post above.

Here are responses to all the suggested commands above:

[root@orby ~]# /etc/dhclient-eth0.conf
-bash: /etc/dhclient-eth0.conf: No such file or directory
[root@orby ~]# /etc/sysconfig/network-scripts/ifcfg-eth0
-bash: /etc/sysconfig/network-scripts/ifcfg-eth0: No such file or directory
[root@orby ~]# /etc/resolv.conf
-bash: /etc/resolv.conf: Permission denied
[root@orby ~]# /etc/sysconfig/networking/devices/ifcfg-eth*
-bash: /etc/sysconfig/networking/devices/ifcfg-eth*: No such file or directory
[root@orby ~]# id
uid=0(root) gid=0(root) groups=0(root)
[root@orby ~]# ls -ld /etc/sysconfig/
drwxr-xr-x 9 root root 4096 Jul 2 18:19 /etc/sysconfig/
[root@orby ~]# ls -ld /etc/sysconfig/networking/
drwxr-xr-x 4 root root 4096 Feb 20 05:44 /etc/sysconfig/networking/
[root@orby ~]# ls -la /etc/sysconfig/networking/devices/
total 8
drwxr-xr-x 2 root root 4096 Feb 20 05:44 .
drwxr-xr-x 4 root root 4096 Feb 20 05:44 

[root@orby ~]# cat /etc/sysconfig/networking/devices/ifcfg-eth0
cat: /etc/sysconfig/networking/devices/ifcfg-eth0: No such file or directory

Any more suggestions?

The server is a VPS hosted by VMBox.co
Virtualization Type (OpenVZ)
Operating System centos-6.4-amd64-minimal.tar.gz

Any fix for this yet?

I manually added “nameserver 127.0.0.1” to /etc/resolv.conf and rebooted. When the machine woke up, it was already gone


Thanks

1 Like

Same problem for me on a fresh install of Ubuntu 14.04.

This worked for me:- System Settings / Virtualmin Configuration / Advanced Options / Check resolv.conf for this system ? - Set it to No

I also disabled mailman to fix another issue.

This issue most commonly occurs when using DHCP, which can cause the DNS servers to be overwritten each time the DHCP lease is renewed.

There’s details on that issue here in the section “Received Virtualmin error that 127.0.0.1 isn’t listed in /etc/resolv.conf”:

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

1 Like

Ubuntu 14 has overly complicated the network interface setup stuff, and its the issue with not being able to add 127.0.0.1 using the network interface in webmin.

You can even manually add 127.0.0.1 in the resolver.conf and it will happily break it.
BUT! a bit of digging resulted in this:

Find /etc/network/interfaces
drop down to the bottom of that file and add this line (using the correct first number for your network)
dns-nameservers 192.168.1.1 127.0.0.1

Immediately Webmin will see the proper info, and the “re-check configuration” script will run fine. And we will not have created something too strange that we can’t figure it out again later on.

tks greentrees!

The file you need to edit is: ifcfg-venet0 instead of the eth0 file. Add the DNS server in that file will fix your issue. I used VolumeDrive before and did the same thing.

In CentOS 7, the file will be along the lines of ‘/etc/dhcp3/dhclient.conf’.
Ensure you carry out a restart of the service (service named restart) or reboot the system.

Just add the line as Eric stated.

prepend domain-name-servers 127.0.0.1;

Thanks.

seems this is quite an old post, but actually you’ll more than likely want to go into the /etc/network/interfaces.d directory and edit whatever config file is there because chances are it is set to use dhcp so for example mine would look like this now after making the changes:

# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5).

The loopback network interface

auto lo
iface lo inet loopback

The primary network interface

auto eth0
iface eth0 inet static
address 192.168.2.251
netmask 255.255.255.0
network 192.168.2.251
broadcast 192.168.2.255
gateway 192.168.2.254
dns-nameservers 127.0.0.1 192.168.1.200 192.168.1.225 8.8.8.8

We’re with Digital Ocean on Ubunto LTS 16.04.

The FAQ posts here https://www.virtualmin.com/documentation/dns/faq says not to change the resolve.conf file but it is the only thing that works.
Is there any update on this ?
Thanks

When I updated the DNS list it did not seem to hold in the list. It seems I had to do 3 things that finally made it work but I do not know which one.

I added the code as described above to dhclient-eth0.conf file and then /etc/dhclient.conf file. (created them both using nano).
Then I followed Greentrees above: This worked for me:- System Settings / Virtualmin Configuration / Advanced Options / Check resolv.conf for this system ? - Set it to No

(even though the faq on Virtualmin says " This is a non-ideal setting, and will cause DNS lookups on your server to be slower than they need to be. Since it causes all DNS lookups to go through your provider, it also means updates to your servers DNS all have to wait for your ISP’s DNS cache to clear before you will see those updates. Unfortunately, some providers don’t give you another option – and in that case, this setting should get you up and running.")

I guess I’ll have to remove one by one and see which is the cure.

You can go with more spartan way but it works and only affect resolv.conf.

So here is what you need to do:

  1. Create new folder at / or use /root. Any of this two options should work.
  2. Create new file and name it resolv.conf. Once done edit that file with data what you want/need. Save and close.
  3. Open the file rc.local and add to the bottom “/bin/cp /root/resolv/resolv.conf /etc/resolv.conf”. In case you used some other folder to store resolv.conf change “/root/resolv/resolv.conf” to match your path.
  4. Reboot your server and from now on you wil always have resolv.conf file with needed lines.

P.S. This was tested on Centos 6 and 7, not sure for other OS. Make backup before any change and with this solution no need to edit any other file, e.g. free to revert all changes back to original state.

Thanks
I don’t know what you mean by ‘spartan way’.
I looked over your steps, might be too advanced for me at this stage - really new to this.
I hope there isn’t any danger of the way I did it. Also I’m running Ubuntu.

OK let me see if i got right, you have a problem with rc.local because it gets overwritten during server reboot? If this is correct what changes you need to have in rc.local? If is something else could you clarify what exactly is your problem. I’m not using Ubuntu but many solutions from Centos works in Ubuntu, so maybe i could help.

The FAQ is talking about a specific situation, where DHCP is resetting the resolver each time the network is changed or the system is rebooted. resolv.conf is the usual way to alter the resolver configuration (and what Virtualmin needs to work), it is only something you don’t change, if you’re system is getting its IP and DNS resolver information from DHCP. That is not usually the case with dedicated hosting servers (and by “dedicated hosting server”, in this context, I mean any server, whether virtual or physical, that is dedicated to the job of hosting websites and has a fixed public IP address).

If changing resolv.conf has sorted things out, and you’re able to use the preview function in Virtualmin, you’ve got it right! (The only concern is if it stops working again after a reboot or network change.)

1 Like

Ok thanks Joe.
It is working now and once I did a refresh of the system I haven’t seen the configuration refresh button since. I will monitor, thanks.