Understanding Nameservers in the DNS System: A Practical Guide with Examples

By: Rajat Kumar | Last Updated: September 26, 2023


Nameservers (also known as DNS servers) play a critical role in the Domain Name System (DNS). They are responsible for translating human-readable domain names (e.g., example.com) into IP addresses that computers use to locate websites and other resources on the internet.  

When you register a domain or set up a website, you typically need to configure your domain's DNS records, including the nameservers. Nameservers are usually provided by your web hosting provider or domain registrar. Here's a full example of how nameservers work in a website's DNS system.


How nameservers work in a website's DNS system:


1. Registering a Domain Name: 

Let's say you want to create a website with the domain name "example.com." You start by registering this domain with a domain registrar, like GoDaddy, Namecheap, or Google Domains.

2. DNS Records Setup: 

After registering the domain, you need to configure DNS records for your domain. DNS records define how various aspects of your domain work, such as where your website is hosted and where your email servers are located. Common DNS record types include:

  • A (Address) Record: Maps a domain to an IPv4 address.
  • AAAA (IPv6 Address) Record: Maps a domain to an IPv6 address.
  • CNAME (Canonical Name) Record: Maps a domain to another domain or subdomain.
  • MX (Mail Exchanger) Record: Specifies the mail servers responsible for handling email for the domain.
  • TXT (Text) Record: Contains text information associated with the domain.
  • NS (Nameserver) Record: Specifies the authoritative nameservers for the domain.

3. Nameserver Configuration: 

To ensure that your domain is associated with the correct DNS records, you specify the nameservers for your domain. This is typically done through the domain registrar's control panel. For example, you might set your domain's nameservers to:

  • ns1.example.com
  • ns2.example.com

4. Authoritative Nameservers: 

You must have authoritative nameservers set up for your domain. These are the servers that will store and serve the DNS records for your domain. In this example, we're using "ns1.example.com" and “ns2.example.com” as the authoritative nameservers.

5. DNS Zone Configuration: 

On the authoritative nameservers (in this case, ns1.example.com and ns2.example.com), you configure the DNS zone for "example.com." This involves creating and updating DNS records such as A records, CNAME records, and MX records to point to your web hosting server and email servers, as needed.

6. DNS Propagation: 

Once you've configured your DNS records and nameservers, it takes some time for these changes to propagate across the global DNS infrastructure. This process can take a few hours to several days. During this time, the DNS records for your domain are updated across the internet, and your website and email services become accessible via the domain name.

Here's a simplified example of what an NS (Nameserver) record might look like in a DNS zone file:

example.com.     IN     NS     ns1.example.com.
example.com.     IN     NS     ns2.example.com.

In this example, the NS (Nameserver) records for "example.com" specify that the authoritative nameservers for the domain are "ns1.example.com" and "ns2.example.com."

Please note that the actual configuration process may vary depending on your domain registrar and hosting provider. Always refer to their documentation for specific instructions on setting up nameservers and DNS records.



Different type of nameservers and their importance in internet world:

When you search for a website using its domain name, the DNS resolution process typically follows this sequence:

1. Local DNS Resolver: 

The initial DNS query is usually sent to your local DNS resolver, such as your ISP's DNS server or a public DNS service like Google's The local resolver may have cached information or may need to query the DNS hierarchy from the beginning.

2. Root Nameservers: 

If the local DNS resolver doesn't have the required information in its cache, it sends a query to one of the root nameservers. There are 13 sets of root nameservers globally. The root nameservers provide information about the top-level domains (TLDs) but do not hold information about specific domain names. These root nameservers maintain information about the top-level domains (TLDs) like .com, .org, and .net.

3. Top-Level Domain (TLD) Nameservers: 

The root nameservers direct the query to the appropriate TLD nameservers based on the TLD of the domain being queried (e.g., .com, .org, .net). The TLD nameservers have information about which authoritative nameservers are responsible for a specific domain within that TLD. For example, the .com TLD nameservers manage all .com domain names. When you query a .com domain, the TLD nameserver for .com directs you to the authoritative nameservers for that domain.

4. Authoritative Nameservers for Domains: 

The TLD nameservers provide the information about the authoritative nameservers for the specific domain being queried. These authoritative nameservers hold the actual DNS records for that domain, including the IP address of the webserver associated with the domain.

These are the nameservers designated by the domain owner or their hosting provider. They store DNS records for that specific domain, including information like IP addresses, MX records (for email), and other DNS records. When someone looks up a domain, the authoritative nameservers for that domain provide the necessary information.

So, the DNS resolution process begins with the local DNS resolver and then proceeds to the root nameservers, TLD nameservers, and finally the authoritative nameservers for the specific domain. 
It's also worth noting that while this is the general process, DNS resolution can be optimized through caching, and the actual number of DNS servers involved may vary depending on factors such as cached records, TTL (Time to Live) settings, and the efficiency of DNS resolution infrastructure.



In summary, when you type a domain name into your web browser or send an email, your device queries the DNS system to find the corresponding IP address. This process involves a hierarchy of nameservers, with the authoritative nameservers for the specific domain holding the IP address information.

If you want to set up or change nameservers for your website, you typically do this through your domain registrar or hosting provider. The exact steps can vary depending on the provider, but the general idea is to specify the nameservers you want to use for your domain. These changes propagate through the DNS system, and eventually, your domain resolves to the IP address of your hosting server.