Setup hostname and nameservers question

John Ang

Member
Apr 22, 2019
6
2
3
Malaysia
cPanel Access Level
DataCenter Provider
Hi,

I'm John, and I'm planning to start a new hosting business. I have registered a domain for my company (let's call it example.com) and I plan to setup my website, cpanels, etc.

So right now, all I have is the domain example.com. When I setup the trial version of CPanel, it requires a hostname and 2 nameservers. So I figured I'll call it:

Hostname: svr1.example.com
Nameserver 1: ns1.example.com
Nameserver 2: ns2.example.com

Read somewhere that the 3 subdomains above must be resolvable. So I'm guessing this means getting my domain registrar to create the subdomains for me and point it to my public IP. Am I right so far?

Now here's where it gets a bit confusing for me.

I would like to have my own website promoting my hosting business, so having a www.example.com is the idea. How do I go about doing this? Create a new cpanel account for example.com from the WHM/CPanel I installed earlier?

Hope someone can help me with this confusion.

Thanks.
 
Last edited by a moderator:

kdub

Active Member
Apr 19, 2019
29
8
3
California
cPanel Access Level
Root Administrator
Hi John,

Someone else can fill in the details but typically with whm you would run a local nameserver like BIND or powerDNS as the authoritative DNS to handle the zone records for all of your hosted accounts including your hostname and local nameservers. I believe whm creates these zones automatically when you run through the setup. Assuming you're running a local DNS then you would just need to update the nameservers listed at your domain registrar to point to ns1.example.com and ns2.example.com.

As far as setting up www.example.com. I believe whm creates an account for you automatically when setting up. If not, just create the account using the example.com domain and you'll be able to manage it through cpanel just like any other account.

The benefit of running a local DNS is that zones can be managed directly through the cpanel interface. If you're serious about hosting, I would recommend setting up a more robust DNS solution like a hidden master which uses your local dns to manage all the zones while enabling a thirdparty slave DNS to handle all the DNS interactions or at least something redundant like a DNS cluster you can manage through whm, although DNSSEC isn't fully supported yet.

If you're serious about hosting on your own VPS or dedi, be prepared for an insane amount of time you'll have to spend learning everything. To be honest, using a managed reseller account through a thirdparty host is probably way easier, cheaper, and less time intensive if all you want to do is resell.
 
  • Like
Reactions: cPanelLauren

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,301
363
Houston
Hi @John Ang

@kdub is pretty spot on with his response.

Read somewhere that the 3 subdomains above must be resolvable. So I'm guessing this means getting my domain registrar to create the subdomains for me and point it to my public IP. Am I right so far?
All three, the hostname and the two nameservers must resolve, correct. If you're hosting DNS locally though you shouldn't need to have your registrar create the subdomains. You should be able to do this right from your server once you've created the nameservers and pointed your domain to them.

If you want some more detail on how to create your nameservers and host DNS locally the documentation here should be helpful: How to Set Up Nameservers in a cPanel Environment - cPanel Knowledge Base - cPanel Documentation
 

John Ang

Member
Apr 22, 2019
6
2
3
Malaysia
cPanel Access Level
DataCenter Provider
Hi @John Ang

@kdub is pretty spot on with his response.



All three, the hostname and the two nameservers must resolve, correct. If you're hosting DNS locally though you shouldn't need to have your registrar create the subdomains. You should be able to do this right from your server once you've created the nameservers and pointed your domain to them.

If you want some more detail on how to create your nameservers and host DNS locally the documentation here should be helpful: How to Set Up Nameservers in a cPanel Environment - cPanel Knowledge Base - cPanel Documentation

Hi @cPanelLauren,

Thank you for your reply.

Can you elaborate more on "hosting DNS locally"?. This is what I did so far.

1. I purchased example.com
2. I informed my registrar to create 3 subdomains for me; svr1, ns1 and ns2 and all 3 points to the same IP.
3. So that this point I have svr1.example.com, ns1.example.com and ns2.example.com and all 3 points to the same IP.
4. I then proceed to install cPanel and everything went well.

So in my above scenario, the DNS is hosted by my registrar right? If I want to host locally, what should I do differently? I'm kinda confused and feel like it's a chicken and egg situation right now. To create local DNS first or to install WHM/cPanel first?

----

To continue, after I've completed my installation (using remote DNS instead of local), I now want to setup a website for www.example.com. I read Initial cPanel Hostname Setup Questions and it seems I should create a cPanel account just like usual. I did that, and I happily asked my registrar to point the nameservers of example.com to ns1.example.com and ns2.example.com but was told that if I do that, I will be managing the DNS myself; which I think refers to the local DNS that you mentioned above.

So if I'm understanding this right; for my case, I must host the DNS locally. Question I have is how? Is it just based on the link you shared earlier?

Do advise.

Thanks.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,301
363
Houston
So in my above scenario, the DNS is hosted by my registrar right?
Possibly? The fact is I don't know what process your hosting provider used to create the subdomains. If they just added DNS records then yes your DNS is still hosted at the registrar. But if they used the ns. subdomains and added them as custom nameservers then DNS would be pointed to your server, if you read through the documentation I sent you it goes over this entire process step by step.

So if I'm understanding this right; for my case, I must host the DNS locally. Question I have is how? Is it just based on the link you shared earlier?
You don't have to host DNS locally by any means, but the ns. subdomains aren't necessary if you don't. If you want your registrar to manage your DNS you can just add an A record at the registrar that points to the server. I would advise to host DNS locally at some point if you are in fact planning on starting a hosting business though.
 

John Ang

Member
Apr 22, 2019
6
2
3
Malaysia
cPanel Access Level
DataCenter Provider
Hello again @cPanelLauren,

I've done everything mentioned above but someone when I ping my nameservers, I get a unknown host error. My registrar has already put in the nameserver as per my request and everything. Not sure what I did wrong.

One thing I notice however is that my server becomes EXTREMELY slow after I got my registrar to point my domain to my nameservers created with cPanel.

I've already submitted a support ticket. Hopefully can get this solved during my trial period as it will greatly help my direction.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,301
363
Houston
Hi @John Ang

If you submitted a support ticket with your provider they should be able to assist you with getting the nameservers set up properly, pointing DNS to your server shouldn't cause slowness and I'd assume something else is going on.
 

kdub

Active Member
Apr 19, 2019
29
8
3
California
cPanel Access Level
Root Administrator
@John Ang
If you're not running a local nameserver, then having your registrar set up (ns1.example.com, ns2.example.com) is probably not what you want to do since technically speaking they don't actually exist. Instead I would suggest just using the registrar nameservers in your WHM. Once you have verified everything is working, then you can search for the proper zone configuration to create custom nameserver names like ns1.example.com, ns2.example.com that loop back to the registrars nameservers.

Just to provide some clarification since reading your posts it looks like maybe you don't fully get the difference between hosting DNS locally vs using your registrar's nameservers.

If you choose local DNS, you would setup a nameserver like BIND in the WHM->Nameserver Selection. You would then create a zone record for your host domain and your local nameservers (ns1.example.com, ns2.example.com) that point to your own server in WHM. At your registrar, you would remove any zone entries you created for all the domains you're hosting on your WHM server. Then in the settings for each of those domains, at the registrar, you set the nameserver to custom and enter your WHM nameserver addresses (ns1.example.com, ns2.example.com). What this does is tell the registrar and your server to tell anyone who asks for a domain hosted on your server that they can find the proper server IP address by checking your WHM nameserver, since your WHM nameservers hold all the domain zone records.

The benefit of this is that you're able to manage all the DNS records for the domains you host directly in WHM or cPanel, and WHM will create the proper zone records automatically when you provision accounts. The only thing you or your customers need to do at the registrar is set the nameservers to custom, and point them to (ns1.example.com, ns2.example.com). The downside is that now you're responsible for maintaining the local nameserver, like BIND, and ensuring it's running and secure. Because if it isn't working, then no one will be able to find things like mail and websites on your server. This is why a DNS cluster or a master/slave setup are recommended for redundancy. The other draw back is that a local nameserver wil consume some resources on your server fielding DNS queries from the entire internet. This might be a problem if you're tight on resources like memory on a small VPS.

If you chose not to run a local DNS like BIND, then instead of using (ns1.example.com, ns2.example.com) you will now be using the nameserver addresses provided by your registrar. Since your registrar is now hosting the nameservers, you have to manage all domain zones at the registrar, effectively disabling any domain zone record management functions through WHM. When you setup new accounts on your server, you'll provide the registrar nameservers and WHM will create a local zone entry using those registrar nameserver addresses. What this does is tell the registrar and your server to tell anyone who asks for a domain hosted on your server that they can find the proper server IP address by checking with the registrar's nameservers, since the registrar nameservers hold all the domain zone records.

The benefit of this is typically registrar nameservers are much more robust in terms of availability. Plus you're offloading the work and freeing up the resources that would be needed to run a local nameserver like BIND on your WHM server. The downside is that since the nameserver is at your registrar, you're not able to manage any zone records through WHM or cpanel aside from changing the nameserver addresses. This means you and your customers can't manage their domain zone records through WHM or cPanel. Instead, all zone management for each domain will have to be done manually by logging into the registrar and creating entries using the registrar control panel. In my opinion, tt's a lot more work and less of a seamless experience doing it this way.

I run powerDNS locally on my server with NS1 (a third party DNS provider) as a slave DNS provider for redundancy because I like the convenience of managing everything in one place locally. The nice thing is that even with a local DNS, if you or your customers prefer to manage DNS zones at the registrar, you still can by just setting the local zone entry to point to the registrar nameservers.

Side note, I'd like to know which registrar you're using that sets up these records for you. I didn't think there were managed registrars.
 
Last edited:

John Ang

Member
Apr 22, 2019
6
2
3
Malaysia
cPanel Access Level
DataCenter Provider
Hi @kdub,

Thank you for the explanation. I understand a lot better now.

Regarding your last question, my registrar is - Removed -

Anyway, to cut a long story short, it seems that my server is compromised and I will now have to re-setup the server. Will definitely use all the inputs here when I restart the trial.

I'll also update here if i'm successful the second time.

Thanks again!
 
Last edited by a moderator:
  • Like
Reactions: cPanelLauren

kdub

Active Member
Apr 19, 2019
29
8
3
California
cPanel Access Level
Root Administrator
@John Ang Ah, ok that registrar makes sense. Happy to help. Good luck getting everything up and running again!

Edit; just wanted to add that you should look into enabling the ConfigServer Security & Firewall plugin in WHM to help block unwanted traffic and login attempts. Enable two factor authentication at least for your WHM and make sure you set good passwords. If you have the server resources you should look into enabling the clamav plugin for virus scanning and add a cron to scan regularly. There are many many more things than these that you should do to properly secure your site. Spend some time searching and reading up on best practices. And make backups daily!
 
Last edited:
  • Like
Reactions: cPanelLauren