Network

DNS Resolver์™€ ๋ชจ๋“œ(stub, uplink)

๐Ÿง Yon 2024. 2. 14. 09:06
๋ฐ˜์‘ํ˜•

DNS Resolver ?

ํŠน์ • OS ์—์„œ DNS nameserver๋ฅผ ๋ณ€๊ฒฝํ•˜์—ฌ ๊ณ ์ •์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์€?

DNS๋Š” ์ธํ„ฐ๋„ท์—์„œ ๋„๋ฉ”์ธ ์ด๋ฆ„์„ IP ์ฃผ์†Œ๋กœ ๋ณ€ํ™˜ํ•˜๊ฑฐ๋‚˜ IP ์ฃผ์†Œ๋ฅผ ๋„๋ฉ”์ธ ์ด๋ฆ„์œผ๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋Š” ์‹œ์Šคํ…œ์ด๋‹ค. DNS Resolver๋Š” ์ฃผ์–ด์ง„ ๋„๋ฉ”์ธ ์ด๋ฆ„์— ๋Œ€ํ•ด ํ•ด๋‹นํ•˜๋Š” IP ์ฃผ์†Œ๋ฅผ ์ฐพ์•„์ฃผ๋Š” ์„œ๋ฒ„๋‚˜ ์†Œํ”„ํŠธ์›จ์–ด๋ฅผ ์˜๋ฏธํ•œ๋‹ค. DNS Resolver๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ์›น ๋ธŒ๋ผ์šฐ์ €์— ๋„๋ฉ”์ธ์„ ์ž…๋ ฅํ•˜๋ฉด, ํ•ด๋‹น ๋„๋ฉ”์ธ์˜ IP ์ฃผ์†Œ๋ฅผ ์ฐพ์•„์ฃผ์–ด ํ†ต์‹ ์ด ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•œ๋‹ค:[1]

DNS ์ฟผ๋ฆฌ๋Š” ์ฃผ๋กœ UDP(ํฌํŠธ 53) ํ”„๋กœํ† ์ฝœ์„ ์‚ฌ์šฉํ•˜์ง€๋งŒ, ๋Œ€์šฉ๋Ÿ‰ ๋ฐ์ดํ„ฐ๋‚˜ ์บ์‹œ๋ฅผ ์ดˆ๊ณผํ•˜๋Š” ๊ฒฝ์šฐ TCP๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ๋‹ค.
DNS Resolver๋Š” DNS ์„œ๋ฒ„์— ์ง์ ‘์ ์œผ๋กœ ์ฟผ๋ฆฌ๋ฅผ ๋ณด๋‚ด๊ธฐ ์œ„ํ•ด ๋„คํŠธ์›Œํฌ ๊ตฌ์„ฑ ๋ฐ ์‚ฌ์šฉ์ž ์„ค์ •์— ๋”ฐ๋ผ DNS ์„œ๋ฒ„ ์ •๋ณด๋ฅผ ์–ป๊ณ  ์ฟผ๋ฆฌ๋ฅผ ์ˆ˜ํ–‰ํ•œ๋‹ค. ์ผ๋ฐ˜์ ์œผ๋กœ ๋„คํŠธ์›Œํฌ ๊ด€๋ฆฌ์ž๋Š” DHCP ์„œ๋ฒ„๋ฅผ ํ†ตํ•ด ํ˜ธ์ŠคํŠธ์—๊ฒŒ ์ ์ ˆํ•œ ๋„คํŠธ์›Œํฌ ๊ตฌ์„ฑ ์ •๋ณด๋ฅผ ์ œ๊ณตํ•˜๋„๋ก ๊ตฌ์„ฑํ•˜๋ฉฐ, ๋„คํŠธ์›Œํฌ์—์„œ ํ˜ธ์ŠคํŠธ์—๊ฒŒ IP ์ฃผ์†Œ, ์„œ๋ธŒ๋„ท ๋งˆ์Šคํฌ, ๊ฒŒ์ดํŠธ์›จ์ด ๋“ฑ๊ณผ ๊ฐ™์€ ๋„คํŠธ์›Œํฌ ๊ตฌ์„ฑ ์ •๋ณด๋ฅผ ๋™์ ์œผ๋กœ ํ• ๋‹นํ•˜๋Š”๋ฐ DHCP ํ”„๋กœํ† ์ฝœ์„ ์‚ฌ์šฉํ•œ๋‹ค. DNS Resolver๋Š” ์ด๋Ÿฌํ•œ ๋„คํŠธ์›Œํฌ ์„ค์ •์„ ๊ธฐ๋ฐ˜์œผ๋กœ DNS ์„œ๋ฒ„ ์ •๋ณด๋ฅผ ์–ป๊ณ  ์ฟผ๋ฆฌ๋ฅผ ์ˆ˜ํ–‰ํ•œ๋‹ค.

