A name server is a critical part of the DNS (Domain Name System). In simple terms, DNS is responsible for answering queries asked about domain names. An authoritative name server is where the DNS records are stored for your domain name. Whenever you type a domain name into a web browser, it is the nameservers that are used to find the IP address and help make your connection to the site.
Understanding the role of nameservers in website access
A nameserver helps translate domain names into IP addresses. This is necessary because while humans can easily remember and understand domain names (such as www.20i.com), computers and other devices access websites using IP addresses (such as 185.151.30.20).
The different types of nameservers: authoritative and recursive
There are two types of nameservers: authoritative and recursive. Authoritative nameservers are responsible for storing information about a specific zone, such as its IP address and any subdomains. They will only answer for domain names that they have zones for.
Recursive nameservers, on the other hand, do not store information about domains, but instead forward requests for domain information to other nameservers until the correct IP address is found.
As an end user you don’t usually have to worry about recursive nameservers: You'll either be using recursive nameservers provided by your Internet Service Provider (ISP) or a public DNS service such as Google’s Public DNS or Cloudflare’s 1.1.1.1
How nameservers translate domain names into IP addresses
When a user types a domain name into their browser, your device will send a DNS query to resolve the domain name to its corresponding IP address. Your computer will speak to your recursive/local nameserver mentioned earlier, which in turn will query the domain's authoritative nameserver for the record. The authoritative nameserver then looks up the IP address in its database and returns it to the resolver, which is given to your device. The browser can then use that IP address to access the domain and render the webspace.
Example for nameservers
When you visit 20i.com in your browser, your device will send a query for 20i.com to your recursive nameserver. Your recursive nameserver firsts ask the root nameservers and .COM nameservers for the nameservers that are responsible for 20i. Our nameservers are ns1.stackdns.com, ns2.stackdns.com, ns3.stackdns.com and ns4.stackdns.com. The recursive nameserver will then ask one of the 4 stackdns.com nameservers for the DNS records 20i.com resolves to.
Our nameservers reply with an A record and an IP address like 192.165.30.20. Your browser then makes a connection to this IP address which will get to the web server hosting the website, and you get the rendered page in your web browser.
The importance of nameservers in the internet infrastructure
In summary, nameservers are an essential part of the internet infrastructure, allowing users to access websites using easy-to-remember domain names, instead of having to remember complex IP addresses.