0%

๐Ÿ›ต Route53 Geolocation

์ž‘์„ฑ์ž : gasida.cloudnet@


AWS Document Route53
  • Route53 ์„ค๋ช…์„œ
  • Route53 ๋“ฑ๋ก ๊ฐ€๋Šฅ ๋„๋ฉ”์ธ
  • Route53 ๋ผ์šฐํŒ… ์ •์ฑ…
  • Amazon Route 53์—์„œ EDNS0์„ ์‚ฌ์šฉํ•˜์—ฌ ์‚ฌ์šฉ์ž์˜ ์œ„์น˜๋ฅผ ์˜ˆ์ธกํ•˜๋Š” ๋ฐฉ๋ฒ•
  • Route53 ์ ๊ฒ€๋ฐฉ๋ฒ•1
  • Route53 ์ ๊ฒ€๋ฐฉ๋ฒ•2
  • Route53 ์ฟผ๋ฆฌ ๋กœ๊น… ์„ค์ •

DNS GeoLocation ๋ฐ ๊ธฐํƒ€
  • DNS ์™€ CDN ์˜ ๋™์ž‘ (๋„ท๋งค๋‹ˆ์•„์ฆˆ 2011)
  • RFC 7871 - Client Subnet in DNS Queries
  • Windows DNS - ์œ„์น˜๊ธฐ๋ฐ˜
  • IP ๋กœ ์œ„์น˜ ์ฐพ๊ธฐ
  • Public DNS List
  • DNS Cache check (OpenDNS)

๐Ÿ’ก AWS ์„œ๋น„์Šค ๊ด€๋ จํ•ด์„œ๋Š” ํ•ญ์ƒ ์ตœ์šฐ์„ ์œผ๋กœ โ€˜AWS ์„ค๋ช…์„œโ€™ ๋ฅผ ์ฝ์–ด๋ณด๋Š” ๊ฒƒ์„ ์ถ”์ฒœํ•œ๋‹ค. ํ•œ๊ธ€ ๋ฒˆ์—ญ์ด ๋งค๋„๋Ÿฝ์ง€ ๋ชปํ•˜๋ฉด English ๋กœ ๋ณ€๊ฒฝ ํ›„ ์ฝ์–ด๋ณด๊ธฐ๋ฅผ ๋ฐ”๋ž€๋‹ค.



1. AWS Route 53 & Geolocation Routing Policy

  • AWS Route 53 ์€ AWS ๊ด€๋ฆฌํ˜•์˜ DNS(Domain Name Server) ์ด๋‹ค.
    • Hosted private or public zones (including subdomains)
    • Health checks, routing policies and failovers
  • ๋„๋ฉ”์ธ ๋“ฑ๋ก, DNS ๋ผ์šฐํŒ…, ์ƒํƒœ ํ™•์ธ์„ ์กฐํ•ฉํ•˜์—ฌ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋‹ค.

1.1 Amazon Route 53์ด ๋„๋ฉ”์ธ์˜ ํŠธ๋ž˜ํ”ฝ์„ ๋ผ์šฐํŒ…ํ•˜๋Š” ๋ฐฉ๋ฒ•

  • ์‚ฌ์šฉ์ž๊ฐ€ ์›น ์„œ๋ฒ„์— ์ ‘์† ์‹œ DNS ์„œ๋ฒ„๋ฅผ ํ†ตํ•˜์—ฌ ๋„๋ฉ”์ธ ์ฃผ์†Œ๋ฅผ IP ์ฃผ์†Œ๋กœ ์ „๋‹ฌ ๋ฐ›์€ ํ›„ ํ•ด๋‹น IP๋กœ ์ ‘์†์„ ํ•œ๋‹ค

    Route53%20Geolocation%20247d8a8c113e42e29a751d6e98ff864f/Untitled.png

    ๊ทธ๋ฆผ ์ถœ์ฒ˜ https://amzn.to/3aDOdzK


1.2 Geolocation Routing Policy

  • EDNS ๋ฅผ ์ง€์›ํ•˜๋Š” Local DNS ์„œ๋ฒ„์— ๋”ฐ๋ผ์„œ ๋™์ž‘ ๋ฐฉ์‹์ด ๋‹ฌ๋ผ์ง„๋‹ค

