Search Our Database
How to create new DNS zone file in Plesk
Introduction
If you encounter issues with the DNS zone file for your domain in Plesk, such as the DNS records not functioning, missing zone files in the Plesk DNS folder, or problems persisting even after restoring to default settings, it may be necessary to recreate the DNS zone. This guide provides step-by-step instructions for identifying and removing invalid DNS records from the Plesk database and recreating the DNS zone to resolve these issues.
Prerequisites
- Administrative access to the Plesk server.
- Basic knowledge of command-line interface (CLI) and MySQL.
Step-by-step Guide
Step 1: Search for Invalid DNS Records in the Plesk Database
First, check for any invalid DNS records in the Plesk database. These records might be causing conflicts or issues with the DNS zone.
- Open the Command Prompt as an administrator.
- Navigate to the Plesk bin directory:
cd C:\Program Files (x86)\Parallels\Plesk\admin\bin
- Run the following command to search for invalid DNS records:
"%plesk_bin%\dbclient" --direct-sql --sql="SELECT id, name FROM dns_zone WHERE id NOT IN (SELECT dns_zone_id FROM domains) AND id NOT IN (SELECT dns_zone_id FROM domain_aliases) AND id <> (SELECT val FROM misc WHERE param = 'default_dns_zone_id')"
This command identifies DNS zones that are not associated with any domain or domain alias and are not the default DNS zone.
Step 2: Remove Invalid DNS Records
- Navigate to the MySQL bin directory in Plesk:
cd %plesk_dir%\Mysql\bin
Step 3: Log In to Plesk MySQL
- Log in to the Plesk MySQL database using the following command:
mysql -uadmin -p -P 8306 psa
Enter the Plesk admin password when prompted.
Step 4: Delete the Invalid DNS Records
- To remove the invalid DNS records identified earlier, run the following SQL command:
DELETE FROM dns_zone WHERE id NOT IN (SELECT dns_zone_id FROM domains) AND id NOT IN (SELECT dns_zone_id FROM domain_aliases) AND id <> (SELECT val FROM misc WHERE param = 'default_dns_zone_id');
- If you know the specific id of the invalid DNS record, you can delete it using the following command, replacing 101 with the actual id:
DELETE FROM dns_zone WHERE id=101;
Step 5: Exit MySQL
- Exit the MySQL shell by typing:
exit;
Step 6: Update DNS Records in Plesk
- Navigate back to the Plesk admin bin directory:
cd C:\Program Files (x86)\Parallels\Plesk\admin\bin
- Run the following command to update all DNS records in Plesk:
DNSMng.exe Update *
This command refreshes the DNS zone configuration for all domains.
Step 7: Restore DNS Records to Default Settings in Plesk
- Log in to the Plesk control panel.
- Go to Domains and select the domain for which you need to restore DNS settings.
- Navigate to DNS Settings and click on Restore Defaults.
This will recreate the DNS zone file with the default settings for the selected domain, ensuring that the DNS records are properly configured.
Conclusion
By following these steps, you have successfully identified and removed invalid DNS records from the Plesk database and recreated the DNS zone file. This should resolve any issues related to missing or malfunctioning DNS records in Plesk. Regularly checking for and removing invalid DNS entries can help maintain a healthy DNS configuration and prevent potential issues.
For further assistance or if you encounter any issues, please contact our support team at support@ipserverone.com. We’re here to help you ensure your server and DNS configurations are optimized and functioning correctly.