๊ตญ๋‚ด ๊ฐœ๋ฐœ์ž ์ปค๋ฎค๋‹ˆํ‹ฐ์— ์ž๋ฐ” ๊ฐœ๋ฐœ์ž๊ฐ€ ์•Œ์•„์•ผํ•  DNS๋ผ๋Š” ์ง€์‹์„ ๊ณต์œ ํ–ˆ๋˜ ๊ฒƒ์„ ์ด์–ด์„œ DNS ์‹ค์ „ ๊ต๊ณผ์„œ๋ผ๋Š” ์ฑ…์„ ์ฝ์–ด๋ณด๊ณ  ์กฐ๊ธˆ ๋” DNS์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ์ฐพ์•„์„œ ์ •๋ฆฌํ•ด๋ณผ๊นŒ ํ•ฉ๋‹ˆ๋‹ค. GeekNews ์— ๊ณต์œ ๋œ DNS ํ•™์Šต์ด ์™œ ์—ฌ์ „ํžˆ ์–ด๋ ค์šด๊ฐ€์š”?๋ผ๋Š” ๊ธ€์ฒ˜๋Ÿผ ์›น ๊ฐœ๋ฐœ์ž๋กœ์จ DNS์— ๋Œ€ํ•ด์„œ ๋ฌด์—‡์„ ์–ด๋””๊นŒ์ง€ ์•Œ๊ณ  ์žˆ์–ด์•ผ ํ•˜๋Š”์ง€ ์•Œ๊ธฐ ์–ด๋ ค์šด ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

DNS ์กฐํšŒ ์‹คํŒจ๋กœ ์ธํ•œ IP ์ฃผ์†Œ ํ™•์ธ ๋ถˆ๊ฐ€

SdkClientException: Received an UnknownHostException when attempting to interact with a service.
See cause for the exact endpoint that is failing to resolve.
If this is happening on an endpoint that previously worked,
there may be a network connectivity issue or your DNS cache could be storing endpoints for too long.

Amazon SQS์— ๋Œ€ํ•œ DNS ์บ์‹œ๊ฐ€ ์ดˆ๊ธฐํ™”๋˜๋Š” ์‹œ์ ์— ์‚ฌ๋‚ด ๋„คํŠธ์›Œํฌ ์‚ฌ์šฉ๋Ÿ‰์˜ ๊ณผ๋ถ€ํ•˜๋กœ ์ธํ•˜์—ฌ์‚ฌ๋‚ด ๋ผ์šฐํ„ฐ๋ฅผ ํ†ตํ•œ DNS ์กฐํšŒ๋ฅผ ํ•  ์ˆ˜ ์—†์–ด์„œ SQS์— ๋Œ€ํ•œ ์—”๋“œํฌ์ธํŠธ ์ฃผ์†Œ๋ฅผ ์•Œ ์ˆ˜ ์—†๋Š” ์ด์Šˆ๊ฐ€ ๋ฐœ์ƒํ•œ ๊ฒฝ์šฐ๊ฐ€ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์•„๋ž˜์™€ ๊ฐ™์ด DNS ์ด์Šˆ์— ๋Œ€ํ•œ ๋Œ€์‘์— ๋Œ€ํ•œ ์ •๋ณด๋„ ์ฐพ์•„๋ณผ ์ˆ˜ ์žˆ์—ˆ์–ด์š”.

Amazon Route53 ๋ ˆ์ฝ”๋“œ ๊ด€๋ฆฌ

