What is the DNS and how it works?

When we input the domain, how can we receive the web page? Let’s study about DNS.

Jangwook Kim
3 min readMar 3, 2020

Basically, all computers identify each other by the number and using that number they can communicate. We called this identity number as IP Address.

But let’s think one more time. When you use the web service, you haven’t input any number, right? I convince you input the name of the web site such as www.google.com. We said this as Domain Name.

When we enter the domain name, one service that named Domain Name Server(DNS) provide mapping domain name and IP address service.

Terms

  1. DNS Resolver
    Server on the internet that converts domain name into IP address.
  2. TLD(Top Level Domain)
    Domain at the highest level in the hierarchical Domain Name System.
    .com, .org, .net is the examples of the TLD.
  3. Authoritative Name Server
    Server operated by organization that has the authority for domain delegation.
  4. TTL(Time To Live)
    The life time of the data in the computer or network.

Process

DNS Process
  1. User input www.example.com domain name to address bar of Browser.
  2. Domain name www.example.com is going to be routed to DNS Resolver by the ISP.
  3. DNS Resolver sends request about www.example.com domain name to DNS Root Name Server.
  4. DNS Root Name Server provides the information about Name Server for .com TLD that has information about www.example.com domain name.
  5. DNS Resolver sends the request about www.example.com domain name to Name Server for .com TLD.
  6. Name Server for .com TLD provides information about Authoritative Name Server that has the data about example.com domain name to DNS Resolver.
  7. DNS Resolver sends the request about www.example.com to Authoritative Name Server.
  8. Authoritative Name Server searches and sends the IP address 123.123.123.123 which is mapped to www.example.com domain name to DNS Resolver.
  9. DNS Resolver caches the mapping information.
    (e.g www.example.com:123.123.123.123)
    Cached data will be saved to DNS Resolver during TTL(Time to Live).
  10. DNS Resolver sends IP address 123.123.123.123 to user’s Browser.
  11. Browser accesses to Target Web Server(or resource) using received IP address 123.123.123.123.
  12. Target Web Server sends web page to Browser.
  13. Browser displays web page to User.

The way of load balancing from DNS

If too many request has been occurred on one domain name, load has occurred on server, and speed of server will be slow. So we need to load balancing.

There are two ways to load balancing.

  1. Round Robin DNS
  2. IP Anycast

Round Robin DNS

This is way of multiple IP addresses is allocated on one domain.

If request enters to DNS, DNS sends one of registered IP addresses randomly that mapped target domain name.

From this below link, you can find more detail information about what is Round Robin DNS.

IP Anycast

In IP Anycast, that organizes multiple server as group to share one IP address.

If request enters to DNS, DNS maps the request to server that is nearest from DNS.

The target mapping server(nearest server) is decided beforehand by the ISP. So through this way, we can customize resources by the location.

CDN Services are provided using IP Anycast.

From this below link, you can find more detail information about what is IP Anycast.

Conclusion

I thought that DNS is just 1:1 mapping, but it was my fault. It’s more difficult than what I thought. And it was interesting that CDN is implemented by way of DNS load balancing.

--

--

Jangwook Kim

Korean, live in Japan. The programmer. I love to learn something new things. I’m publishing my toy projects using GitHub. Visit https://www.jangwook.net.