Private Nameserver with cPanel

From Lunarpages Web Hosting Wiki
Jump to: navigation, search

How can can you setup a private nameserver with cPanel?

This will allow your site to point to your own nameservers: ns1.yoursite.com and ns2.yoursite.com.

1. Registering domain (if you don't have one already)

Register your domain if you do not have one. This domain will be used as your nameserver. (eg. ns1.domain.com and ns2.domain.com)

2. Will need 2 available IPs

Lunarpages provides 3 IPs with the dedicated server. One is for the server itself, and the other 2 can be used for the nameservers.

3. Register the nameservers

You will need to contact your registrar to register your domain as a nameserver. In most cases, you can login to your domain management page to set this up. An example can be found at the following link: http://www.webhostingtalk.com/showthread.php?s=&threadid=237604

Please note that registrations can take up to 3 days to propagate.

4. Fix NDC

SSH into your server as root and run the following: /scripts/updatenow /scripts/fixndc

In WHM, restart DNS/Nameserver (BIND) - it is on the left window pane.

5. Setup nameservers in WHM

In WHM, select Edit Setup near the top in the left window pane. Set the Primary Nameserver to ns1.yourdomain.com (the domain you registered). Then click Assign IP Address. Repeat this for the Secondary Nameserver section, using ns2.yourdomain.com.

On the bottom of the page, click Save.

note: the IPs will be set incorrectly, this must be changed in shell

6. Edit files in Shell

SSH into your server as root and open the following 2 files and edit (you can open a file using nano). Check the key below.

file 1 - type:

nano /etc/resolv.conf
The file should be edited to look like this:
domain yourdomain.com
search yourdomain.com
nameserver 127.0.0.1
nameserver IP1
nameserver IP2

Save (ctrl+o and enter) and close the file (ctrl+x).

file 2 - type:

nano /etc/nameserverips
The file should be edited to look like this:
IP0=0
IP1=ns1.yourdomain.com
IP2=ns2.yourdomain.com

Save (ctrl+o and enter) and close the file (ctrl+x).

IP0=server ip
yourdomain = main domain of your server
IP1 = ip of nameserver 1
IP2 = ip of nameserver 2
ns1.yourdomain.com = nameserver 1 that you registered
ns2.yourdomain.com = nameserver 2 that you registered

7. Setup nameservers in WHM - final

In WHM, select Edit Server near the top in the left window pane. Set the Primary Nameserver to ns1.yourdomain.com (the domain you registered). Then click Assign IP Address (should be the correct IP now). Then click Add an A entry for this nameserver. Repeat this for the Secondary Nameserver section, using ns2.yourdomain.com.

On the bottom of the page, click Save.

In WHM, select Manage Nameserver IPs. You should see the correct 2 IPs and 2 nameservers.

8. Reboot server

SSH into server as root and type: reboot When the server comes back and is set to your liking, you will have to contact your registrar and point your domain to your nameservers. Until then, your domain will not point to the dedicated server.

Thanks to the following sites for reference: http://www.webhostgear.com/11.html

See also: lunarforums.com post - Registering private nameservers

Share |
Want to read this in another language?