1.2.1 Local DNS ์„œ๋ฒ„๊ฐ€ EDNS ๋ฅผ ๋ฏธ์ง€์› ํ•˜๋Š” ๊ฒฝ์šฐ

  • Geolocation ์ •์ฑ…์€ ๊ธฐ๋ณธ์ ์œผ๋กœ DNS ์งˆ์˜(Query)๋ฅผ ํ•˜๋Š” Local DNS Server(์˜ˆ, KT DNS ๋“ฑ)์˜ IP์˜ ์œ„์น˜๋ฅผ ๊ธฐ๋ฐ˜ํ•˜์—ฌ AWS Route 53์— ์ง€์ •๋œ IP ์ •๋ณด๋ฅผ ์ „๋‹ฌ(Answer)ํ•œ๋‹ค

  • ์•„๋ž˜์ฒ˜๋Ÿผ ํ•œ๊ตญ์— PC์—์„œ ํ•œ๊ตญ DNS์„œ๋ฒ„(168.126.63.1)๋กœ www.gsida.net ์งˆ์˜ ์‹œ ํ•œ๊ตญ DNS์„œ๋ฒ„๋Š” ์ž์‹ ์˜ IP๋กœ AWS Route53์— ์งˆ์˜ํ•˜๊ฒŒ ๋œ๋‹ค.

  • ์ด๋•Œ Route53์€ ํ•œ๊ตญDNS ์„œ๋ฒ„์˜ IP๋ฅผ ํ™•์ธํ•˜๊ณ  ์œ„์น˜๊ฐ€ ํ•œ๊ตญ์ธ ๊ฒƒ์„ ์•Œ๊ณ  Seoul-Web ์˜ IP์ •๋ณด์ธ 60.1.1.1 ์„ ์ „๋‹ฌํ•œ๋‹ค.

    Route53%20Geolocation%20247d8a8c113e42e29a751d6e98ff864f/Untitled%201.png

1.2.2 Local DNS ์„œ๋ฒ„๊ฐ€ EDNS ๋ฅผ ์ง€์› ํ•˜๋Š” ๊ฒฝ์šฐ

  • DNS ์„œ๋ฒ„(์˜ˆ. ๊ตฌ๊ธ€DNS 8.8.8.8)๊ฐ€ ENDS ๋ฅผ ์ง€์›ํ•˜๋Š” ๊ฒฝ์šฐ ์‚ฌ์šฉ์ž๊ฐ€ DNS ์งˆ์˜ ์‹œ ์‚ฌ์šฉ์ž์˜ IP๋Œ€์—ญ์„ DNS ํ™•์žฅ ํ—ค๋”์— ๋‹ด์•„์„œ AWS Route 53์— ์งˆ์˜๋ฅผ ํ•˜๊ฒŒ ๋œ๋‹ค.

  • AWS Route 53 ์—ญ์‹œ EDNS ๋ฅผ ์ง€์›ํ•˜๋ฏ€๋กœ DNS ํ™•์žฅ ํ—ค๋”์˜ Client-Subnet ์˜ ๋Œ€์—ญ์˜ IP์˜ ์œ„์น˜๋ฅผ ๊ธฐ์ค€ํ•˜์—ฌ ๊ฒฐ์ •ํ•œ๋‹ค

    Route53%20Geolocation%20247d8a8c113e42e29a751d6e98ff864f/Untitled%202.png



