What is DNS?
The Domain Name System (DNS) is the phonebook of the Internet. Humans access information online through domain names, like nytimes.com or espn.com. Web browsers interact through Internet Protocol (IP) addresses. DNS translates domain names to IP addresses so browsers can load Internet resources.
Each device connected to the Internet has a unique IP address which other machines use to find the device. DNS servers eliminate the need for humans to memorize IP addresses such as 192.168.1.1 (in IPv4), or more complex newer alphanumeric IP addresses such as 2400:cb00:2048:1::c629:d7a2 (in IPv6).
How does DNS work?
The process of DNS resolution involves converting a hostname (such as www.example.com) into a computer-friendly IP address (such as 192.168.1.1). An IP address is given to each device on the Internet, and that address is necessary to find the appropriate Internet device – like a street address is used to find a particular home. When a user wants to load a webpage, a translation must occur between what a user types into their web browser (example.com) and the machine-friendly address necessary to locate the example.com webpage.
In order to understand the process behind the DNS resolution, it’s important to learn about the different hardware components a DNS query must pass between. For the web browser, the DNS lookup occurs “ behind the scenes” and requires no interaction from the user’s computer apart from the initial request.
The Domain Name System (DNS) is a central part of the internet, providing a way to match names (a website you’re seeking) to numbers (the address for the website). Anything connected to the internet – laptops, tablets, mobile phones, websites – has an Internet Protocol (IP) address made up of numbers. Your favorite website might have an IP address like 220.127.116.11, but this is obviously not easy to remember. However a domain name such as bestdomainnameever.com is something people can recognize and remember. DNS syncs up domain names with IP addresses enabling humans to use memorable domain names while computers on the internet can use IP addresses.
Whether you’re accessing a website or sending e-mail, your computer uses a DNS server to look up the domain name you’re trying to access. The proper term for this process is DNS name resolution, and you would say that the DNS server resolves the domain name to the IP address. For example, when you enter “www.howstuffworks.com” in your browser, part of the network connection includes resolving the domain name “howstuffworks.com” into an IP address, for example 18.104.22.168, for HowStuffWorks’ web servers.
How DNS Works: Domain Name System Terminology
A domain name is a human-readable name—like amazon.com—that we type in a web browser URL field. The Internet Corporation for Assigned Names and Numbers (ICANN) manages these domain names
Top Level Domain (TLD)
TLD refers to the last part of a domain name. For example, the .com in amazon.com is the Top Level Domain. The most common TLDs include .com, .net, org, and .info. Country code TLDs represent specific geographic locations. For example: .in represents India. Here are some more examples:
- com – Commercial businesses.
- gov – U.S. government agencies.
- edu – Educational institutions such as universities.
- org – Organizations (mostly non-profit).
- mil – Military.
- net – Network organizations.
- eu – European Union.
Second Level Domain
This is the part of a domain name which comes right before the TLD—amazon.com—for example.
A subdomain can be created to identify unique content areas of a web site. For example, the aws of aws.amazon.com.
By managing domain name reservations, name registrars are critical to how DNS works. ICANN currently grants permission to organizations to act as domain name registrars for specific higher level domains.
Like a phone book, the name server is a collection of domain names matched to IP addresses.
How DNS Works: Domain Name System record types
Address record. A Records map server IP addresses to domain names. For example, 22.214.171.124 to amazon.com.
Canonical Name record. A CNAME record establishes one domain as an alias to another (thereby routing all traffic addressed to the alias to the target; the canonical address).
Like a CNAME record, Alias records can be used to map one address to another. But Aliases can coexist with other records using the same name.
Mail Exchange Record. These records will redirect a domain’s email to the servers hosting the domain’s user accounts. Mail exchange records are used for determining the priority of email servers for a domain.
The basic function of a DNS is to convert the user-friendly domain name into a corresponding computer-friendly IP address. Let’s look at the various steps:
- Information request: When you type the domain name while visiting a website, you are asking your computer to resolve a particular hostname. The first step performed by your computer is that it looks for the IP address corresponding to your domain name in the local DNS cache, which stores information regarding your previously visited websites. In case you have not visited that website before, the computer performs a DNS query.
- Ask recursive DNS servers: If the information is not stored locally, your computer contacts the recursive DNS resolvers or servers from your Internet Service Providers(ISPs). These resolvers have their own cache. Since many users use the same ISP, chances are that the common and popular websites are already cached. In this case, the required information is returned to the user and the process ends here.
- Ask root name servers: In case the information is not provided by recursive servers or the data is outdated, they query the root name servers. The root name servers publish root zone file contents to the internet. The root name servers do not provide the IP addresses but redirect queries to other servers that might provide the required answer.
- Top-level domain(TLD) name servers: The root name servers read the request from right to left and direct you to the top-level domain name servers. For example, information like .com, org, etc, corresponds to a TLD which has its own set of servers for these. The TLDs don’t provide the IP address directly but direct your queries to the appropriate server.
- Authoritative name servers: The TLD servers read the next part of the query and direct it to the particular name server called authoritative name servers. These DNS servers are configured for different zones and provide related information. They store the original zone records and don’t cache the query results. These name servers can be present at the DNS provider or where the website is hosted. The authoritative name servers have different kinds of records, for example, we want to know the IP address, so we ask for the address record. This server lies at the bottom of the DNS lookup chain.
- Retrieve the record: The recursive server retrieves the required record from the authoritative name servers and stores it in its local cache. This serves to reduce the effort for a new lookup process while visiting the same website again. All the records maintain a time to live (TTL) value, which determines when the data will get expired, which helps ensure the data is up to date always.
- Receive the answer: The recursive server returns the required answer to your local computer which further caches this record. Your computer reads this record and returns the IP address to your browser. The browser opens a particular website by connecting to the webserver. This entire process is completed within a fraction of a second.