DNS stands for domain name system. It is a vast database that translates domain name of the website to the machine understandable IP address. A DNS server is a translator that matches the hostname to its IP address. You can also consider DNS as a phonebook for the internet. DNS server is also known as name server or nameserver, although this name is less popular.
To understand what a nameserver is and why it is required, it is essential to know how web pages exist on the internet.
What is a domain name?
Let’s take an example. Suppose you want to access the website of Stemjar on the internet. You will type the URL of the website – ‘www.stemjar.com‘ in the address bar of your browser. URL stands for universal resource locator which is also called the address of the machine where the website is hosted.
URLs were designed so as they are easy to read and remember by humans. A URL has many components. One major component is called the hostname or the name of the server that hosts the website.
In the above example, stemjar is the hostname. Hostname refers to the name given to a host machine on the internet. ‘Stemjar.com’ forms the domain name. This name is kept human-friendly so that it is easy to read and remember.
Computers understand a different language than humans. They communicate using numbers in binary form, also known as machine language. For this purpose, each host machine on the network is assigned a 32-bit number, called IP (Internet Protocol) address.
Everytime you type a URL into the address bar of your browser, domain name of the website is translated into IP address. This translation is carried out using a DNS server.
How does a DNS server work?
DNS server acts as a database of domain names and IP addresses. Using this database, it translates a domain name into its respective IP address. When a DNS server is queried, DNS records are searched. If an entry for the domain name is found, the domain name record is returned.
The domain name might not be registered, or the server is authoritative for this particular domain name. In the latter case, the query is transferred to other DNS servers till the DNS record is found.
If your DNS server is not able to find the correct IP address associated with the domain name, the website will not load.
What are DNS record and DNS syntax?
A DNS server is a database that stores information about different domains, networks, and hosts. This information is stored in the form of a DNS record. A DNS record is a file that maps a domain name to an IP address.
It also contains information on how to handle requests that are sent to a domain. This is done using DNS syntax, which is a set of commands that are used to dictate actions of the DNS server.
Types of DNS syntax
A DNS record contains DNS syntax that dictates the actions of the DNS server. Some of these syntaxes are used in every DNS record while some of them are specific. Let’s see some of the commonly used commands.
An “A” record stands for address, indicating the actual IP address of the domain. By default, domain names are mapped to 32-bit IPV4 addresses. For 128-bit IPV6 addresses, “AAAA” is used instead.
“NS” stands for “name server” which is another name for DNS server. If a record is labelled as “NS” record, then it is pointing to another DNS server that is authoritative for the domain.
The “MX” record contains a list of mail exchange servers that are needed for the domain.
The “CNAME” record is used when one domain is an alias of another domain. CNAME stands for the canonical name and is commonly used to associate a new subdomain with an existing domain’s DNS records.
Where is a DNS server located?
In most cases, your ISP (Internet Service Provider) hosts two DNS servers, one primary and another secondary. These two DNS servers are automatically configured on your computer and router and queried when you connect to your ISP using DHCP (Dynamic Host Configuration Protocol).
Two servers are configured to have a backup in case one of them fails. In addition to ISP specific DNS server, several public-access DNS servers are also available. The most common one is by Google.
You can choose to manually configure your DNS server to a public-access one very easily. Some DNS servers have faster access times than others, but in most of the cases, it depends on how close or far that server is.
Troubleshooting DNS server
If you are facing network issues where no website is loading, then the chances are higher that your DNS server is not working. You can try changing DNS server configuration from automatic to manual and enter a public-access DNS server such as 22.214.171.124 (Google’s public-access DNS server).
If there is a problem with configured DNS server, then the issue will be resolved, and you might reaccess the internet.
Root servers are the authoritative nameservers that serve the DNS root zone. They are a network of several servers in different countries around the world. They are configured as 13 named authorities and you can visit Internet Assigned Numbers Authority for the complete list of root servers.