How to fix Common Virtualmin DNS Problems

Virtualmin Common DNS Errors occur if it doesn’t have correct glue records at the registrar.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to troubleshoot Virtualmin related issues and configuration.
In this context, we shall look into Virtualmin Control Panel and common DNS errors which affects it.

How to Troubleshoot Virtualmin Common DNS Errors ?

For DNS to work, it must have correct glue records at the registrar, as well as correct records on the Virtualmin system.
Similarly, the slaves must also have correct records. Otherwise, we will experience intermittent resolution failures.

i. Glue Records
To check glue records we can use the whois command:

whois example.com

Look for the "domain servers" or "name servers" section of the output. The results will resolve to the DNS servers.
We must configure Glue records at the name service registrar. Virtualmin and Webmin have no control over records at the registrar. Hence, problems must resolve with whatever interface the registrar provides.

ii. NS Records
The NS records on the Virtualmin server should match those found in the glue records. Failure of which will cause intermittent problems.
We can use the host command to find the NS records for a given zone:

host -t NS example.com

iii. A Records
Address records, or A records, are the basic building block of DNS zones. They map names to IP addresses.
To check an A record, we use the host command:

host example.com

We can also specify the name server used to resolve queries. We need to add the name or IP of the server to the end of the command:

host example.com ns1.example.com

Or, if we are not sure about the nameserver IP address resolving correctly, we can use an IP:

host example.com ip

iv. MX Records
Mail exchanger records, or MX records, provide mail servers the information they need to know to deliver mail for a particular domain.
We can check an MX record with the host command:

host -t MX example.com

[Couldn't set up the records in Virtualmin?  We'd be happy to assist. ]

v. Virtualmin error: isn’t listed in /etc/resolv.conf
This is typical because the IP address assigns by DHCP. While obtaining an IP address, the DNS servers by our DHCP server are used in place of what is currently set up on the server.

We suggest using static IP’s. It will prevent DNS servers from being overwritten. It will also remove the chance of the server obtaining the wrong IP address.
However, to continue using DHCP, we need to configure the system to not use the DHCP server’s DNS settings.
To solve that, log into the server as root, and create/edit the file /etc/dhclient.conf.

Then we add this line to that file:

prepend domain-name-servers;

The next time we obtain the IP address via DHCP, it should use the local server rather than what the DHCP server provides.
If we are certain that the server does not obtain its IP address via DHCP – the issue can occur when using a VPS. Where the VPS provider automatically overwrites the /etc/resolv.conf file at each reboot.

If that is the case, to get around this error, go to System Settings -> Virtualmin Configuration -> Advanced Settings, set ‘Check resolv.conf for this system’ to ‘No’.
This is a non-ideal setting and will cause DNS lookups on the server to be slower.
Unfortunately, some providers do not give another option – and in that case, this setting should work.

If the provider is overwriting /etc/resolv.conf on each bootup, another option is to make that file immutable. It prevents even root from changing it.

To do that we can run ‘chattr +i /etc/resolv.conf’. Or we can add the following to the end of /etc/rc.local file:

echo nameserver >> /etc/resolv.conf

vi. How to setup nameservers for a server?
In order to use the 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.

a. First, we have to go to the domain name registrar for example.com and register the server as a nameserver. It is usually as simple as inputting two or more names, and the IP addresses associated with them.
b. After registering the nameservers at the domain name registrar we have to log into Virtualmin.
c. Select the “example.com” domain, click Server Configuration -> DNS Records, and create a new “A – IPv4 Address” record for ns1.example.com and ns2.example.com.
d. Lastly, we have to tell Virtualmin to use the nameservers when it generates NS records for new Virtual Servers.
To do that, go to System Settings -> Server Templates -> Default Settings -> BIND DNS Domain, and set ‘Master DNS server hostname’ as well as ‘Additional manually configured nameservers’.

Failed to setup nameservers in Virtualmin? We are available 24*7. ]


This article will guide you on how to tackle #Virtualmin Common #DNS #Errors which occurs when glue #records at the #registrar are not correct. So to fix this, you should use the correct records on the Virtualmin system. You should also ensure that the DNS server #IP addresses are correct.