Domain Name System
✅ Domain Name
- which computer on network?
- correspond to
IP address
- since
IP address
is too long to memorize, useDomain Name
instead for humans - In order to access a web site, need to get
IP address
withDomain Name
fromDomain Name System
For IP address
and Domain Name
, read this https://soheeparklee.github.io/posts/n-4socketprogramming/
✅ Domain Name System
DNS is a distributed database consisted of DNS servers in hierarchy
- application layer(layer 7)
- operates on UDP, port 53
- System to convert
Domain Name
toIP address
- can correspond several
IP address
to oneDomain Name
What is the benefit of DNS being a hierarchical, distributed database?
DNS is used all around the world by many hosts
by being distributed, more effective, scalable.
What is the benefit of DNS being able to correspond several
IP address
to oneDomain Name
?can distribute the load
📌 Domain Name System Operation
- Type URI
www.google.com/index/html
on browser - Browser will get
host name
www.google.com
from URI, send toDNS client
DNS client
sendshost name
toDNS server
DNS server
respondsIP address
ofhost name
toDNS client
- When browser recieves
IP address
from DNS, reset TCP connection to thatIP address
andport 80
of thatIP address
to HTTP server process
📌 Domain Name System Hierarchy
✔️ DNS recursor
- recursive resolver
- server that responds to DNS query
- ask another DNS server for IP address
- local DNS server
✔️ Local DNS server
- operate as recursive resolver
- is not strictly part of DNS layer, but it is in the center of DNS structure
- ISP has local DNS
- ISP use local DNS to respond to host with IP address
- when host requests for DNS, requested to DNS server as proxy
✔️ Root-Level DNS Server
- name server for root zone
- classified from A to M
- more than 400 root-level DNS servers on internet
✔️ Top-Level DNS Server
- high-level DNS server
- such as
.com
,.org
,net
,edu
- from
www.google.com
, TLD server for the.com
will respond - national domains
- such as
.kr
,.uk
,.jp
✔️ Authoritative name server
- organization, company domains
- final stop for DNS query
- authoritative name server has the DNS record for the request
📌 Types of DNS Service
✔️ Recursive DNS resolver
- DNS recursor
- DNS server that responds to DNS query
- asks for the authoritative name server
✔️ Authoritative DNS server
- server to store DNS request
- if requested for IP address, doesnt ask any other server
- Authoritative name server is the final authority of IP address
📌 DNS queries
✔️ Non-recursive Query
- DNS server is expected to return IP address from own local cache or database
- However, if the DNS server cannot find IP address, it will return
empty response
.
✔️ Recursive Query
DNS client(local DNS server)
asks DNS resolver(ISP’s DNS server) to find IP address on its behalf- DNS resolver communicates with other DNS servers to hunt down an IP address and return it to the client
DNS resolver is responsible for finding IP address
- DNS resolver ask root name server
- DNS resolver asks TLD name server
DNS resolver asks authoritative name server
- DNS resolver asks again and again ➡️ recursive
- local DNS server
- 재귀적
✔️ Iterative Query
DNS resolver asks DNS server again and again in sequence for best answer
- DNS resolver ask root DNS server for IP address
- 😟root DNS server doesnt know.
- ➡️ return TLD name server address(best answer root DNS server has)
- ask TLD name server
- 😟 TLD name server doesnt know.
- ➡️ ask for authoritative name server address
ask authoritative name server…
- continue iterative process until finding IP address, or timeout
- Root, TLD server
- 반복적
📌 DNS Record
Information in a database that links a URL to an IP address
consists of DNS statements(series of text file)
- A record: contain IPv4 address of the domain
- AAAA record: contain IPv4 address of the domain
- CNAME record: 기존 도메인에 별명 붙인 레코드
- MX record: forward email to email servers
- TXT record: allow administrators to store text nodes in records, 텍스트 입력할 수 있는 레코드
- NS record: store nameservers for a DNS entry
📌 DNS Cache
- repository of domain names and IP addresses saved on device
so does not have to ask for IP address for a frequently visited site
- 👍🏻 speed up DNS request
- 👍🏻 reduce bandwidth
💡 DNS and UDP
Why does DNS use UDP?
- DNS priorities speed than reliability
DNS servers dont have to keep connections- To serve more clients
DNS requests are generally very small, and can fit well within UDP segments
How can DNS improve reliability?
By adding timeout, resend at the application layer
📌 How DNS functions
1. Request Domain Name
www.google.com
2. Check local DNS cache
- Check local cache on device
- if IP address is found in cache, process ends, website is accessed directly
3. Contact recursive DNS server(Resolver)
- Recursive DNS server(Resolver) provided by ISP
4. Recursive server lookup
- Check Recursive server cache for IP address
- recursive DNS server has its own cache
5. Query root name server
- if recursive server does not have IP address, need to look in Authoritative DNS server
- query root name server for top level domain server
- root Nameservers respond to the
Recursive DNS Server's query
by providing theIP addresses
of theTLD Nameserver
6. Query TLD name server
.com
- TLD name server provides
IP address
ofAuthoritative name server
- what TLD name servers do have is the location of the authoritative name server for requested site
7. Query Authoritative name server
google.com
- holds the
definitive IP address
for the domain
8. Get IP address
- passed through each level of DNS server until it reaches your device
9. Access website