If you have a web hosting account, you’ve probably come across mentions of nameservers. But even if you’ve had to deal with nameservers when managing your hosting account, your web host probably didn’t explain what they are or how they work.
Nameservers are provided by web hosts, and they are key to your website is visible on the web. Most nameservers provided by hosts look something like ns1.yourhostdomain.com. You’ll normally be given two different nameservers. Setting up nameservers usually only takes a few seconds once you have the right information.
But what do nameservers actually do behind the scenes, and why is it crucial to get them right? Let’s look at the basics of how nameservers work.
What Is a Nameserver?
Every website in existence has an IP address, which is how computers look them up. But to make it easier on us humans, we can get to websites by using domain names instead. Nameservers are part of DNS, which stands for “Domain Name System.” The DNS is a database that works like a phone book for computers: it converts a domain name, such as “www.example.com,” to a machine-readable IP address, such as “126.96.36.199.” The DNS is maintained by several organizations, including IANA (Internet Assigned Numbers Authority) and ICANN (Internet Corporation for Assigned Names and Numbers).
Whenever you type a domain into your browser, nameservers provide the IP address of the domain to your browser. If the DNS didn’t exist, you’d have to memorize strings of numbers for every website you wanted to visit. In a nutshell, a nameserver is any server that has DNS software installed on it. But usually, “nameserver” refers to a server owned by a web host that is specifically used to manage the domain names associated with their web hosting customers.
When it comes to your own domain, your domain’s nameservers are used to point any traffic that types in your domain name to a specific web server at a specific web host.
Here’s how it would work when you visit your own website, let’s say www.example.com:
- You type “www.example.com” into your browser.
- Your browser uses DNS to look up the nameservers for www.example.com.
- The nameservers ns1.yourhostdomain.com and ns2.yourhostdomain.com are retrieved.
- Your browser uses the nameservers to look up the IP address for www.example.com.
- Your browser gets the response: “188.8.131.52”
- Your browser sends a request to 184.108.40.206, including the specific page you’re trying to reach.
- The web server hosting your website sends the requested page to your browser.
Your Site and Its Nameservers
The entire above process can take less than a second, so the majority of your visitors will never be aware of the nameservers you use for your site unless something goes wrong. Machines read them often; humans rarely need to. In many cases, you may not ever need to know or mess with the nameservers for your website. But if you register your name with a different company than you host your website with, you’ll need to set your nameservers for your domain to point to your web hosting account. Once you change nameservers, it can take up to 48 hours to go into effect, though it typically takes about 4-8 hours in most cases. This delay is called “DNS propagation,” and exists because it takes time for each DNS server to update other servers around the world about the change.
On a wider point, you may encounter problems if you share nameserver information with spammy domains, although the jury’s out on the extent of the damage that it causes.
Registering Your Own Nameservers
If you resell hosting space, you can normally register your own nameservers to avoid giving third-party details to your clients. Nameservers that are your own and associate with a single domain, instead of with a web hosting company, are called “private nameservers.”
Having private nameservers is beneficial for a number of reasons:
- They effectively cloak the fact that you’re a reseller, allowing you to completely rebrand your hosting under your own domain name.
- They can also make it easier for your clients to remember your nameservers if they’re the same as your main domain.
- It can provide a greater sense of security to your hosting customers to have the same domain for both your website and nameservers.
- You can more easily change your own hosting provider without requiring all your customers to update their nameservers.
Most hosting companies will tell you how to register nameservers with your registrar. In short, you need the IP addresses for each nameserver given to you by your host, plus the subdomains they recommend (normally these will be ns1 and ns2).
Once propagated, your nameservers will work in exactly the same way as your host’s.