2. DNS ๋™์ž‘์— ๋Œ€ํ•œ ์˜คํ•ด

  • DNS ์„œ๋ฒ„๋กœ ๋ฐ์ดํ„ฐ ํŠธ๋ž˜ํ”ฝ(์›น ํŠธ๋ž˜ํ”ฝ)์ด ์ „๋‹ฌ ๋œ๋‹ค.
    • ๐Ÿ™…๐Ÿปโ€โ™€๏ธNo! ์œ„ ๊ทธ๋ฆผ ๋™์ž‘์„ ๋ณด๋ฉด ์•Œ๊ฒ ์ง€๋งŒ DNS ํŠธ๋ž˜ํ”ฝ์€ ์‚ฌ๋žŒ์ด ์•Œ๊ธฐ ์‰ฌ์šด โ€˜๋„๋ฉ”์ธ ์ฃผ์†Œ(์˜ˆ. www.daum.net)' ์— ๋Œ€ํ•œ โ€˜IP ์ฃผ์†Œโ€™๋ฅผ ์•Œ์•„์˜ค๋Š” ๊ณผ์ •์ด๋‹ค.
    • ์‹ค์ œ โ€˜IP์ฃผ์†Œโ€™ ๋ฅผ ์•Œ์•„์˜จ ์ดํ›„์—๋Š” ํ•ด๋‹น ๋‹จ๋งPC์—์„œ โ€˜์›น์„œ๋ฒ„ IPโ€™ ๋กœ ์ง์ ‘ ๋ฐ์ดํ„ฐ ํŠธ๋ž˜ํ”ฝ(์›น ํŠธ๋ž˜ํ”ฝ) ํ†ต์‹ ์„ ์‹œ์ž‘ํ•œ๋‹ค.
  • DNS ์„œ๋ฒ„๋Š” ์‚ฌ์šฉ์ž์˜ IP๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ์ •ํ™•ํ•œ ์œ„์น˜๋ฅผ ์•Œ ์ˆ˜ ์žˆ๋‹ค.
    • ๐Ÿ™…๐Ÿปโ€โ™€๏ธ๊ผญ ๊ทธ๋ ‡์ง€๋งŒ์€ ์•Š๋Š”๋‹ค. ์˜ˆ๋ฅผ ๋“ค๋ฉด ํ•œ๊ตญ์— ๋‹จ๋งPC์— ๋ฏธ๊ตญDNS์„œ๋ฒ„๋ฅผ ์„ค์ •ํ•˜๊ฒŒ ๋˜๋ฉด DNS์งˆ์˜ ์‹œ ๋ฏธ๊ตญDNS์„œ๋ฒ„ IP์ด๋ฏ€๋กœ ๋ฏธ๊ตญ์›น์„œ๋ฒ„ IP๋ฅผ ์•Œ๋ ค์ค€๋‹ค.
    • ์ฆ‰, Geolocation ์˜ ๊ธฐ๋ณธ ๋™์ž‘์€ ์ตœ์ข… DNS Query ํ•˜๋Š” ์†Œ์ŠคIP์˜ ์œ„์น˜(์ผ๋ฐ˜์ ์ธ ๋กœ์ปฌDNS์„œ๋ฒ„)๋ฅผ ๊ธฐ๋ฐ˜ํ•˜์—ฌ โ€˜IP์ฃผ์†Œโ€™ ๊ฐ’์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค
  • ๊ทธ๋Ÿผ ์‚ฌ์šฉ์ž์˜ IP๋ฅผ ์•Œ ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์ด ์—†๋‚˜์š”?
    • ๊ทธ๋ž˜์„œ DNS์— ํ™•์žฅ ํ•„๋“œ EDNS ์— Client Subnet ํ•„๋“œ๋ฅผ ํ†ตํ•ด์„œ โ€˜์ตœ์ข… ์‚ฌ์šฉ์žโ€™์˜ IP ๋Œ€์—ญ ์ •๋ณด๋ฅผ ์ „๋‹ฌํ•จ์œผ๋กœ์จ DNS์„œ๋ฒ„๊ฐ€ ์‚ฌ์šฉ์ž์˜ ์œ„์น˜๋ฅผ ์•Œ ์ˆ˜ ์žˆ๋‹ค


3. Lab Topology

  • Route 53 DNS - GeoLocation Policy โ†’ geolo.gasida.net

    • Query IP๊ฐ€ ํ•œ๊ตญ ์ผ ๊ฒฝ์šฐ โ†’ ํ•œ๊ตญ ์œ„์น˜ํ•œ ์›น์„œ๋ฒ„ IP ์ •๋ณด๋ฅผ ์ „๋‹ฌ
    • Query IP๊ฐ€ ๋ฏธ๊ตญ ์ผ ๊ฒฝ์šฐ โ†’ ๋ฏธ๊ตญ ์œ„์น˜ํ•œ ์›น์„œ๋ฒ„ IP ์ •๋ณด๋ฅผ ์ „๋‹ฌ
  • ๋‹จ๋ง

    • ํ•œ๊ตญ ์œ„์น˜ ๋‹จ๋ง : IP์ฃผ์†Œ(ํ•œ๊ตญ ์œ„์น˜ IP), DNS์„œ๋ฒ„(ํ•œ๊ตญ ์œ„์น˜ํ•œ DNS ์„œ๋ฒ„ IP)

    • ๋ฏธ๊ตญ ์œ„์น˜ ๋‹จ๋ง : IP์ฃผ์†Œ(๋ฏธ๊ตญ ์œ„์น˜ IP), DNS์„œ๋ฒ„(๋ฏธ๊ตญ ์œ„์น˜ํ•œ DNS ์„œ๋ฒ„ IP)

      Route53%20Geolocation%20247d8a8c113e42e29a751d6e98ff864f/Untitled%203.png



4. Config Geolocation Policy & Logging


4.1 AWS Web EC2 ์„ค์ •

  • Seoul-Web : ์„œ์šธ๋ฆฌ์ „, Public Subnet ์— ์ƒ์„ฑ ๋ฐ ์›น ์„œ๋ฒ„ ์„ค์น˜ โ†’ EC2 Public IP 3.34.3.33
EC2 ์ƒ์„ฑ ์‹œ User Data ์— ์ž…๋ ฅ : ์›น ์„œ๋ฒ„ ์„ค์น˜, index.html ์ƒ์„ฑ
1
2
3
4
5
6
7
#!/bin/bash
AZ=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone`
IP=`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`
yum install -y httpd
service httpd start
chkconfig httpd on
echo "<html><h1>Hello from Web Server - Region ( "$AZ" ) - Private IP ( "$IP" )</h1></html>" > /var/www/html/index.html

  • Virginia-Web : ๋ฒ„์ง€๋‹ˆ์•„๋ฆฌ์ „, Public Subnet ์— ์ƒ์„ฑ ๋ฐ ์›น ์„œ๋ฒ„ ์„ค์น˜ โ†’ EC2 Public IP 18.206.97.145
EC2 ์ƒ์„ฑ ์‹œ User Data ์— ์ž…๋ ฅ : ์›น ์„œ๋ฒ„ ์„ค์น˜, index.html ์ƒ์„ฑ
1
2
3
4
5
6
7
#!/bin/bash
AZ=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone`
IP=`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`
yum install -y httpd
service httpd start
chkconfig httpd on
echo "<html><h1>Hello from Web Server - Region ( "$AZ" ) - Private IP ( "$IP" )</h1></html>" > /var/www/html/index.html

