Change WHM Nameserver IPs

4 years, 3 months ago CentOS, DevOps

If you are using a VPS and you have cPanel installed on it, then you may need to update or change WHM Nameserver IPs for various reasons. If you simply try to change it, you will find that they are not changing accurately. For this, you have to do it manually I mean you may do it by command.

Login to your server via SSH, you need to log in as root. Now enter this command:

vi /etc/nameserverips

You will see something just like below:

xxx.xxx.xx.xxx=ns1.domain.com
xxx.xxx.xx.xxx=ns2.domain.com

Now press 'A' button on your keyboard and replace those IPs with your new Ips. Then write the below command and press enter:

:wq!

Now again enter a command:

vi /var/cpanel/nameserverips.yaml

You will see something just like as before. You have to replace existing Ips with new Ips. After saving, you have restart your "named" and "cpanel" service. Enter these commands one by one:

/etc/init.d/named restart /etc/init.d/cpanel restart

Now go to Main >>> Server Configuration >>> Basic cPanel & Configuration >>> Basic cPanel & WHM Setup. Look at the bottom, click on "Assigned IP Address" for each Nameserver. Please don't forget to add "A" record for Nameservers. At last, permanently you will got your Nameserver IPs changed successfully. Let me know if you face any problem.

Previous Next
Comments
Have you read the comment guideline?

Give me useful, constructive criticism. Spot a typo or an error? Let me know and I will correct it.