What are Nameservers & How do They Works?
When displaying a website in a web browser, there are certain elements that come into play. These are the domain name (e.g. yourdomain.com), the DNS (Domain Name System), the name servers, and the IP address (e.g. 220.127.116.11.). All these elements interact together behind the scenes when you’re trying to access a website.
In this article, we’ll analyse the interaction between all these elements, with special focus on the role and function of name servers.
Also Read: What is Private Whois & How it Works?
What are Nameservers? How do They work?
In a nutshell, nameservers are encumbered with the task of looking up the corresponding IP address of a domain name, this is necessary because the Web or the HTTP protocol works on top of TCP/IP. If you want to communicate with any other machine on the network (internet), you will need to know its IP address. For us humans, it is easier to memorize letters and words than 32 bit integers or even 4 octets.
There are some IP addresses which are easy to memorize like 18.104.22.168, which is Google’s public DNS server. It is quite clever, because in order to resolve yourdomain.com to an IP address you will need to communicate with a DNS server, but you can’t define a DNS server in your operating system using a domain name because then you would need another DNS server which would translate that.
Therefore, it must start with a fix IP address. Google bought the 22.214.171.124 IP because it is easily to memorize and when setting up an internet connection on any machine, a lot of administrators or even simple user will use it.
When you buy a hosting account, the hosting company will usually assign you a minimum of two nameservers (primary and secondary nameservers) which will look something like this: ns1.yourhostdomain.com and ns2.yourhostdomain.com.
When you enter a domain name in a web browser, the DNS will retrieve the two nameservers assigned by the hosting company and your browser will use the nameservers to look up the IP address corresponding to your domain name “yourdomain.com”.
Once the request for the IP address (the so-called A record) is fulfilled, the browser will send a request to the IP address requesting the specific page you’re trying to access, and the web server will send the requested page to your browser, in effect displaying the pages you’re trying to view.
All this can take less than a second, and unless something goes wrong, you’re only ever going to see the human readable version of this entire process.
Without name servers and DNS, you’d be forced to memorize a string of numbers instead of domain names. So, for example if you wanted to access InMotion Hosting’s website, you’d have to write http://126.96.36.199 instead of InMotionHosting.com.
Both of these would help you get to this web host’s website, but while one method is easier to remember for humans, the other is understandable to machines.
Maintained by several organizations including ICANN (Internet Corporation for Assigned Names and Numbers) and the IANA (Internet Assigned Numbers Authority), a DNS is often compared to a phone book for computers, specifically because of its role in converting human readable domain names to IP addresses.
Changing Nameservers – When and How?
Usually, if your domain and website are hosted at the same provider, you don’t need to be bothered with nameservers at all. If you purchase your domain name from a certain domain registrar (e.g. Namecheap), but your hosting account is with a hosting provider different from your registrar (e.g. BlueHost), it is easier and simpler to just change the NS records (Name Servers) to the one provided by your hosting company.
Doing so will assure that any changes made in the hosting’s control panel it will reflect in the DNS, for example adding a new subdomain. Also, it is better to have a single central point where you can control your hosting and your DNS.
But if you want to host your DNS at your registrar’s severs, because maybe they have some extra features (Dynamic DNS, DKIM, etc) which your hosting lacks, you need to make sure you always update your A, MX, TXT records whenever a change is made in your hosting environment.
There are some DNS services that will try to periodically scan your hosting DNS for any changes and implement them, one example would be CloudFlare, or other similar CDN and/or Firewall solutions which work at the DNS level.
All the necessary nameserver information for performing these changes is provided by the hosting company you sign up with, usually in an email. After carrying out these changes, you’ll need to wait at least 24 hours for the DNS propagation to take effect.
Hosting Reselling and Private Nameservers
Private nameservers are particularly important for reseller hosting providers. A private nameserver is associated with your domain name and not that of the third-party web hosting provider, making your hosting business look more professional in the eyes of your clients.
This means that you can rebrand hosting services under your domain own name without your clients finding out that you’re a hosting reseller. Private nameservers come with the advantage of more credibility from your customers, a greater sense of security, and the possibility to easily change your hosting provider without having to ask your clients to update their nameservers.
To register your nameservers with your registrar, you’ll need the IP addresses provided to you by your host and the recommended subdomains (usually ns1, ns2). Every registrar has a different process as to how this should be carried out, and usually both your hosting company and your registrar will have step-by-step walkthroughs regarding private nameserver registration.
Vanity Nameservers vs. Custom Nameservers
Vanity nameservers allow you to brand them to a website of your choice, hiding the fact that they rely on a web hosting company’s public nameservers. Just like private nameservers, vanity nameservers allow you to mask the fact that you’re using a certain web host’s public name servers.
However, you’d only be masking the hostname of the hosting company’s public nameservers as the IP addresses and the servers handling your site’s DNS request will continue to be the public name servers of the web host.
Custom nameservers on a VPS or dedicated server, on the other hand, run completely separate from the host’s public nameservers, allowing you to run your own nameservers that respond to DNS requests for your domains.
Given that clients with dedicated server or VPS hosting plans are usually granted root access with the possibility to modify DNS zones on the server, custom nameservers are a requirement with this plans, since granting access to the public nameserver zones of the hosting company would pose a security risk.
Unless you need to point your domain name to a hosting account, you’ll probably never have to deal with name servers in your day-to-day life, but they are a crucial element in streamlining browser-server communication (that is human-machine interaction), making it easier for humans to remember domain names and access websites.