> For the complete documentation index, see [llms.txt](https://2ood.gitbook.io/2ood-knowledge-base/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://2ood.gitbook.io/2ood-knowledge-base/lecture-notes/networks/2023-09-21.md).

# 2023-09-21

> **Summary**

> **keywords**\
> DNS, DNS registrar, distributed hierarchical database, iterative query, DNS cache,

> **TODO**

> **HW**\
> see the example demo on slide 3-59\
> <https://realpython.com/python-https:/#what-is-http\\>
> find DNS registrar for .com TLD, .kr TLD

> **Exercise**\*

> **Next time**

***

## DNS

> Set of servers of serving ip-domain pair table.

DNS protocol is application level protocol.

### Role of the DNS system

every packet's header needs source IP address, Destination IP address\
DNS tells your destination ip by searching the plaintext-based domain.

### Steps.

1. send DNS Request ([www.google.com](http://www.google.com))
2. every dns request is served by the local DNS server.
3. If local DNS server knows its ip, it responses DNS response.(8.8.8.8)
4. Now, we can send Request to google.

### Why is DNS needed?

We cannot remember each IP address. number sequence is very hard to remember.

### DNS properties

* distributed & hierarchical database: it is a distributed database in many name servers.
* application-layer protocol : it is a core functionality, but implemented as a application layer protocol.
* Part of an edge network.

### DNS service.

It services

* hostn ame-to-IP-address translation
* host aliasing. (simple host name to difficult host names)
* mail server aliasing
* (sometimes) Load distribution.

### Why distributing? not centralized?

* single point of failure
* traffic volume is bigger.
* if centralized database is distant, service is slow
* maintenace.
* centralized approach doesn't scale.
* responsibility is also distributed.

### Hierarchy of DNS

root, TLD(Top Level Domain), Authoritative NS\
!\[\[../images/20230921133825.png]]

1. ask Root of .com TLD server ip
2. ask .com TLP of google.com NS server ip.
3. ask google.com NS server of [www.google.com](http://www.google.com) ip.

### DNS is important.

Powered by Associations. We call them **DNS registrar**.

* DNSSEC provides security on DNS servers.
* ICANN manages root DNS servers.

root DNS keeps records **only about** TLD servers.\
TLD keeps records only about authroitative servers.

### Local DNS servers.

* does not strictly belong in the hierarchy tree.
* each ISP has their own local DNS server.
* when host makes DNS query, it is sent to its local DNS server.
* uses **caches** to gain efficiency.

#### Iterative query

!\[\[../images/20230921135633.png]]

#### recursive query

* extra load on upper head hierarchy\
  !\[\[../images/20230921135704.png]]

### DNS Cache

* DNS caches mapping.
* improves response time
* DNS doesn't worry about the out-of-date information
* It is the best out of us.
* if the DNS response is based from cache, it is called from "non-authoritative server"

### DNS records : RR records

RR format : (name, value, type, ttl)\
ex. (google.com,8.8.8.8, A,16000)\
!\[\[../images/20230921141817.png]]

**Types**

* type A
  * name : hostname
  * value : ip
* type CNAME
  * name : alias name for real name
  * value : canonical (real) name
* type MX
  * value : name of SMTP mail
* type NS
  * name : domain (foo.com)
  * value : hostname of authoritative NS

### DNS protocol messages

identification number\
query reply has the same identification number of its corresponding request.\
flag\
each bit distinks about the ...?\
\#todo : what is flag

number of questionsk nuber of answer RRS, authority RRS, ...\
\#todo : see slide 2-88, Getting your info into the DNS