4.2 ๋‹จ๋ง ์„ค์ •

  • ํ•œ๊ตญ ์œ„์น˜ ๋‹จ๋ง : ์ž์‹ ์˜ PC๋ฅผ ํ™œ์šฉ, DNS์„œ๋ฒ„ (168.126.63.1) โ†’ 220.117.X.Y
  • ๋ฏธ๊ตญ ์œ„์น˜ ๋‹จ๋ง : ํ•„์ž๋Š” GCP ํ™œ์šฉ, DNS์„œ๋ฒ„(192.221.159.0) โ†’ 35.186.188.100
VM Instance ์ƒ์„ฑ ์‹œ ์‹œ์ž‘ ์Šคํฌ๋ฆฝํŠธ์— ์ž…๋ ฅ : DNS ๊ด€๋ จ ํˆด ์„ค์น˜, ๊ธฐ๋ณธ DNS๋ฅผ ๋ณ€๊ฒฝ
1
2
3
#!/bin/bash
yum -y install bind-utils traceroute dig jq
sed -i "s/^nameserver 169.254.169.254/nameserver 192.221.159.0/g" /etc/resolv.conf

4.3 AWS Route 53 ์„ค์ •

  • [Route 53 - ํ˜ธ์ŠคํŒ… ์˜์—ญ - ๋ ˆ์ฝ”๋“œ ์„ธํŠธ ์ƒ์„ฑ] geolo.gasida.net
ํ•œ๊ตญ ์œ„์น˜ ์‹œ ํ•œ๊ตญ ์›น์„œ๋ฒ„ ์ „๋‹ฌ ๋ ˆ์ฝ”๋“œ ์ƒ์„ฑ
- ์ด๋ฆ„: **geolo**.gasida.net
- ์œ ํ˜•: **A - IPv4 ์ฃผ์†Œ**
- ๋ณ„์นจ: **์•„๋‹ˆ์š”**
- TTL(์ดˆ): **300**
- ๊ฐ’: **3.34.3.33**
- ๋ผ์šฐํŒ… ์ •์ฑ…: **์ง€๋ฆฌ์  ์œ„์น˜**
    - ์œ„์น˜: **๋Œ€ํ•œ๋ฏผ๊ตญ**
    - ์„ธํŠธ ID(*์„ค๋ช…, ์ผ์ข…์˜ ์ฃผ์„*): **ํ•œ๊ตญIP๋งŒ ํ—ˆ์šฉ**
- ์ƒํƒœ ๊ฒ€์‚ฌ์™€ ์—ฐ๊ฒฐ: **์•„๋‹ˆ์š”**
    - ํ•˜๋‹จ `์ƒ์„ฑ` ํด๋ฆญ

๋ฏธ๊ตญ ์œ„์น˜ ์‹œ ํ•œ๊ตญ ์›น์„œ๋ฒ„ ์ „๋‹ฌ ๋ ˆ์ฝ”๋“œ ์ƒ์„ฑ
- ์ด๋ฆ„: **geolo**.gasida.net
- ์œ ํ˜•: **A - IPv4 ์ฃผ์†Œ**
- ๋ณ„์นจ: **์•„๋‹ˆ์š”**
- TTL(์ดˆ): **300**
- ๊ฐ’: **18.206.97.145**
- ๋ผ์šฐํŒ… ์ •์ฑ…: **์ง€๋ฆฌ์  ์œ„์น˜**
    - ์œ„์น˜: **๋ฏธ๊ตญ**
        - ํ•˜์œ„ ์œ„์น˜: skip โ†’ ๋ฏธ๊ตญ์˜ ๊ฒฝ์šฐ ์ฃผ๋ณ„๋กœ ์ œํ•œ ์„ค์ • ๊ฐ€๋Šฅ
    - ์„ธํŠธ ID(*์„ค๋ช…, ์ผ์ข…์˜ ์ฃผ์„*): **๋ฏธ๊ตญIP๋งŒ ํ—ˆ์šฉ**
