Virtualmin error: 127.0.0.1 isn't listed in /etc/resolv.conf
This is typically because your IP address is being dynamically assigned by DHCP. While obtaining an IP address, the DNS servers provided by your DHCP server are used in place of what's currently setup on your server.
For a server, we'd suggest using static IP's where possible. That would prevent your DNS servers from being overwritten, as well as removing any chance of your server obtaining the wrong IP address.
However, to continue using DHCP, you'd need to configure your system to not use your DHCP server's DNS settings.
To solve that, log into your server as root, and create/edit the file /etc/dhclient.conf
.
Then add this line to that file:
prepend domain-name-servers 127.0.0.1;
The next time you obtain your IP address via DHCP, it should use your local server rather than what your DHCP server provides.
If you're certain -- absolutely certain -- that your server isn't obtaining it's IP address via DHCP -- the issue you're seeing can occur when using a VPS, where your VPS provider automatically overwrites your /etc/resolv.conf file each reboot.
If that's the case, you can get around this error by going into 'System Settings' -> 'Virtualmin Configuration' -> 'Advanced Settings', and set 'Check resolv.conf for this system' to 'No'.
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.
If your provider is overwriting your /etc/resolv.conf on each bootup, another option is to make that file immutable, which prevents even root from changing it. You can do that by running 'chattr +i /etc/resolv.conf'. Or you could add something the following to the end of your /etc/rc.local file:
echo nameserver 127.0.0.1 >> /etc/resolv.conf
How do I setup nameservers for my server?
In order to use your Virtualmin server as a DNS server, it needs to be setup so that names like ns1.example.com and ns2.example.com can be input as a domain's nameservers.
For that to work -- you first have to go to the domain name registrar for example.com, and register your server as a nameserver. It's usually as simple as inputting two or more names (such as ns1.example.com and ns2.example.com), and the IP addresses that are associated with them.
How to accomplish that is different for every domain name registrar. Namecheap is a popular registrar, and performing that task with Namecheap is documented here: http://www.namecheap.com/support/knowledgebase/article.aspx/768/10/how-d...
GoDaddy is also popular, and they provide instructions for accomplishing that here: http://help.godaddy.com/article/668
After registering your nameservers at your domain name registrar -- you'll want to log into Virtualmin, select your "example.com" domain, click Server Configuration -> DNS Records, and create a new "A - IPv4 Address" record for ns1.example.com and ns2.example.com.
Lastly, you'll want to tell Virtualmin to use your nameservers when it generates NS records for new Virtual Servers that it creates. You can do that by going into 'System Settings' -> 'Server Templates' -> 'Default Settings' -> 'BIND DNS Domain', and set 'Master DNS server hostname' as well as 'Additional manually configured nameservers'.