There are times that your DNS server stops working with little to no explanation just because the named.conf file becomes corrupted.
Fortunately, cPanel has a script in place so we can recreate this file safely.
Here’s how you can fix the corrupted named.conf
Steps
- Login to your server as root and backup/remove with the following one-liner.
mv /etc/named.conf /etc/named.conf.bak
- Initiate the execution of the internal cPanel/WHM script to rebuild the named.conf file.
/usr/local/cpanel/scripts/rebuilddnsconfig
- Once named.conf rebuild is done usually the DNS server will restart, if not you can use the following command.
/etc/init.d/named restart
The WHM/cPanel or cPanel DNS Only server’s named.conf is now rebuilt and operating as normal. Feel free to remove /etc/named.conf.bak once you have verified your DNS rebuild was successful.