How to Apply Server-Wide DNS Template After Domain Migration or Upgrade in Plesk Make it Rain Paper

  • DNS, DNS Configuration, DNS Management, Domain Transfer
  • 0

Pre-requirements

  • Administrator access to the Plesk control panel (Linux or Windows).
  • For command-line operations: Root or sudo access to the Linux server.
  • Familiarity with basic DNS settings and zone management in Plesk.

Introduction

When migrating domains from cPanel or performing upgrades/restorations in Plesk, you may notice that the "Apply DNS Template" button does not update DNS zones as expected. Additionally, the "Switch DNS" button may be missing during migration. This guide outlines how to resolve these issues and ensure your DNS templates are correctly applied after domain migrations or upgrades.

Issue: Server-Wide DNS Template Not Applied

After performing a migration, upgrade, or restoration, the DNS zone for a domain may not automatically apply the server-wide DNS template, even when clicking the Apply DNS Template button under the domain's DNS settings. This behavior is expected because Plesk treats migrated or restored DNS zones as user-modified.

Solution: Applying DNS Template Changes

Steps to Apply DNS Template Changes

  1. Log into your Plesk control panel as an administrator.
  2. Navigate to Tools & Settings > DNS Zone Template.
  3. Click on Apply DNS Template Changes to force the update for all DNS zones.

Gotchas to Avoid

  • Ensure that you understand the implications of applying the DNS template across all zones, as it may overwrite custom DNS settings.
  • It is recommended to backup your DNS zones before applying global changes to prevent accidental misconfigurations.

Issue: Missing "Switch DNS" Button While Migrating from cPanel

If you are migrating domains from cPanel to Plesk, you may notice the "Switch DNS" button is not available under the List of Subscriptions tab (advanced mode). This is expected behavior, as the "Switch DNS" option is only available when migrating from Plesk to Plesk.

Solution: Adjusting DNS Settings Manually via CLI

If you need to adjust DNS records for multiple domains after migration, you can do so using Plesk's CLI utility. The following instructions outline how to remove and add DNS records across multiple domains using a text file and bash script.

Steps to Adjust DNS Records for Multiple Domains via CLI

Step 1: Create a List of Domains

    1. Log into your server via SSH.
    2. To create a text file containing the list of all domains, use the following command:
plesk bin site --list > domains.txt
  1. Alternatively, manually create a file with the required domains, each on a separate line.

Step 2: Remove Unwanted DNS Records

    1. To remove an unwanted NS record across all domains listed in domains.txt, use the following command:
for i in `cat domains.txt`; do plesk bin dns -d $i -ns "" -nameserver "ns1.unwanted.server"; done
  1. This command iterates over each domain and removes the specified NS record.

Step 3: Add Required DNS Records

    1. To add a new NS record for all domains, use the following command:
for i in `cat domains.txt`; do plesk bin dns -a $i -ns "" -nameserver "ns1.required.server"; done
  1. This command adds the desired NS record to all listed domains.

Gotchas to Avoid

  • Always verify the list of domains in domains.txt to ensure no unwanted domains are modified.
  • Test the DNS changes on a single domain before applying them globally to prevent unexpected issues.
  • Ensure that any DNS record modifications are properly propagated by using tools like dig or nslookup to verify DNS status after making changes.

Linux Commands for DNS Zone Management

    • List all domains on the server:
plesk bin site --list > domains.txt
    • Remove a nameserver (NS) record across multiple domains:
for i in `cat domains.txt`; do plesk bin dns -d $i -ns "" -nameserver "ns1.unwanted.server"; done
    • Add a nameserver (NS) record across multiple domains:
for i in `cat domains.txt`; do plesk bin dns -a $i -ns "" -nameserver "ns1.required.server"; done
    • Check the status of DNS zones:
plesk bin dns --info example.com

When migrating domains or restoring from backups in Plesk, DNS management can become a challenge, especially when the "Apply DNS Template" button doesn’t behave as expected or when the "Switch DNS" button is missing. By using the CLI utility, you can efficiently manage DNS records across multiple domains, ensuring the correct server-wide DNS template is applied.

For further reading on DNS management, visit our Knowledge Base.


Did this answer help?

« Back