How DNS works
DNS
3
network
12
White

Hiếu Huỳnh viết ngày 09/04/2017

Basic concept and information

  • DNS stands for Domain Name System
  • Its purpose is to resolve and translate human-readable website name to IPv4 or IPv6 address
  • It's basically a large Database which resides on various servers around the world, that contains the names and IP address of various host/domains.
  • Without DNS, we would only be able to visit any website directly via IP address, no human-readable anymore
  • DNS works on both the TCP and UDP Protocols, port 53

How does DNS work?

Whenever you visit a domain such as github.com, the browser's journey begins >>>

Step 1: Request information

  • TODO: Type github.com to address bar of Chrome, it's a new request for browser

Step 2: DNS cache on Chrome

  • TODO: DNS query on chrome's cache, see chrome://net-internals/#dns
  • True: Return IP address of this domain for making a request
  • False: Didn't know it before --> call OS (step3)

Step 3: DNS cache on OS

  • TODO: OS receive request from chrome, then check its DNS cache, see mDNSResponder on MacOS
  • True: Return IP of github.com for browser
  • False: OS didn't know it before same as browser, OS call the Resolver (Recursive DNS servers)

Step 4: The Resolver on ISP (Internet Service Provider)

  • TODO: local OS sends a DNS Query to the Resolver by using UDP Protocol over Port 53, the Resolver will check its cache to find IP for github.com
  • True: Return IP address for OS
  • False: ISP didn't know it before same as our OS. ISP will ask the Root server

Step 5: The ROOT servers - see https://www.iana.org/domains/root/servers

  • Fact: We have 13 root server for DNS around the world. They don’t know the answer, but they know where to find it.
  • TODO: Root look at the first part of request, reading from right to left .com <--
  • Direct our request to Top-Level Domain (TLD) name servers for .com, it's Verisign TLD
  • ISP will store TLD information, no need ask the root again.

Step 6: The TLD nameservers

  • TODO: The TLD nameservers review the next part of our request - github
  • Direct our query to the nameservers responsible for this specific domain
  • These Authoritative nameservers are responsible for knowing all the information about a specific domain, which are stored in DNS records

Step 7: The Authoritative nameservers

  • TODO: The Resolver (ISP) retrieves the A record for github.com from the authoritative nameservers and stores the record in ISP's local cache
  • More keywords: time-to-live value, Domain Registrar, types of records

Step 8: Receive the answer

  • TODO: Resolver returns the A record back to OS
  • OS stores the record in its cache, reads the IP address then passes information to Chrome
  • Chrome stores the record in its cache

Finally, Chrome opens a connection to the webserver and receives the site.

This entire process, from start to finish, takes only milliseconds to complete.

--
Reference:

  1. https://howdns.works
  2. http://dyn.com/blog/dns-why-its-important-how-it-works/
  3. https://www.verisign.com/en_US/website-presence/online/how-dns-works
Bình luận


White
{{ comment.user.name }}
Bỏ hay Hay
{{comment.like_count}}
Male avatar
{{ comment_error }}
Hủy
   

Hiển thị thử

Chỉnh sửa

White

Hiếu Huỳnh

6 bài viết.
2 người follow
Kipalog
{{userFollowed ? 'Following' : 'Follow'}}
Cùng một tác giả
White
6 0
Khi tiếp cận một hệ thống mới, nên follow theo những hướng như sau: 1. Tìm hiểu tổng quan của system, architecture 2. Đào sâu từng module của sys...
Hiếu Huỳnh viết hơn 1 năm trước
6 0
White
4 0
What is slow query log? Slow queries can affect database and server performance. The slow query log consists of SQL statements that took more t...
Hiếu Huỳnh viết hơn 1 năm trước
4 0
White
2 0
Problem SSH session is stuck and cannot be exited by entering exit or CTRL+D And we need to break out this session without closing terminal emula...
Hiếu Huỳnh viết hơn 1 năm trước
2 0
Bài viết liên quan
White
7 0
Nhu cầu: Một số khách hàng phàn nàn là việc kết nối đến server khá chậm. Trong trường hợp này, việc đầu tiên là phải kiểm tra đường kết nối. Vì kh...
manhdung viết hơn 3 năm trước
7 0
White
6 2
Hôm nay có một vụ tấn công DDoS quy mô lớn (Link) khiến cho hơn một nửa hệ thống Internet ở Mỹ bị tê liệt (Link), mà mình thì đang có việc cần vào ...
Huy Trần viết gần 2 năm trước
6 2
{{like_count}}

kipalog

{{ comment_count }}

bình luận

{{liked ? "Đã kipalog" : "Kipalog"}}


White
{{userFollowed ? 'Following' : 'Follow'}}
6 bài viết.
2 người follow

 Đầu mục bài viết

Vẫn còn nữa! x

Kipalog vẫn còn rất nhiều bài viết hay và chủ đề thú vị chờ bạn khám phá!