How to create your own name servers

pexels-photo-69432Many times we are asked how to start a hosting company and one of the major functions of a hosting service is to make sure that DNS zone files are functioning correctly.  Every domain on the Internet must have been at least 2 name servers listed.  These name servers are called the Start of Authority (SOA) and they contain the only “authoritative” DNS information about the domain.   When a DNS query is requested in that domain, be it for finding the IP address of a website or a location of the MX server for an email address on the domain it can be found.

Name servers serve a major role on the Internet which points domain names to IP addresses and IP addresses to domain names.  This is done by software running on a name server which reads a zone file found on the name server which translates the domain name to an IP address.  In order for someone that is connected to the Internet and types in the domain name of a website into their browser that they want to view, the browser will search for the “authoritative” name servers for that domain.  So, for example, let’s say that you want to view the website google.com and you type the name into your browser.  Your browser will search your workstation and determine if you have visited that site before and have a “cache” of domain names pointing to IP addresses already saved in your browser.  If so, then your browser will display the domain name website found at the IP address in your browser cache.  This is done to speed up the display of common sites that you visit often.

Let’s say that you have never visited google.com before or there is no cache of domain names in your browser.  Then your browser will run a whois to find where the domain name google.com is registered and the list of name servers that are authoritative for that name.  In this case,  google.com uses the following name servers

Name Server: NS1.GOOGLE.COM
Name Server: NS2.GOOGLE.COM
Name Server: NS3.GOOGLE.COM
Name Server: NS4.GOOGLE.COM

These Name Servers are called registered hosts and are registered with the domain name registrar, in the case of google.com the registrar is

Registrar: MARKMONITOR INC.

At the registrar, the IP address is “registered” to the hostname.  In this case, ns1.google.com is registered to the IP address:  216.239.32.10 Now the whole internet knows which IP it should query to find the authoritative answer to the hostname of google.com.  Each of the 4 name servers is registered to specific IP address and is called “glue” records. That is an “A” record in the DNS zone file for google.com.

This is done for a major domain like google.com, but it can be for your domain as well.  Any domain on the internet can have a registered hostname pointing to an IP address of a server with the name server software running.  Each cPanel & WHM server can be configured to run as a name server.  So let’s say the main IP address of your cPanel server is 52.52.52.105 and your domain name is yourfabsite.com.  Let’s also say that you only have one public IP address on your server and you need 2 name servers for your domain name.  So you go to your domain registrar and you register 2 new host names: ns1 and ns2.  So you now have host names ns1.yourfabsite.com and ns2.yourfabsite.com.  You will register both host names to the IP address 52.52.52.105.  This is perfectly OK to have the same IP on both your name servers.  It is not the best situation, but if you only have one public IP, it is all you can do.  As your business grows you will be able to add more name servers and change the IP address on your second, third, or fourth name servers at your registrar.

After you have registered your host names with this correct server IP of your domain registrar, you should add “A” records to your DNS zone file on your cPanel & WHM server for each registered host name with the correct IP address that you have registered at your registrar.  This can be done within WHM under the section Server Configuration called “Basic cPanel & WHM Setup”.  You are now ready to change the registered name servers of your domain name at your registrar.  So in the case of the domain yourfabsite.com, you would edit the record at your registrar and enter the name servers ns1.yourfabsite.com and ns2.yourfabsite.com.

Comments are closed.

>