- ์ƒํƒœ ๊ฒ€์‚ฌ์™€ ์—ฐ๊ฒฐ: **์•„๋‹ˆ์š”**
    - ํ•˜๋‹จ `์ƒ์„ฑ` ํด๋ฆญ
  • ์œ„์น˜๋ฅผ โ€˜๊ธฐ๋ณธ๊ฐ’โ€™ ์„ ์„ค์ •์„ ํ•ด์•ผ ์œ„ โ€˜ํ•œ๊ตญ๊ณผ ๋ฏธ๊ตญ ์œ„์น˜โ€™ ์ œ์™ธํ•œ ๋‚˜๋จธ์ง€ ๊ณณ์—์„œ ์ ‘์†์ด ๊ฐ€๋Šฅํ•˜๋‹ค โ‡’ ์ฆ‰, ์ง€๋ฆฌ์  ์ ‘์† ์ œํ•œ ๊ฐ€๋Šฅ

    Route53%20Geolocation%20247d8a8c113e42e29a751d6e98ff864f/Untitled%204.png


  • ํ•ด๋‹น ํ˜ธ์ŠคํŒ… ์˜์—ญ โ€˜์ฟผ๋ฆฌ ๋กœ๊น…โ€™ ์„ค์ •

    • [Route 53 - ํ˜ธ์ŠคํŒ… ์˜์—ญ] ๋„๋ฉ”์ธ ์„ ํƒ ํ›„ ์šฐ์ธก ํ•˜๋‹จ์— ์ฟผ๋ฆฌ ๋กœ๊น… ์„ค์ • : ๋™์ž‘ ๋ฐœ์ƒ ํ›„ 50์ดˆ ์ •๋„ ํ›„์— CloudWatch Log ๋กœ ์ˆ˜์ง‘๋œ๋‹ค

      • ์ƒˆ ๋กœ๊ทธ ๊ทธ๋ฃน ์ƒ์„ฑ : /aws/route53/hosted-zone-name (ํ•„์ž๋Š” gasida ๋กœ ์„ค์ •)
      • ์ƒˆ ๋ฆฌ์†Œ์Šค ์ •์ฑ… ์ƒ์„ฑ

      Route53%20Geolocation%20247d8a8c113e42e29a751d6e98ff864f/Untitled%205.png



5. Verify


5.1 ๊ธฐ๋ณธ ์ •๋ณด ํ™•์ธ

  • ๋‹จ๋ง : ์ž์‹ ์˜ ๊ณต์ธIP ์ •๋ณด์™€ ์œ„์น˜ ์ •๋ณด๋ฅผ ํ™•์ธ, DNS์„œ๋ฒ„ ํ™•์ธ, ์›น ์„œ๋น„์Šค ํ™•์ธ(EC2 Public IP)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    # ํ•œ๊ตญ ์œ„์น˜ ๋‹จ๋ง (์œˆ๋„์šฐ ๋‹จ๋ง์˜ ๊ฒฝ์šฐ dig ๋Œ€์‹  nslookup ์‚ฌ์šฉ)
    curl https://checkip.amazonaws.com/
    curl https://ipvigilante.com/220.117.X.Y
    curl -s https://ipvigilante.com/$(curl -s checkip.amazonaws.com) | jq '.data.country_name, .data.city_name, .data.ipv4'
    "Republic of Korea"
    "Seoul"
    "220.117.X.Y"

    dig www.google.com |grep SERVER
    ;; SERVER: 168.126.63.1#53(168.126.63.1)

    # ๋ฏธ๊ตญ ์œ„์น˜ ๋‹จ๋ง
    curl -s https://ipvigilante.com/$(curl -s checkip.amazonaws.com) | jq '.data.country_name, .data.city_name, .data.ipv4'
    "United States"
    "Ann Arbor"
    "35.245.140.130"

    dig www.google.com |grep SERVER
    ;; SERVER: 192.221.159.0#53(192.221.159.0)

    # EC2 ์›น์„œ๋น„์Šค ํ™•์ธ
    curl 3.34.3.33
    <html><h1>Hello from MCN Web Server - Seoul Area</h1></html>
    curl 18.206.97.145
    <html><h1>Hello from MCN Web Server - Virgina Area</h1></html>