์•„๋ž˜๋Š” ๋Œ€ํ‘œ์ ์œผ๋กœ ๋งŽ์ด ์‚ฌ์šฉ๋˜๋Š” DNS Resolver ์†Œํ”„ํŠธ์›จ์–ด์ด๋‹ค.

  1. BIND (Berkeley Internet Name Domain):
    • BIND๋Š” ๊ฐ€์žฅ ์˜ค๋ž˜๋œ DNS ์†Œํ”„ํŠธ์›จ์–ด ์ค‘ ํ•˜๋‚˜๋กœ, ๋งŽ์€ ์„œ๋ฒ„์—์„œ ์‚ฌ์šฉ๋œ๋‹ค.
    • ์œ ์—ฐํ•˜๊ณ  ๊ฐ•๋ ฅํ•œ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๋ฉฐ, ๋งŽ์€ ์˜ต์…˜๊ณผ ์„ค์ •์ด ๊ฐ€๋Šฅํ•˜๋‹ค.
  2. Unbound:
    • Unbound๋Š” ๋น ๋ฅด๊ณ  ๊ฒฝ๋Ÿ‰ํ™”๋œ DNS Resolver๋กœ ์•Œ๋ ค์ ธ ์žˆ๋‹ค.
    • ์บ์‹ฑ๊ณผ ์•ˆ์ „ํ•œ DNSSEC(๋„๋ฉ”์ธ ์ด๋ฆ„ ์‹œ์Šคํ…œ ๋ณด์•ˆ ํ™•์žฅ) ์ง€์› ๋“ฑ์„ ํŠน์ง•์œผ๋กœ ํ•œ๋‹ค.
    • ๋Œ€๋ถ€๋ถ„์˜ ๋ฆฌ๋ˆ…์Šค ๋ฐฐํฌํŒ์—์„œ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•˜๋ฉฐ, ์‰ฝ๊ฒŒ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.
  3. dnsmasq:
    • dnsmasq๋Š” ๊ฒฝ๋Ÿ‰ DNS ๋ฐ DHCP ์„œ๋ฒ„์ด์ž ์บ์‹œ ๋ฉ”์ปค๋‹ˆ์ฆ˜์„ ๊ฐ–์ถ˜ ์†Œํ”„ํŠธ์›จ์–ด์ด๋‹ค.
    • ์ฃผ๋กœ ๊ฐ€์ • ๋‚ด์—์„œ ์†Œ๊ทœ๋ชจ ๋„คํŠธ์›Œํฌ ํ™˜๊ฒฝ์—์„œ ์‚ฌ์šฉ๋˜๋ฉฐ, ๊ฐ„๋‹จํ•˜๊ณ  ์„ค์ •์ด ์šฉ์ดํ•˜๋‹ค.
  4. systemd-resolved:
    • systemd-resolved๋Š” systemd์˜ ์ผ๋ถ€๋กœ ์ œ๊ณต๋˜๋Š” DNS Resolver ์ด๋‹ค.
    • ๋งŽ์€ ์ตœ์‹  ๋ฆฌ๋ˆ…์Šค ๋ฐฐํฌํŒ์—์„œ systemd๋ฅผ ์‚ฌ์šฉํ•˜๋ฏ€๋กœ, systemd-resolved๊ฐ€ ์ž์ฃผ ํ™œ์šฉ๋œ๋‹ค.
    • DNSSEC์™€ ํ•จ๊ป˜ ์ž‘๋™ํ•˜๋ฉฐ, ๋„คํŠธ์›Œํฌ ๊ด€๋ฆฌ์™€ ํ†ตํ•ฉ๋œ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•œ๋‹ค.
  5. knot Resolver:
    • Knot Resolver๋Š” ๋น ๋ฅด๊ณ  ์•ˆ์ •์ ์ธ DNS Resolver๋กœ ์•Œ๋ ค์ ธ ์žˆ๋‹ค.
    • ์บ์‹ฑ๊ณผ DNSSEC๋ฅผ ์ง€์›ํ•˜๋ฉฐ, ๋ชจ๋“ˆํ™”๋œ ์•„ํ‚คํ…์ฒ˜๋ฅผ ๊ฐ–์ถ”๊ณ  ์žˆ๋‹ค.
  6. netplan :[2]
    • Ubuntu์—์„œ ๋„คํŠธ์›Œํฌ ๊ตฌ์„ฑ์„ ๊ด€๋ฆฌํ•˜๋Š” ๋„๊ตฌ ์ค‘ ํ•˜๋‚˜๋กœ, YAML ํ˜•์‹์˜ ์„ค์ • ํŒŒ์ผ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋„คํŠธ์›Œํฌ ์„ค์ •์„ ์ •์˜ํ•œ๋‹ค.
    • ์„ค์ •ํŒŒ์ผ: /etc/netplan/01-netcfg.yaml
    • ๋ณ€๊ฒฝ์‚ฌํ•ญ ์ ์šฉ ๋ฐฉ๋ฒ•: sudo netplan apply
    • .yaml ์˜ˆ์‹œ(์ด๋ ‡๊ฒŒ ์„ค์ •ํ•˜๋ฉด ํ•ด๋‹น ๋„คํŠธ์›Œํฌ ์ธํ„ฐํŽ˜์ด์Šค๊ฐ€ DHCP๋ฅผ ํ†ตํ•ด IP ์ฃผ์†Œ๋ฅผ ๋ฐ›์œผ๋ฉด์„œ, Google Public DNS (8.8.8.8, 8.8.4.4)๋ฅผ DNS Resolver๋กœ ์‚ฌ์šฉํ•˜๊ฒŒ๋œ๋‹ค.)
    • Ubuntu 20.04 ์ดํ›„ ๋ฒ„์ „์—์„œ๋ถ€ํ„ฐ๋Š” systemd-resolved์˜ ์„ค์ • ํŒŒ์ผ(/etc/systemd/resolved.conf)์„ ์ง์ ‘ ํŽธ์ง‘ํ•˜๋Š” ๊ฒƒ์ด ๊ถŒ์žฅ๋œ๋‹ค.
      network:
      version: 2
      renderer: networkd
      ethernets:
      enn5:
      dhcp4: true
      nameservers:
       addresses: [8.8.8.8, 8.8.4.4]

