KNOWNHOST WIKI

User Tools

Site Tools


control-panels:cpanel-whm:how-do-i-configure-my-dns-for-hostname-changes-in-cpanel

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
control-panels:cpanel-whm:how-do-i-configure-my-dns-for-hostname-changes-in-cpanel [2019/10/11 06:39]
Karson N. [Changing the Hostname]
control-panels:cpanel-whm:how-do-i-configure-my-dns-for-hostname-changes-in-cpanel [2020/06/02 08:21] (current)
Karson N.
Line 1: Line 1:
 ====== Updating Your Hostname and Default Nameservers ====== ====== Updating Your Hostname and Default Nameservers ======
 +\\
  
 Occasionally, you may want to change your server's main domain that you initially set up for use as the hostname and the default nameservers. Perhaps you have rebranded, accidentally allowed the old domain to expire, or some other reason has caused you to want to change your main domain. There are a few things to consider when doing this.  Occasionally, you may want to change your server's main domain that you initially set up for use as the hostname and the default nameservers. Perhaps you have rebranded, accidentally allowed the old domain to expire, or some other reason has caused you to want to change your main domain. There are a few things to consider when doing this. 
Line 10: Line 10:
 Often times it occurs that a domain expires and clients believe this to be a quick fix, though this is not the case. The issue is that you must create new nameservers, which may take 24-48 hours to propagate (though this usually occurs in 2-6 hours), and then one by one, you must log into your registrar account for each domain and update their nameservers to the new nameservers. Both, the creation of the new nameservers and the assignment of these new nameservers must be done at the server in addition to the registrar. Luckily, Knownhost can help with the server aspect of this. We can either do this for you, or you can use the instructions below to do it yourself.  Often times it occurs that a domain expires and clients believe this to be a quick fix, though this is not the case. The issue is that you must create new nameservers, which may take 24-48 hours to propagate (though this usually occurs in 2-6 hours), and then one by one, you must log into your registrar account for each domain and update their nameservers to the new nameservers. Both, the creation of the new nameservers and the assignment of these new nameservers must be done at the server in addition to the registrar. Luckily, Knownhost can help with the server aspect of this. We can either do this for you, or you can use the instructions below to do it yourself. 
  
 +\\
 ===== Creating the New Nameservers and the Hostname A Record at the Server ===== ===== Creating the New Nameservers and the Hostname A Record at the Server =====
- 
  
 To create the GLUE records in the server (which is just A records for the ns1 and ns2 subdomains), log into WHM as the 'root' user using the root user's password and navigate as follows: To create the GLUE records in the server (which is just A records for the ns1 and ns2 subdomains), log into WHM as the 'root' user using the root user's password and navigate as follows:
- +<code> 
-     Home »DNS Functions »Edit DNS Zone +  Home »DNS Functions »Edit DNS Zone  
 +</code>
  
 You should see the following with a list of domains to choose from.  You should see the following with a list of domains to choose from. 
Line 34: Line 35:
  
 You can leave 14400 IN set as is.  You can leave 14400 IN set as is. 
- 
  
 {{:control-panels:cpanel-whm:addns1ns2hostrecords.png?nolink&900|}} {{:control-panels:cpanel-whm:addns1ns2hostrecords.png?nolink&900|}}
  
- +**Note:** the creation of the A record for the new hostname because it is important to have a hostname that resolves and has a corresponding PTR record otherwise you may have mail deliverability issues. Now save the zone file and ensure that it saves without error. The interface will show that the zone file is being reloaded and that the settings have been updated:
-Note the creation of the A record for the new hostname because it is important to have a hostname that resolves and has a corresponding PTR record otherwise you may have mail deliverability issues. Now save the zone file and ensure that it saves without error. The interface will show that the zone file is being reloaded and that the settings have been updated:+
  
 {{:control-panels:cpanel-whm:reloadedzonefile.png?nolink&1200|}} {{:control-panels:cpanel-whm:reloadedzonefile.png?nolink&1200|}}
Line 47: Line 46:
 GLUE Records or Private Nameserver Registration is handled at the Domain Registrar; here are some quick links for popular domain registrars. GLUE Records or Private Nameserver Registration is handled at the Domain Registrar; here are some quick links for popular domain registrars.
  