5.2 geolo.gasida.net DNS์กฐํšŒ ๋ฐ ์ ‘์† ํ™•์ธ

  • ํ•œ๊ตญ ์œ„์น˜ ๋‹จ๋ง(ํ•œ๊ตญ DNS์„œ๋ฒ„)์™€ ๋ฏธ๊ตญ ์œ„์น˜ ๋‹จ๋ง(๋ฏธ๊ตญ DNS์„œ๋ฒ„)๊ฐ€ ๊ฐ๊ฐ ๊ฐ€๊นŒ์šด ์œ„์น˜์˜ ์›น ์„œ๋ฒ„๋กœ ์ ‘์†๋จ์„ ํ™•์ธ

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    # ํ•œ๊ตญ ๋‹จ๋ง (์œˆ๋„์šฐ ๋‹จ๋ง์˜ ๊ฒฝ์šฐ dig ๋Œ€์‹  nslookup ์‚ฌ์šฉ)
    curl geolo.gasida.net
    <html><h1>Hello from MCN Web Server - Seoul Area</h1></html>

    dig geolo.gasida.net +short
    3.34.3.33

    # ๋ฏธ๊ตญ ๋‹จ๋ง
    curl geolo.gasida.net
    <html><h1>Hello from MCN Web Server - Virgina Area</h1></html>

    dig geolo.gasida.net +short
    18.206.97.145
  • DNS Query Log ( ๋กœ๊ทธ๊ทธ๋ฃน๋ณด๊ธฐ, ํ•„ํ„ฐ geolo -โ€œAAAAโ€ )

    • KT DNS์„œ๋ฒ„ ์—์„œ ์†Œ์ŠคIP๋ฅผ 121.138.224.3(ํ•œ๊ตญIP) ๋กœ AWS Route53(gasida.net)๋กœ ์งˆ์˜๋ฅผ ํ–ˆ์Œ โ‡’ Seoul-Web IP ์ •๋ณด๋ฅผ ์ „๋‹ฌ

    • ๋ฏธ๊ตญ DNS์„œ๋ฒ„ ์—์„œ ์†Œ์ŠคIP๋ฅผ 192.221.159.15(๋ฏธ๊ตญIP) ๋กœ AWS Route53(gasida.net)๋กœ ์งˆ์˜๋ฅผ ํ–ˆ์Œ โ‡’ Virginia-Web IP ์ •๋ณด๋ฅผ ์ „๋‹ฌ

      Route53%20Geolocation%20247d8a8c113e42e29a751d6e98ff864f/Untitled%206.png

      1
      2
      geolo.gasida.net A NOERROR UDP ICN51-C1 (121.138.224.3 = ํ•œ๊ตญ KT IP)
      geolo.gasida.net A NOERROR UDP ATL51-C1 (192.221.159.15 = ๋ฏธ๊ตญ Lv3 LLC IP)

(์˜ต์…˜) 5.3 ํ•œ๊ตญ๊ณผ ๋ฏธ๊ตญ์ด ์•„๋‹Œ ํƒ€ ๋‚˜๋ผ์˜ ์‚ฌ์šฉ์ž์—์„œ ์ ‘์† ํ™•์ธ

ํ˜„์žฌ 'ํ•œ๊ตญ , ๋ฏธ๊ตญ' ์ด์™ธ์— ํƒ€ ๋‚˜๋ผ(์˜ˆ, ์ค‘๊ตญ ๋‹จ๋ง์—์„œ ํ…Œ์ŠคํŠธ)์—์„œ๋Š” DNS Query ์— ๋Œ€ํ•œ ์‘๋‹ต์„ ํ•˜์ง€ ์•Š๋Š”๋‹ค
  • ์ด๋Ÿด ๊ฒฝ์šฐ์— ์œ„์น˜๋ฅผ ๊ธฐ๋ณธ๊ฐ’ ์„ ์„ ํƒํ•˜๊ฒŒ ๋˜๋ฉด ์ง€๋ฆฌ ์œ„์น˜์— ๋งค์นญ๋˜์ง€ ์•Š๋Š” ๋ชจ๋“  ๊ฒฝ์šฐ์— ๊ธฐ๋ณธ๊ฐ’์— ์ •์˜๋œ IP ์ •๋ณด๋ฅผ ์ „๋‹ฌํ•ด์ค€๋‹ค
1
2
3
4
5
6
7
8
9
10
# ์ค‘๊ตญ ๋‹จ๋ง
curl -s https://ipvigilante.com/$(curl -s checkip.amazonaws.com) | jq '.data.country_name, .data.city_name, .data.ipv4'
"China"
"Suzhou"
"103.125.234.199"

curl geox.gasida.net
curl: (6) Could not resolve host: geox.gasida.net

dig geox.gasida.net +short