์–ด๋–ค DNS Resolver๊ฐ€ ํ˜„์žฌ ํ™œ์„ฑํ™”๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋ฒ•์€ ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

systemd-resolved ์‚ฌ์šฉ ์‹œ: systemctl status systemd-resolved
BIND ์‚ฌ์šฉ ์‹œ: named -v
Unbound ์‚ฌ์šฉ ์‹œ: unbound -V
dnsmasq ์‚ฌ์šฉ ์‹œ: dnsmasq -v
netplan netplan status [interface]


DNS Resolver ๋ชจ๋“œ, Stub? Uplink?

DNS Resolver์˜ "Uplink Mode"์™€ "Stub Mode"๋Š” Resolver๊ฐ€ DNS ์ฟผ๋ฆฌ๋ฅผ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐฉ์‹์„ ๋‚˜ํƒ€๋‚ธ๋‹ค.
์ผ๋ฐ˜์ ์œผ๋กœ /etc/resolv.conf ๋ฐ /etc/systemd/resolved.conf ์—์„œ ๋ชจ๋“œ๋ฅผ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๋‹ค.

Uplink Mode:
์—…๋งํฌ(Uplink) ๋ชจ๋“œ์—์„œ๋Š” DNS Resolver๊ฐ€ ๋กœ์ปฌ์—์„œ DNS ์ฟผ๋ฆฌ๋ฅผ ์ˆ˜์‹ ํ•˜๊ณ , ์ด๋ฅผ ์ƒ์œ„ ๋ ˆ๋ฒจ์˜ DNS ์„œ๋ฒ„(์—…๋งํฌ ์„œ๋ฒ„)๋กœ ์ „๋‹ฌํ•œ๋‹ค.
์—…๋งํฌ ์„œ๋ฒ„๋Š” ํŠน์ • ๋„๋ฉ”์ธ์— ๋Œ€ํ•œ ์ฟผ๋ฆฌ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด ์ƒ์œ„ ๊ณ„์ธต์˜ DNS ์„œ๋ฒ„์— ๋‹ค์‹œ ์ฟผ๋ฆฌ๋ฅผ ๋ณด๋‚ด๋Š” ์—ญํ• ์„ ํ•œ๋‹ค.
๋กœ์ปฌ์—์„œ ๋ฐ›์€ ์‘๋‹ต์€ Resolver์— ์˜ํ•ด ์บ์‹œ๋˜์–ด ๋‹ค์Œ์— ๋™์ผํ•œ ์ฟผ๋ฆฌ๊ฐ€ ์žˆ์„ ๋•Œ ๋น ๋ฅธ ์‘๋‹ต์„ ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•œ๋‹ค.

  • ์‚ฌ์šฉ์ž๊ฐ€ "www.example.com"์— ๋Œ€ํ•œ DNS ์ฟผ๋ฆฌ๋ฅผ ํ•˜๋ฉด ๋กœ์ปฌ DNS Resolver๊ฐ€ ์ด๋ฅผ ๋ฐ›๋Š”๋‹ค.
  • Uplink ๋ชจ๋“œ์—์„œ๋Š” Resolver๊ฐ€ "www.example.com"์— ๋Œ€ํ•œ DNS ์ •๋ณด๋ฅผ ์ƒ์œ„ ๋ ˆ๋ฒจ DNS ์„œ๋ฒ„๋กœ ์ „๋‹ฌํ•œ๋‹ค.
  • ์ƒ์œ„ DNS ์„œ๋ฒ„๋Š” "www.example.com"์˜ IP ์ฃผ์†Œ๋ฅผ ์•Œ๋ ค์ฃผ๊ณ , ์ด ์‘๋‹ต์€ ๋กœ์ปฌ DNS Resolver์— ์บ์‹œ๋œ๋‹ค.

