← Foundations Course

NETWORK FOUNDATIONS · 07

Domain / DNS:使用者輸入名字,Browser 要怎麼找到目的地

Domain 是名稱;DNS 是把名稱查成可用網路資訊的分散式系統。這一課先理解 resolution / records / caching,不急著鑽完整 DNS protocol packet。

Learning outcomes

1. Domain 不是 Server

learn.example.com
  ↓ DNS
203.0.113.20
  ↓ network
service

同一 domain 的答案也可能由 CDN/edge 等系統動態決定,不能簡化成「domain 永遠等於一台固定 server」。

2. Resolver / Cache

Browser / OS cache
   ↓ miss
configured DNS resolver
   ↓
authoritative DNS data
   ↓
answer cached for TTL

因此改 DNS 後,不同地方可能因 cache/TTL 在一段時間內看到不同答案。

3. 常見 Record

A
name → IPv4

AAAA
name → IPv6

CNAME
name → another hostname

實際 DNS 還有 MX/TXT/NS 等 records,但先抓「不同 record 有不同 purpose」。

4. DNS 查到後,HTTP 還沒開始

URL hostnameDNSnetwork destinationconnectHTTP later

5. DNS Evidence

nslookup example.com
# or
dig example.com

如果 hostname 根本解析失敗,先修 DNS;如果 DNS 正常但 HTTP 500,問題已經進到更後面的 application/server 層。

Project checkpoint:Request Journey Map v7

https://example.com/courses
          ↓ hostname
      example.com
          ↓ DNS
network destination
          ↓
next: connect to a port

Debug evidence:改 DNS 之後有人可以、有人不行

先查 resolver answers、TTL/cache、record 是否一致,而不是立刻重新 deploy application。Deploy artifact 和 DNS propagation 是不同層。

Knowledge check

  1. Domain 與 IP 為什麼不是同一概念?
  2. TTL/cache 對 DNS 變更有什麼影響?
  3. A 與 CNAME 的基本差別?
  4. DNS 成功但 HTTP 404,DNS 算成功嗎?為什麼?