์ €๋Š” ์ฃผ๋กœ Amazon Route53์— ์„œ๋ฒ„์— ๋Œ€ํ•œ IP ์ฃผ์†Œ ๋˜๋Š” ๋ณ„์นญ์œผ๋กœ A ๋ ˆ์ฝ”๋“œ๋ฅผ ๋“ฑ๋กํ•˜๊ณ  ์ด๋ฏธ ๋“ฑ๋ก๋œ ์„œ๋ฒ„์— ๋Œ€ํ•ด ๋ณ„์นญ์„ ์ถ”๊ฐ€๋กœ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ CNAME ๋ ˆ์ฝ”๋“œ๋ฅผ ๋“ฑ๋กํ•˜๊ฒŒ ๋˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๊ฐœ์ธ์ ์œผ๋กœ GoDaddy์—์„œ ๊ตฌ๋งคํ•œ kdev.ing ๋„๋ฉ”์ธ์— ๋Œ€ํ•œ ๋„ค์ž„ ์„œ๋ฒ„๋กœAmazon Route53์„ ๋“ฑ๋กํ•˜๊ฒŒ ๋˜๋ฉด 1๋‹ฌ๋Ÿฌ์˜ ์„ธ๊ธˆ์ด ๋ฐœ์ƒํ•˜๋ฏ€๋กœ ๋ณ€๊ฒฝํ•˜์ง€ ์•Š์€ ์ƒํƒœ๋กœ Github Pages ๋ฅผ ์—ฐ๊ฒฐํ•ด์„œ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๊ธฐ๋„ ํ•ฉ๋‹ˆ๋‹ค.

์ด๋ฉ”์ผ ๋ณด์•ˆ์„ ์œ„ํ•œ SPF, DKIM, DMARC

์„œ๋ฒ„ ์—”์ง€๋‹ˆ์–ด ํ˜น์€ ์ธํ”„๋ผ ํŒ€์ด ๋ณ„๋„๋กœ ์กด์žฌํ•˜๋Š” ์กฐ์ง์ด ์•„๋‹ˆ๋ผ๋ฉด ๊ฐœ๋ฐœ์ž๊ฐ€ ์ด๋ฉ”์ผ ๋ฐœ์†ก ์‹œ ์‹ ๋ขฐํ•  ์ˆ˜ ์žˆ๋Š” ๋„๋ฉ”์ธ์„ ์„ค์ •ํ•˜๋Š” ์ž‘์—…์„ ์ง„ํ–‰ํ•ด์•ผํ•  ์ˆ˜ ์žˆ์–ด์š”. ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ์ €๋Š” ์ž‘์€ ๊ทœ๋ชจ์— ์†ํ•œ ์ฃผ๋‹ˆ์–ด ๊ฐœ๋ฐœ์ž์˜€๊ธฐ์— ์‚ฌ๋‚ด ๋ฉ”์ผ ์„œ๋ฒ„์—์„œ Amazon SES๋ฅผ ํ†ตํ•ด ์ด๋ฉ”์ผ์„ ๋ณด๋‚ด๊ธฐ ์œ„ํ•ด์„œ DMARC, DKIM, SPF๋ฅผ ์„ค์ •ํ–ˆ์—ˆ๋˜ ์ ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ๋งŒ์•ฝ, ์ด๋ฉ”์ผ ๋ณด์•ˆ์„ ์œ„ํ•ด์„œ DMARC๋ฅผ ์ ์šฉํ•˜๊ณ ์ž ํ•œ๋‹ค๋ฉด ์•„๋ž˜์™€ ๊ฐ™์€ ๊ธ€๋“ค์„ ์ฐธ๊ณ ํ•ด๋„ ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

์ธํ„ฐ๋„ท ์†๋„๋ฅผ ๋น ๋ฅด๊ฒŒ ํ•˜๋Š” ๋ฐฉ๋ฒ• ๐Ÿ˜ช

์ผ๋ฐ˜์ ์œผ๋กœ ์ธํ„ฐ๋„ท ์†๋„๋ฅผ ๋น ๋ฅด๊ฒŒ ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์ฐพ์•„๋ณด๋ฉด DNS ์„ค์ •์„ ๋ณ€๊ฒฝํ•˜๊ฑฐ๋‚˜ DNS ์บ์‹œ๋ฅผ ๋น„์šฐ๋Š” ๊ฑธ ์ถ”์ฒœํ•˜๋Š”๋ฐ์š”. ISP ํ†ต์‹  ์‚ฌ์—…์ž์˜ DNS ๋Œ€์‹ ์— ํด๋ผ์šฐ๋“œ ํ”Œ๋ ˆ์–ด์˜ 1.1.1.1๋กœ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฑด ๋ณ„ ๋‹ค๋ฅธ ์˜๋ฏธ๊ฐ€ ์—†์ฃ . ๊ฐœ๋ฐœ์ž ์ž…์žฅ์—์„œ๋Š” ์ฐธ๊ณ ํ•ด์•ผํ•  ์ •๋ณด๋“ค์ด ํ•ด์™ธ ์‚ฌ์ดํŠธ์—์„œ ์ฐพ๊ฒŒ๋˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์€๋ฐ, ์ €๋Š” ์ผ๋ถ€ HTTPS ์ ‘๊ทผ์„ ์ฐจ๋‹จํ•˜๋Š” ๊ฒƒ์„ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด์„œ ์œ ๋‹ˆ์ฝ˜ HTTPS์™€ ๊ฐ™์€ DNS ๋ณ€๊ฒฝ ์†Œํ”„ํŠธ์›จ์–ด๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