6. Issue

  • VPN, CDN ํ™˜๊ฒฝ์ด๋‚˜ ํ˜น์€ ์•„๋ž˜ ์ฒ˜๋Ÿผ ๋‹ค๋ฅธ ์ง€์—ญ์˜ DNS์„œ๋ฒ„๋ฅผ ์„ค์ • ํ•  ๊ฒฝ์šฐ Issue ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค

    1
    2
    3
    4
    5
    6
    7
    8
    # ๋ฏธ๊ตญ ๋‹จ๋ง DNS์„œ๋ฒ„๋ฅผ KT DNS๋กœ ๋ณ€๊ฒฝ
    cat /etc/resolv.conf |grep ^name
    nameserver 192.221.159.0

    sed -i "s/^nameserver 192.221.159.0/nameserver 168.126.63.1/g" /etc/resolv.conf

    dig www.google.com |grep SERVER
    ;; SERVER: 168.126.63.1#53(168.126.63.1)

    Route53%20Geolocation%20247d8a8c113e42e29a751d6e98ff864f/Untitled%207.png

  • ์•„๋ž˜ ์ฒ˜๋Ÿผ ์‹ค์ œ๋กœ๋Š” ๋ฏธ๊ตญ์— ์œ„์น˜ํ•œ ๋‹จ๋ง์—์„œ ์›น ์ ‘์† ์‹œ ์ž์‹ ์˜ ์œ„์น˜์™€ ๋–จ์–ด์ง„ ๋ฏธ๊ตญ์— ์œ„์น˜ํ•œ ์›น์„œ๋ฒ„๋กœ ์ ‘์†์„ ํ•œ๋‹ค

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    # ๋ฏธ๊ตญ ๋‹จ๋ง
    curl -s https://ipvigilante.com/$(curl -s checkip.amazonaws.com) | jq '.data.country_name, .data.city_name, .data.ipv4'
    "United States"
    "Ann Arbor"
    "35.245.140.130"

    curl geolo.gasida.net
    <html><h1>Hello from MCN Web Server - Seoul Area</h1></html>

    dig geolo.gasida.net +short
    3.34.3.33
  • Route Query Log ํ™•์ธํ•˜๋ฉด KT DNS IP๊ฐ€ Query๋ฅผ ํ–ˆ์Œ๋ฏ€๋กœ ํ•œ๊ตญ์— ์œ„์น˜ํ•œ ์›น์„œ๋ฒ„ IP ์ฃผ์†Œ๋ฅผ ์ „๋‹ฌํ–ˆ๋‹ค

    Route53%20Geolocation%20247d8a8c113e42e29a751d6e98ff864f/Untitled%208.png



7. EDNS Client Subnet

  • ์‚ฌ์šฉ์ž์˜ ์œ„์น˜(IP)๋ฅผ ์ตœ์ข… DNS์„œ๋ฒ„๊ฐ€ ์•Œ๊ธฐ ์œ„ํ•ด์„œ DNS์— ํ™•์žฅ ํ•„๋“œ EDNS ์— Client Subnet ํ•„๋“œ๋ฅผ ํ†ตํ•ด์„œ โ€˜์ตœ์ข… ์‚ฌ์šฉ์žโ€™์˜ IP ๋Œ€์—ญ ์ •๋ณด๋ฅผ ์ „๋‹ฌํ•  ์ˆ˜ ์žˆ๋‹ค

    • Client Subnet in DNS Queries (RFC 7871)
  • EDNS ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๋Š” DNS ์„œ๋ฒ„ : ๊ตฌ๊ธ€ DNS ์„œ๋ฒ„( 8.8.8.8 8.8.8.4 ) , OpenDNS ์„œ๋ฒ„ ( 208.67.222.222 208.67.220.220)

    • EDNS ๊ธฐ๋Šฅ ์ œ๊ณต ํ™•์ธ

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      # EDNS ์ œ๊ณต ์‹œ
      dig +nocl TXT o-o.myaddr.l.google.com @8.8.8.8 +short
      "2607:f8b0:4004:c02::102"
      "edns0-client-subnet 35.245.140.0/24"
      dig +nocl TXT o-o.myaddr.l.google.com @8.8.4.4 +short
      dig +nocl TXT o-o.myaddr.l.google.com @208.67.222.222 +short
      dig +nocl TXT o-o.myaddr.l.google.com @208.67.220.220 +short

      # EDNS ๋ฏธ ์ œ๊ณต ์‹œ
      dig +nocl TXT o-o.myaddr.l.google.com @168.126.63.1 +short
      "59.18.51.28"

7.1 ENDS ๋ฏธ์ œ๊ณต ํ™˜๊ฒฝ์—์„œ ํ…Œ์ŠคํŠธ

  • ์•„๋ž˜ ์ฒ˜๋Ÿผ ๋ฏธ๊ตญ ์œ„์น˜ ๋‹จ๋ง์ด MPLS VPN ๋“ฑ ํ™˜๊ฒฝ์œผ๋กœ ํ•œ๊ตญ์„ ๋ฐ˜๋“œ์‹œ ๊ฒฝ์œ ํ•˜๋Š” ํ™˜๊ฒฝ์ด๋‹ค

    • DNS ์„œ๋ฒ„๋ฅผ ํ•œ๊ตญ KT DNS(EDNS ๋ฏธ์ œ๊ณต)๋ฅผ ์„ค์ •ํ•˜๊ณ  ์ ‘์† ์‹œ ํ•œ๊ตญ์— ์œ„์น˜ํ•œ ์›น์„œ๋ฒ„๋กœ ์ ‘์†์„ ํ•œ๋‹ค

      Route53%20Geolocation%20247d8a8c113e42e29a751d6e98ff864f/Untitled%209.png

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      # ๋ฏธ๊ตญ ์œ„์น˜ ๋‹จ๋ง
      curl -s https://ipvigilante.com/$(curl -s checkip.amazonaws.com) | jq '.data.country_name, .data.city_name, .data.ipv4'
      "United States"
      null
      "34.64.138.144"
      dig www.google.com |grep SERVER
      ;; SERVER: 168.126.63.1#53(168.126.63.1)

      curl geolo.gasida.net
      <html><h1>Hello from MCN Web Server - Seoul Area</h1></html>

      dig geolo.gasida.net +short
      3.34.3.33
    • Route 53 Query Log ํ™•์ธ : ์•„๋ž˜ 59. IP๋Š” ํ•œ๊ตญ ์œ„์น˜ IP ์ด๋‹ค

      Route53%20Geolocation%20247d8a8c113e42e29a751d6e98ff864f/Untitled%2010.png