Stub Mode:
๊ธฐ๋ณธ์ ์œผ๋กœ /etc/resolv.conf๋Š” ๋กœ์ปฌ ํ˜ธ์ŠคํŠธ ์Šคํ…(Stub) ๋ฆฌ์กธ๋ฒ„๋ฅผ ๊ฐ€๋ฆฌํ‚จ๋‹ค. systemd-resolved์—์„œ DNSStubListener=yes๊ฐ€ ๊ธฐ๋ณธ๊ฐ’์ธ ๊ฒƒ์ด ์ด์— ํ•ด๋‹นํ•˜๋ฉฐ, ์ด๋Š” ๋กœ์ปฌ์—์„œ DNS ์ฟผ๋ฆฌ๋ฅผ ์ˆ˜์‹ ํ•˜๋Š” ์—ญํ• ์„ ํ•œ๋‹ค. Stub ๋ฆฌ์กธ๋ฒ„๋Š” ์—…๋งํฌ ๋ชจ๋“œ์™€ ๋‹ฌ๋ฆฌ ์ƒ์œ„ ๊ณ„์ธต์˜ DNS ์„œ๋ฒ„์— ์ฟผ๋ฆฌ๋ฅผ ์ง์ ‘ ๋ณด๋‚ด์ง€ ์•Š๊ณ  ์ง€์ •ํ•œ DNS ์„œ๋ฒ„๋กœ ๋ฐ”๋กœ ์ฟผ๋ฆฌ๋ฅผ ๋ณด๋‚ธ๋‹ค. ์ฆ‰, Stub ๋ชจ๋“œ์—์„œ๋Š” ๋กœ์ปฌ์—์„œ DNS ์ฟผ๋ฆฌ๋ฅผ ์ฒ˜๋ฆฌํ•˜๋ฉฐ, ์ด๋ฅผ ํŠน์ • ์™ธ๋ถ€ DNS ์„œ๋ฒ„๋กœ ๋ฐ”๋กœ ์ „๋‹ฌํ•œ๋‹ค. ์ด๋ฅผ ๋ณ€๊ฒฝํ•˜๋ ค๋ฉด ๋‹ค๋ฅธ ๋‚ด์šฉ์œผ๋กœ ํŒŒ์ผ์„ ๋‹ค์‹œ ๋งŒ๋“ค๊ฑฐ๋‚˜ ๋กœ์ปฌ ํ˜ธ์ŠคํŠธ ์Šคํ… ๋ฆฌ์กธ๋ฒ„๊ฐ€ ์•„๋‹Œ ๋‹ค๋ฅธ ๊ณณ์„ ๊ฐ€๋ฆฌํ‚ค๋„๋ก ํ•ด์•ผํ•œ๋‹ค.

  • ์‚ฌ์šฉ์ž๊ฐ€ "www.example.com"์— ๋Œ€ํ•œ DNS ์ฟผ๋ฆฌ๋ฅผ ํ•˜๋ฉด ๋กœ์ปฌ DNS Resolver๊ฐ€ ์ด๋ฅผ ๋ฐ›๋Š”๋‹ค.
  • Stub ๋ชจ๋“œ์—์„œ๋Š” Resolver๊ฐ€ "www.example.com"์— ๋Œ€ํ•œ DNS ์ •๋ณด๋ฅผ ์‚ฌ์šฉ์ž๊ฐ€ ์ง€์ •ํ•œ ์™ธ๋ถ€ DNS ์„œ๋ฒ„(์˜ˆ: 8.8.8.8)๋กœ ์ „๋‹ฌํ•œ๋‹ค.
  • ์™ธ๋ถ€ DNS ์„œ๋ฒ„(์Šคํ… ์„œ๋ฒ„)๋Š” "www.example.com"์˜ IP ์ฃผ์†Œ๋ฅผ ์•Œ๋ ค์ฃผ๊ณ , ์ด ์‘๋‹ต์€ ๋กœ์ปฌ DNS Resolver์— ์บ์‹œ๋œ๋‹ค.

