The first week’s topic is the dreaded Hostname A Record Email clients get and panic about because of cPanel’s lovely alarmist email. This issue is really simple typically but does have a 3 part resolve and all 3 must be perfect for the resolve to function.
Our example client is a VPS client (vps.clientserver.com) and he was receiving the invalid IP Hostname Email. Technician A saw this and did fix one of the major 3 issues; an A record for the hostname. Ensuring that the server has the proper A Record set up can be done one of two ways:
1) GUI Route – Go into WHM and use the “Add A Record for Hostname” tool. Quick and Easy
2) Console Route – nano /var/named/HOSTNAME.db -OR- DOMAIN.db (if the domain for the hostname exists on the server) and ensure that the A record exists and is pointing to the main IP correctly.
The second step of this resolve is checking the /etc/hosts file. Below was the /etc/hosts file on this server before I fixed it:
0.0.0.0 vps.clientserver.com vps vps.otherserver.com # Auto-generated hostname. Please do not remove this comment. 123.456.789.123 vps 127.0.0.1 localhost
As you can see, the 0.0.0.0 entry is entirely incorrect and needs to be removed and the actual IP host is wrong too, only containing the short hostname and not the long. Below is the corrected /etc/hosts file:
# Auto-generated hostname. Please do not remove this comment. 123.456.789.123 vps.clientserver.com vps 127.0.0.1 localhost.localdomain localhost
This is how pretty much all /etc/hosts files should look (obviously customized for the server) and should not vary too much from this format. The localhost.localdomain is just a preference thing for me and not absolutely necessary.
The final step to this 3 step repair is to check the /etc/resolv.conf file which tells the server what nameservers to use to resolve domains from the server (not domains on the server note). Below was the /etc/resolv.conf before repair:
The search localhost is not really needed and can even cause issues that I have seen in the past. Below is the fixed /etc/resolv.conf:
nameserver 126.96.36.199 nameserver 188.8.131.52
This contains 2 working nameservers and will help the server resolve domains without issue.
Once all of these fixes are made, all you need to do is rndc flush, rndc reload, and restart named for the changes to be committed. After that, the client should no longer see cPanel’s alarmist message about the A record being bad.
And that’s all for this week. Stay tuned for another possible episode next week in Common Issues and their Solutions!