7.2 EDNS ์ œ๊ณต ํ™˜๊ฒฝ์—์„œ ํ…Œ์ŠคํŠธ

  • ๊ตฌ๊ธ€ DNS ๊ฒฝ์šฐ EDNS ๋ฅผ ์ œ๊ณตํ•˜๊ธฐ ๋•Œ๋ฌธ์— DNS Query ์‹œ ํ™•์žฅํ—ค๋”์— ์‚ฌ์šฉ์ž์˜ ๊ณต์ธIP๋Œ€์—ญ์„ ๋‹ด์•„์„œ ์ „๋‹ฌํ•˜์—ฌ Route53์—์„œ ์ธ์‹ ํ›„ ๋ฏธ๊ตญ ์œ„์น˜ ์›น ์„œ๋ฒ„ IP๋ฅผ ์ „๋‹ฌ ํ•ด์คŒ

    Route53%20Geolocation%20247d8a8c113e42e29a751d6e98ff864f/Untitled%2011.png

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    sed -i "s/^nameserver 168.126.63.1/nameserver 8.8.8.8/g" /etc/resolv.conf
    dig www.google.com |grep SERVER
    ;; SERVER: 8.8.8.8#53(8.8.8.8)

    # ์•„๋ž˜์ฒ˜๋Ÿผ EDNS ์ œ๊ณต ์—ฌ๋ถ€ ํ™•์ธ ํ•  ์ˆ˜ ์žˆ๋‹ค
    dig +nocl TXT o-o.myaddr.l.google.com +short
    "173.194.168.5"
    "edns0-client-subnet 34.64.138.0/24"

    curl geolo.gasida.net
    <html><h1>Hello from MCN Web Server - Virgina Area</h1></html>

    dig geolo.gasida.net +short
    18.206.97.145
    • EDNS ์˜ ํŒจํ‚ท ๋‚ด์šฉ์€ ๋Œ€๋žต ์•„๋ž˜์™€ ๊ฐ™๋‹ค

      1
      2
      3
      4
      # ์•„๋ž˜ ์ฒ˜๋Ÿผ ์‹คํ–‰ ํ›„ ํŒจํ‚ท ์บก์ณ ํ•ด์„œ ํ™•์ธ ํ•ด๋ณด์ž
      dig +nocl TXT o-o.myaddr.l.google.com @8.8.8.8 +short +subnet=34.64.138.0/24
      "2404:6800:400b:c002::101"
      "edns0-client-subnet 34.64.138.0/24"

      Route53%20Geolocation%20247d8a8c113e42e29a751d6e98ff864f/Untitled%2012.png



8. The bottom line

  • ์ผ๋ฐ˜์ ์ธ ์‚ฌ์šฉ์ž์˜ ํ™˜๊ฒฝ์—์„œ๋Š” DNS GeoLocation ์ •์ฑ…์— Issue ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š์•„์„œ DNS์„œ๋ฒ„๊ฐ€ ๋ฐ˜๋“œ์‹œ EDNS ๋ฅผ ์ œ๊ณตํ•˜๋Š”๊ฒƒ ํ•„์š” ์—†๋‹ค
  • ๋‹ค๋งŒ, VPN CDN ๋“ฑ์˜ ํ™˜๊ฒฝ์—์„œ EDNS Client Subnet ์„ ์ œ๊ณต ์‹œ ์ •ํ™•ํ•œ ์‚ฌ์šฉ์ž์˜ ์œ„์น˜๋ฅผ ๊ธฐ๋ฐ˜ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ œ๊ณต์„ ๊ถŒ์žฅํ•œ๋‹ค

๐Ÿ’ก ์ „ ์„ธ๊ณ„ ๋ชจ๋“  DNS ์„œ๋ฒ„์— EDNS ํ™•์žฅ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๊ธฐ ์œ„ํ•ด์„œ 2019 DNS Flag Day ์— ์ ์šฉ์„ ํ•˜์˜€๋‹ค. ์ฐธ๊ณ ๋งํฌ


Welcome to my other publishing channels