์ฆ‰, Uplink Mode์—์„œ๋Š” ์ƒ์œ„ DNS ์„œ๋ฒ„๋กœ์˜ ์ „๋‹ฌ์ด ์ฃผ์š”ํ•œ ์—ญํ• ์ด๋ฉฐ, Stub Mode์—์„œ๋Š” ํŠน์ • ์™ธ๋ถ€ DNS ์„œ๋ฒ„๋กœ์˜ ์ „๋‹ฌ์ด ์ฃผ์š”ํ•œ ์—ญํ• ์ด๋‹ค.

ํ˜„์žฌ DNS Resolver ๋ชจ๋“œ๋ฅผ ํ™•์ธํ•˜๋ ค๋ฉด

~$ resolvectl

Global
       Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub --------> ํ˜„์žฌ ๋ชจ๋“œ
     DNS Servers: 8.8.8.8 -----> resolved.conf์— ์ •์˜ํ•œ nameserver

์„œ๋ฒ„ ์žฌ๋ถ€ํŒ… ์ดํ›„์—๋„ resolv.conf ํŒŒ์ผ์ด ์ง€์ •ํ•œ DNS ์„œ๋ฒ„๋ฅผ ํฌํ•จํ•˜๊ฒŒ ํ•˜๋ ค๋ฉด

์„œ๋ฒ„๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ•˜๋ฉด ์‚ฌ์šฉ์ž ์ง€์ • DNS ์„œ๋ฒ„ ์ฃผ์†Œ๊ฐ€ ์žˆ๋Š” resolv.conf ํŒŒ์ผ์— ๋Œ€ํ•œ ์ˆ˜๋™ ์ˆ˜์ • ๋‚ด์šฉ์ด ์†์‹ค๋œ๋‹ค. ์žฌ๋ถ€ํŒ… ์‹œ resolv.conf ํŒŒ์ผ์ด dhclient ํŒŒ์ผ์— ์ง€์ •ํ•œ DNS ์„œ๋ฒ„๋งŒ ํฌํ•จํ•˜๋„๋ก ์—…๋ฐ์ดํŠธ ํ•ด์•ผ ํ•œ๋‹ค.

(1) /etc/dhcp/dhclient.conf ํŒŒ์ผ์„ ํŽธ์ง‘ํ•˜๊ฑฐ๋‚˜ ๋งŒ๋“ ๋‹ค

(2) ๋„๋ฉ”์ธ ์ด๋ฆ„ ์„œ๋ฒ„๋ฅผ ์žฌ์ •์˜ํ•˜๊ธฐ ์œ„ํ•ด ํŒŒ์ผ์— supersede ๋ช…๋ น์„ ์ถ”๊ฐ€ํ•˜๊ณ  xxx.xxx.xxx.xxx ๋ถ€๋ถ„์„ ๋ณ€๊ฒฝํ•œ๋‹ค.

supersede domain-name-servers xxx.xxx.xxx.xxx, xxx.xxx.xxx.xxx;

(3) ์ˆ˜์ • ํ›„ ์žฌ๋ถ€ํŒ… ์‹œ resolv.conf ํŒŒ์ผ์ด dhclient ํŒŒ์ผ์— ์ง€์ •ํ•œ DNS ์„œ๋ฒ„๋งŒ ํฌํ•จํ•˜๋„๋ก ์—…๋ฐ์ดํŠธ ํ•œ๋‹ค

(4) ์ธํ„ฐํŽ˜์ด์Šค๋ณ„ ๊ตฌ์„ฑํŒŒ์ผ(/etc/sysconfig/network-scripts/ifcfg-) ์—์„œ PEERDNS ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ yes๋กœ ์„ค์ •

