As I recently learned of the insane price hike of .hosting Top Level Domains (TLD), I decided it was best to utilise a more sensible priced domain name.
This is a the process I used to migrate all hosting services across.
Step One. – Compile a list of domains
For this I used the list of domains listed in WHM.
To compile the list I used a free WHM plugin Account DNS Check from ndchost.com
Select account domains, parked domains and addon domains, and generated a CSV.
From the CSV I copied out all the domains listed into a text file.
Step Two – Name Server Look up
Since not all domains registered will be using my name servers I need to look them and see whats live.
So I whipped up a little powershell script to report the Name Servers to a CSV so I can sort them.
$domains = @(Get-Content "domains.txt") $domains | resolve-dnsname -Type NS -Server 8.8.8.8 | where {$_.QueryType -eq "NS"} | Select Name,NameHost | Sort Name | Export-Csv NameServers.csv
Step Three – Change the Name Servers
So I’ve already setup the Registry Hosts and DNS records for the new domain, next is to update the records using the generated CSV. Luckily My domain Registrar Allows Bulk Operations and allowed me to select the domains and modify the Name Servers all in one go.
Next I SSH into the webserver and create a backup of the DNS records I’m about to modify.
cp -a /var/named /var/named-backup
Rename the DNS Records in the Zones.
replace 'ns1.<OLD DOMAIN>' 'ns1.<NEW DOMAIN>' -- /var/named/*.db replace 'ns2.<OLD DOMAIN>' 'ns2.<NEW DOMAIN>' -- /var/named/*.db replace 'ns3.<OLD DOMAIN>' 'ns3.<NEW DOMAIN>' -- /var/named/*.db
And restart the DNS Service to take effect.
service named restart
Last step is to Force the Name Server Report in WHM to Run.
/usr/local/cpanel/scripts/updatenameserverips
This will update the Nameserver Record Report in WHM.
Step Four – Rename the Servers
This can be done before or after, it really doesn’t matter.
Just do it before the old domain expires.
After you change the names of the web servers the SSL Certificate will be reissued.
Don’t forget to make sure the services are updated to use the new certificate.
You can check under Manage Service SSL Certificates