What is DNS?
DNS and things around
First, we need to know about DNS and related concepts:
The Domain Name System (DNS) let users connect to the website using domain names instead of IP addresses. DNS translates human readable name like nquang.com into the numeric IP addresses like 192.168.7.7 so browsers can load internet resources. It like a phone book by managing the mapping between names and numbers.
DNS Lookup: the process of finding an IP address based on a certain URL.
DNS Servers: contains a database of a list of IPs and their respective domains, DNS Servers run special programs, and communicate with each other using special protocols.
Why we need DNS?
Imagine that you will visit a large number of websites every day and you need to remember the sequence of numbers that represent those websites.
So between name and number. What do you choose to remember?
4 DNS Servers
The four servers work with each other to get the correct IP address to the client:
- DNS recursor: which is also referred to as a DNS resolver, receives query from the DNS client and then, it communicates with other DNS servers to find right IP.
- Root nameservers: answer requests sent to it for records in the root zone. It answers requests by sending back a list of authoritative nameservers that go with the correct TLD.
- TLD nameservers: The top level domain server keeps the IP address of the second level domain contained within the TLD name. TLD devide into 2 types: ccTLD — CountryCode TLD (e.g. VietNam is .vn, England is .ek) and gLTD — Generic TLD (e.g. .com for commercial organizations).
- Authoritative nameservers: know all information related to specific domain by storing DNS records (DNS Resource Record — RR). It gives you the real answer to your DNS query.
Steps To Performs A DNS Lookup
- End-user uses browser, enter www.nquang.com. The request is routed to a DNS Resolver, , which is typically managed by the user’s Internet service provider (ISP).
- DNS Resolver forwards the request www.nquang.com to a DNS Root Nameserver.
- DNS Resolver forwards the request www.nquang.com again, this time to one of the TLD name servers for .com domain. The TLD server then responds with the IP address of the domain’s nameserver.
- DNS Resolver send a query to the domain’s nameserver.
- Then, the IP address for nquang.com is then returned to the resolver from the nameserver.
- The DNS resolver then responds to the web browser with the IP address of the domain requested initially.
- Browser make a HTTP rẻquest to the IP address.
- The server at that IP returns the webpage to be rendered in the browser.
During the DNS Lookup process, three different kinds of queries are performed. The queries are combined to optimize the resolution of the DNS, saving time:
- Recursive query: DNS client requires that a DNS server will respond to the client with either the requested resource record or an error message if the resolver can’t find the record.
- Iterative query: DNS client will allow a DNS server to return the best answer it can.
- Non-recursive query: this will occur when a DNS resolver client queries a DNS server for a record that it has access to either because it’s authoritative for the record or the record exists inside of its cache.
DNS Resource Record
Some DNS Resource Records:
- A Record: mapping straight from a domain to an IP address.
- AAAA Record: similar to A Record, but used for IPv6.
- CName (Canonical Name)Record: contains the alias of a domain, which can also be understood as the mapping between one domain to another.
- NS (Name Server) Record: shows information about the domain nameservers. A domain will be managed by 2 servers, so there will be at least 2 NS records for each domain.
- MX (Mail Exchanger) Record: shows information about the Mail Server for a certain domain.
Thanks for reading! In the next blog, I will present how to build a basic DNS Server.
What is DNS? - Introduction to DNS - AWS
DNS, or the Domain Name System, translates human readable domain names (for example, www.amazon.com) to machine…