(5) ์žฌ๋ถ€ํŒ…

--- ๋˜๋Š” ---

(1) /etc/sysconfig/network-scripts/ifcfg-eth0 ํŒŒ์ผ์—์„œ DNS1, DNS2์— ์›ํ•˜๋Š” ๋„ค์ž„์„œ๋ฒ„ ์ฃผ์†Œ๋ฅผ ํฌํ•จํ•œ๋‹ค

DEVICE=eth0
BOOTPROTO=dchp
[..]
DNS1=8.8.8.8
DNS2=8.8.4.4

(2) ์ธํ„ฐํŽ˜์ด์Šค๋ณ„ ๊ตฌ์„ฑํŒŒ์ผ(/etc/sysconfig/network-scripts/ifcfg-) ์—์„œ PEERDNS ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ yes๋กœ ์„ค์ •

๋งŒ์ผ Ubuntu 20.04 ์ด์ „ ๋ฒ„์ „์˜ netplan.io ์ผ ๊ฒฝ์šฐ, DNS ์„œ๋ฒ„ ๊ฐ’์„ ์žฌ์ •์˜ํ•˜๋ ค๋ฉด ์•„๋ž˜์˜ ๋‹จ๊ณ„๊ฐ€ ํ•„์š”ํ•˜๋‹ค
(1) Netplan์€ ์ผ๋ฐ˜์ ์œผ๋กœ /etc/netplan ๋””๋ ‰ํ† ๋ฆฌ์— ๊ตฌ์„ฑ ํŒŒ์ผ์„ ์ €์žฅํ•œ๋‹ค.

(2) /etc/netplan/99-custom-dns.yaml ํŒŒ์ผ์„ ์ƒ์„ฑํ•œ ๋‹ค์Œ ํ”Œ๋ ˆ์ด์Šคํ™€๋” DNS ์„œ๋ฒ„ IP๋ฅผ ์›ํ•˜๋Š” ์ฃผ์†Œ๋กœ ๋ณ€๊ฒฝํ•œ๋‹ค. (์ธํ„ฐํŽ˜์ด์Šค ์ด๋ฆ„ ํ™•์ธ์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ ip a)

network:
  version: 2
  ethernets:
    ens5: ------------> ์ธํ„ฐํŽ˜์ด์Šค ํ™•์ธํ•  ๊ฒƒ
      nameservers:
        addresses: [1.1.1.1, 1.0.0.1] ---> ์ด๋ถ€๋ถ„์„ ์›ํ•˜๋Š” ์ฃผ์†Œ๋กœ ๋ณ€๊ฒฝํ•œ๋‹ค
      dhcp4-overrides:
        use-dns: false
        use-domains: false

(3) ๋‹ค์Œ์˜ ๋ช…๋ น์„ ์‹คํ–‰ํ•œ๋‹ค.

netplan generate

(4) ์ด๋ ‡๊ฒŒ ๋ณ€๊ฒฝํ•œ ์ดํ›„์—๋„ /etc/resolve.conf์— ์—ฌ์ „ํžˆ ์Šคํ… ๋ฆฌ์กธ๋ฒ„ ip๊ฐ€ ํ‘œ์‹œ๋˜๋ฉฐ ์˜ˆ์ƒ๋œ ๊ฒฐ๊ณผ์ด๋‹ค. ์Šคํ… ๋ฆฌ์กธ๋ฒ„ IP๋Š” ์šด์˜ ์ฒด์ œ์— ๋กœ์ปฌ์ด๋‹ค. ๋ฐฑ๊ทธ๋ผ์šด๋“œ์—์„œ ์Šคํ… ๋ฆฌ์กธ๋ฒ„๋Š” ์•ž์˜ 99-custom-dns.yaml ํŒŒ์ผ์— ์ง€์ •ํ•œ DNS ์„œ๋ฒ„๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.

(5) ์ธ์Šคํ„ด์Šค ์žฌ๋ถ€ํŒ…

(6) systemd-resolve ๋ช…๋ น์„ ์‹คํ–‰ํ•˜์—ฌ ์‹œ์Šคํ…œ์ด ์˜๋„ํ•œ DNS ์„œ๋ฒ„ IP ์ฃผ์†Œ๋ฅผ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ˆ˜์‹ ํ•˜๋Š”์ง€ ํ™•์ธํ•œ๋‹ค

systemd-resolve --status

References:

๋ฐ˜์‘ํ˜•