Rebuild /etc/localdomains and /etc/remotedomains on cPanel Server
Recently, we encountered internal DNS Failure on one of the servers which created a huge mess on the server which was taken care of by our System Admins. It was fixed within 30 minutes of the time period. Later it was found that DNS Failure removed localdomains and remotedomains configuration from the server as well.
Let me explain you what localdomain and remote domains refers too
Local Domains: Domains which are using Server’s Nameservers and all the services like website and Mail server are working from the cPanel Server itself. All the domains which have local MX i.e. emails are going through the server
Local Domains config can be found in /etc/localdomains
Remote Domains: Domains which are not using Server’s Nameservers and only some of the selected services like the website is working from cPanel Server and Mail Server is working from different Services like Zoho or Google Suite. Such Domains are called remote domains because Nameservers are not managed by the cPanel Server and Mail Server is associated to different Server.
Local Domains config can be found in /etc/remotedomains
If the Local Domains and Remote Domains are not configured correctly, then you will face email problems like “No Such User Exists” and other email delivery failures. If a domain which has a local MX reside on remotedomains, the emails will not be sent/received since EXIM doesn’t know how to handle the emails for this domain.
To fix this, you can use the below command and execute it on the server via SSH as root. This will check the zone files of all the domains and assign them to localdomains and remotedomains.
/scripts/checkalldomainsmxs –yes
This will check the zone files of all the domains and assign them to localdomains and remotedomains and will take some time depending on the number of domains hosted on the cPanel Server.