-  * [[https://www.godaddy.com/help/add-my-own-host-names-as-nameservers-12320 | GoDaddy Private Nameservers Registration]] +  * ((https://www.godaddy.com/help/add-my-own-host-names-as-nameservers-12320))[[https://www.godaddy.com/help/add-my-own-host-names-as-nameservers-12320|GoDaddy Private Nameservers Registration]] 
-  * [[https://www.namecheap.com/support/knowledgebase/article.aspx/768/10/how-do-i-register-personal-nameservers-for-my-domain | Namecheap Private Nameserver Registration]] +  * ((https://www.namecheap.com/support/knowledgebase/article.aspx/768/10/how-do-i-register-personal-nameservers-for-my-domain))[[https://www.namecheap.com/support/knowledgebase/article.aspx/768/10/how-do-i-register-personal-nameservers-for-my-domain|Namecheap Private Nameserver Registration]] 
-  * [[https://www.name.com/support/articles/205934457-Registering-custom-nameservers | Name.com Private Nameserver Registration]] +  * ((https://www.name.com/support/articles/205934457-Registering-custom-nameservers))[[https://www.name.com/support/articles/205934457-Registering-custom-nameservers|Name.com Private Nameserver Registration]] 
-  * [[http://www.networksolutions.com/support/how-to-register-a-dns-server-or-edit-a-dns-server-i-ve-already-registered/ | Network Solutions Private Nameserver Registration]]+  * ((http://www.networksolutions.com/support/how-to-register-a-dns-server-or-edit-a-dns-server-i-ve-already-registered/))[[http://www.networksolutions.com/support/how-to-register-a-dns-server-or-edit-a-dns-server-i-ve-already-registered/|Network Solutions Private Nameserver Registration]]
  
 We have an article that expands on this process: [[dns:creating-nameservers|]] We have an article that expands on this process: [[dns:creating-nameservers|]]
  
- +\\
 ===== Assigning the New Nameservers ===== ===== Assigning the New Nameservers =====
  
Line 61: Line 59:
  
 To make this process quicker, I usually do this in bulk. I first make a backup of /var/named using this command: To make this process quicker, I usually do this in bulk. I first make a backup of /var/named using this command:
 +<code>
   cp -a /var/named /var/named.bak   cp -a /var/named /var/named.bak
 +</code>
  
 The change into the directory containing the zone files to edit: The change into the directory containing the zone files to edit:
 +<code>
   cd /var/named   cd /var/named
 +</code>
  
 You can now use sed to replace all old ns1 nameservers with the new ns1 nameservers, and then all old ns2 nameservers with the new ns2 nameservers: You can now use sed to replace all old ns1 nameservers with the new ns1 nameservers, and then all old ns2 nameservers with the new ns2 nameservers:
 +<code>
   sed 's/ns1.olddomain./ns1.newdomain./g' *.db   sed 's/ns1.olddomain./ns1.newdomain./g' *.db
   sed 's/ns2.olddomain./ns2.newdomain./g' *.db   sed 's/ns2.olddomain./ns2.newdomain./g' *.db
 +</code>
  
 **NOTE:** Please note the period at the end of each nameserver in these commands! If you omit this period, then the panel will think you are adding a subdomain and automatically append the domain name to the end of the record, which is **NOT** what we want. If you omit these periods at the end of each nameserver in the command, you will need to restore the backup you made and start over! **NOTE:** Please note the period at the end of each nameserver in these commands! If you omit this period, then the panel will think you are adding a subdomain and automatically append the domain name to the end of the record, which is **NOT** what we want. If you omit these periods at the end of each nameserver in the command, you will need to restore the backup you made and start over!
  
 If you will be updating the hostname, it should be changed in these files as well (Again, take care to include these periods at the end of the hostnames as they are incredibly important!): If you will be updating the hostname, it should be changed in these files as well (Again, take care to include these periods at the end of the hostnames as they are incredibly important!):
 +<code>
   sed 's/host.olddomain./host.newdomain./g' *.db   sed 's/host.olddomain./host.newdomain./g' *.db
 +</code>
  
 I then restarted named to force it to reload all zones: I then restarted named to force it to reload all zones:
 +<code>
   /scripts/restartsrv_named   /scripts/restartsrv_named
 +</code>
  
 +\\
 ===== Update the Default Nameservers  ===== ===== Update the Default Nameservers  =====
  
 The default nameservers are those that are used for new accounts by default upon creation. These are currently set to  ns1.olddomain. and ns2.olddomain. These can be updated in WHM here: The default nameservers are those that are used for new accounts by default upon creation. These are currently set to  ns1.olddomain. and ns2.olddomain. These can be updated in WHM here:
 +<code>
 +  Home »Server Configuration »Basic WebHost Manager® Setup 
 +</code>
  
-  Home »Server Configuration »Basic WebHost Manager® Setup  
-   
 Scroll to the bottom of the page and you will see the default nameserver settings. Replace the old nameservers with the new nameservers.  Scroll to the bottom of the page and you will see the default nameserver settings. Replace the old nameservers with the new nameservers. 
  
Line 94: Line 99:
  
 You will also need to make sure that the correct nameserver records are showing here. Occasionally, if DNS changes have been made regarding the nameserver A records, the old IPs may show for a day or so until the registrar updates their records and the panel updates following this. You can force the panel to update using the following script: You will also need to make sure that the correct nameserver records are showing here. Occasionally, if DNS changes have been made regarding the nameserver A records, the old IPs may show for a day or so until the registrar updates their records and the panel updates following this. You can force the panel to update using the following script:
 +<code>
   /scripts/updatenameserverips   /scripts/updatenameserverips
 +</code>
  
 To update the nameserver A records (aka glue records), you will need to click "Configure Address Records" next to the nameserver.  To update the nameserver A records (aka glue records), you will need to click "Configure Address Records" next to the nameserver. 
Line 108: Line 114:
 You will need to repeat this process for the other nameserver, and then finally, click "Save Changes" at the bottom of WHM's "Basic WebHost Manager® Setup". You will need to repeat this process for the other nameserver, and then finally, click "Save Changes" at the bottom of WHM's "Basic WebHost Manager® Setup".
  
 +\\
 ===== Changing the Hostname ===== ===== Changing the Hostname =====
  
Line 115: Line 122:
  
 The command must be run via SSH as the root user and is as follows: The command must be run via SSH as the root user and is as follows:
 +<code>
   /usr/local/cpanel/cpkeyclt   /usr/local/cpanel/cpkeyclt
 +</code>
  
 Changing the hostname in WHM can be done here: Changing the hostname in WHM can be done here:
 +<code>
   Home »Networking Setup »Change Hostname    Home »Networking Setup »Change Hostname 
 +</code>
  
 {{:control-panels:cpanel-whm:cpanel-change-hostname.png?nolink&1000|}} {{:control-panels:cpanel-whm:cpanel-change-hostname.png?nolink&1000|}}
Line 126: Line 135:
 **NOTE:** The hostname must still be changed on our end so that we may also update the PTR record!  **NOTE:** The hostname must still be changed on our end so that we may also update the PTR record! 
  
 +\\
 ===== Remove Old DNS Zone Files ===== ===== Remove Old DNS Zone Files =====
  
- +Lastly, when you "Edit DNS Zone" in WHM, you may notice that the DNS Zone files for the old nameservers and hostname still exist. These can be removed in WHM 
-Lastly, when you "Edit DNS Zone" in WHM, you may notice that the DNS Zone files for the old nameservers and hostname still exist. These can be removed in WHM  +<code>
   Home »DNS Functions »Delete a DNS Zone    Home »DNS Functions »Delete a DNS Zone 
 +</code>
  
 {{:control-panels:cpanel-whm:remove-old-nameservers.png?nolink&600|}} {{:control-panels:cpanel-whm:remove-old-nameservers.png?nolink&600|}}
Line 139: Line 149:
 The only reason that you may not want to immediately remove these zone files would be if your old domain was still active, and thus the old nameservers and old hostname. Keeping these active until the new domain, nameservers, and hostname propagated could potentially prevent much of any unnecessary downtime.  The only reason that you may not want to immediately remove these zone files would be if your old domain was still active, and thus the old nameservers and old hostname. Keeping these active until the new domain, nameservers, and hostname propagated could potentially prevent much of any unnecessary downtime. 
  
 +\\
 ===== Reminder: You Must Still Make the Appropriate Changes At the Registrar! ===== ===== Reminder: You Must Still Make the Appropriate Changes At the Registrar! =====
  
control-panels/cpanel-whm/how-do-i-configure-my-dns-for-hostname-changes-in-cpanel.1570793982.txt.gz · Last modified: 2019/10/11 06:39 by Karson N.