DNS ์บ์‹œ ๋น„์šฐ๊ธฐ

๋ฆฌ๋ˆ…์Šค ์„œ๋ฒ„์—์„œ๋Š” ์บ์‹œ๋œ DNS ์ •๋ณด๊ฐ€ ์†์ƒ๋˜๊ฑฐ๋‚˜ ์ž˜๋ชป๋œ ๊ฒฝ์šฐ๋กœ ํ™•์ธ๋œ๋‹ค๋ฉด DNS ์ •๋ณด๋ฅผ ์ฆ‰์‹œ ๊ฐฑ์‹ ํ•˜๊ธฐ ์œ„ํ•ด์„œ DNS ์บ์‹œ๋ฅผ ์‚ญ์ œํ•˜๋Š” ๋ช…๋ น์–ด๋ฅผ ์ฐพ์•„๋ณด๋‹ˆ resolvectl ๋˜๋Š” systemd-service ๋ฅผ ํ†ตํ•ด DNS ์บ์‹œ๋ฅผ ์‚ญ์ œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Terminal
# sudo systemd-service --flush-caches sudo resolvectl flush-caches # sudo systemd-resolve --statistics sudo resolvectl statistics

Local DNS Resolver

๋Œ€๋ถ€๋ถ„์˜ ๋ฆฌ๋ˆ…์Šค์—์„œ๋Š” systemd-resolved ๋ฅผ DNS Resolver๋กœ ์‚ฌ์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— /etc/resolv.conf ์—๋Š” 127.0.0.53 ์ด ์„ค์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  DNS resolution ๋ฐ resolv.conf ์— ๋Œ€ํ•œ ์ดํ•ด๋ผ๋Š” ๊ธ€์„ ํ†ตํ•ด DNS ๋ฆฌ์กธ๋ฒ„์—์„œ IP ์ฃผ์†Œ๋ฅผ ์ฟผ๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด์„œ ์‚ฌ์šฉํ•  DNS ์„œ๋ฒ„๋ฅผ ์„ค์ •ํ•˜๋Š” ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. AWS EC2๋Š”VPC์˜ ๊ฒŒ์ดํŠธ์›จ์ด(CIDR ๋Œ€์—ญ์—์„œ .2)๋ฅผ DNS Resolver๋กœ ์‚ฌ์šฉํ•˜๋„๋ก ์„ค์ •๋˜์–ด ์žˆ๋„ค์š”.

/etc/resolv.conf
[ec2-user@tsdb ~]$ cat /etc/resolv.conf nameserver 192.168.0.2 search ap-northeast-2.compute.internal

์‹ค๋ฌด์—์„œ๋Š” AWS ํด๋ผ์šฐ๋“œ๋ฅผ ๋งŽ์ด ํ™œ์šฉํ•˜๋Š” ๋งŒํผ Amazon Route 53 Resolver์— ๋Œ€ํ•ด์„œ ์ข€ ๋” ํ•™์Šตํ•ด๋ด์•ผํ•  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๊ทธ๋™์•ˆ AWS ์ธํ”„๋ผ๋ฅผ ํ™œ์šฉํ•ด์™”์ง€๋งŒ VPC ๋‚ด์—์„œ ์–ด๋–ป๊ฒŒ DNS ์ฟผ๋ฆฌ๋ฅผ ์ˆ˜ํ–‰ํ•˜๊ณ  ๊ด€๋ฆฌํ•˜๋Š”์ง€ ์ƒ๊ฐํ•ด๋ณธ์ ์€ ์—†์—ˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.