Forwarding DNS Queries from AWS EC2 to On-Premise AD DNS Server

AWS EC2 မှ On-Premise AD DNS Server သို့ DNS Queries များ လမ်းညွှန်ခြင်း

Hybrid Cloud ပုံစံကို အသုံးပြုတဲ့ လုပ်ငန်းတွေမှာ အဓိက စိန်ခေါ်မှုတစ်ခုကတော့ AWS ပေါ်က servers တွေနဲ့ on-premise (ကိုယ်ပိုင် data center) ပေါ်က servers တွေကြားမှာ ချောမွေ့စွာ ချိတ်ဆက်ဖို့ပါပဲ။ အထူးသဖြင့်၊ AWS EC2 instances တွေက on-premise ရှိတဲ့ database ဒါမှမဟုတ် application server တွေကို သူတို့ရဲ့ domain name (ဥပမာ- database.corp.local) နဲ့ တိုက်ရိုက်ခေါ်ဖို့ လိုအပ်တဲ့အခါမှာ DNS ပြဿနာတွေ ရင်ဆိုင်ရနိုင်ပါတယ်။

ဒီ article မှာတော့ AWS EC2 instances တွေကနေ on-premise DNS server ကို DNS queries တွေကို လုံခြုံ၊ ထိရောက်ပြီး ချောမွေ့စွာ ဘယ်လို လမ်းညွှန်ပေးမလဲဆိုတာကို အသေးစိတ် ရှင်းပြပေးပါမယ်။

စိန်ခေါ်မှုက ဘာလဲ။

မူရင်းအတိုင်းဆိုရင်၊ AWS ပေါ်က EC2 instance တွေဟာ သူတို့ရဲ့ VPC မှာရှိတဲ့ DNS resolver ကိုသာ အသုံးပြုကြပါတယ်။ ဒီ resolver က အများသုံးအင်တာနက်ပေါ်မှာရှိတဲ့ domain name တွေကိုသာ သိပြီး၊ သင့်ရဲ့ကိုယ်ပိုင် on-premise က network domain (ဥပမာ- .corp.local) တွေကို မသိပါဘူး။

ဒါကြောင့် EC2 instance ကနေ server01.corp.local ကို ခေါ်လိုက်တဲ့အခါ DNS resolution မအောင်မြင်တဲ့ error မျိုးနဲ့ ကြုံရမှာပါ။ ဒီပြဿနာကို ဖြေရှင်းဖို့အတွက် EC2 instances တွေကို DNS queries တွေ ဘယ်ကို ပို့ရမယ်ဆိုတာ ပြောပြပေးဖို့ လိုအပ်ပါတယ်။

အကောင်းဆုံး ဖြေရှင်းနည်း: Route 53 Resolver

AWS က ဒီလိုမျိုး Hybrid Cloud အတွက် DNS ဖြေရှင်းနည်းကို AWS Route 53 Resolver နဲ့ ပေးထားပါတယ်။ ဒီနည်းလမ်းဟာ EC2 instances တစ်ခုချင်းစီကို ကိုယ်တိုင် configure လုပ်နေရတဲ့ အလုပ်ကို ရှောင်ရှားနိုင်ပြီး ပိုမိုခိုင်မာတဲ့ architecture ကို တည်ဆောက်နိုင်ပါတယ်။

Route 53 Resolver မှာ အဓိက အစိတ်အပိုင်းနှစ်ခု ပါဝင်ပါတယ်။

  1. Outbound Endpoint: ဒါဟာ သင့်ရဲ့ VPC ထဲမှာ ဖန်တီးထားတဲ့ DNS query တွေ အပြင်ဘက် (on-premise) ကို ထွက်ဖို့အတွက် တံခါးပေါက်တစ်ခုပါပဲ။
  2. Conditional Forwarding Rules: ဒါကတော့ သတ်မှတ်ထားတဲ့ domain name (ဥပမာ- .corp.local) အတွက် queries တွေကို Outbound Endpoint ကနေတဆင့် on-premise DNS servers ဆီကို လမ်းညွှန်ပေးဖို့ စည်းမျဉ်းတွေဖြစ်ပါတယ်။

အဆင့်ဆင့် တည်ဆောက်ပုံ

ဒီ architecture ကို အကောင်အထည်ဖော်ဖို့အတွက် Site-to-Site VPN ဒါမှမဟုတ် ExpressRoute နဲ့ သင့်ရဲ့ AWS VPC နဲ့ on-premise network ကို ချိတ်ဆက်ပြီးသားဖြစ်ဖို့ လိုအပ်ပါတယ်။

အဆင့် ၁: Route 53 Resolver မှာ Outbound Endpoint ကို ဖန်တီးပါ။

  1. AWS Management Console ထဲက Route 53 ကို သွားပါ။
  2. ဘယ်ဘက် side bar က Resolver အောက်မှာရှိတဲ့ Outbound endpoints ကို နှိပ်ပြီး Create outbound endpoint ကို ရွေးပါ။
  3. Endpoint name ကို သင့်စိတ်ကြိုက် ပေးပါ။ (ဥပမာ- OnPrem-Outbound-DNS)
  4. VPC မှာ သင့်ရဲ့ EC2 instances တွေ ရှိနေတဲ့ VPC ကို ရွေးပါ။
  5. Subnets အောက်မှာ DNS queries တွေ ထွက်မယ့် subnet နှစ်ခုကို အနည်းဆုံး ရွေးပေးပါ။ ဒီလိုလုပ်တာက high availability အတွက် အရေးကြီးပါတယ်။
  6. Security group မှာတော့ on-premise DNS server ကနေ port 53 (DNS) traffic ကို ခွင့်ပြုထားတဲ့ security group ကို ရွေးပါ။
  7. Create outbound endpoint ကို နှိပ်ပါ။

အဆင့် ၂: Conditional Forwarding Rule ကို ဖန်တီးပါ။

  1. Route 53 Resolver ကနေ Rules ကို ရွေးပြီး Create rule ကို နှိပ်ပါ။
  2. Rule name ကို ပေးပါ။ (ဥပမာ- Corp-local-DNS-Rule)
  3. Domain name မှာတော့ သင့်ရဲ့ on-premise domain name (ဥပမာ- corp.local) ကို ထည့်ပါ။
  4. Forwarding behavior မှာ Forward ကို ရွေးပါ။
  5. Target IP addresses အောက်မှာ သင့်ရဲ့ on-premise Active Directory (AD) DNS servers တွေရဲ့ IP address တွေကို ထည့်ပါ။ (အနည်းဆုံး နှစ်ခုထည့်ရန် အကြံပြုပါသည်)။
  6. VPC မှာ သင့်ရဲ့ EC2 instances တွေရှိတဲ့ VPC ကို ရွေးပါ။
  7. Create rule ကို နှိပ်ပါ။

အဆင့် ၃: စမ်းသပ်ကြည့်ပါ။

အထက်ပါအဆင့်တွေ ပြီးသွားပြီဆိုရင် သင့်ရဲ့ EC2 instance ကို SSH နဲ့ ဝင်ပြီး အောက်ပါ command တွေနဲ့ စမ်းသပ်ကြည့်နိုင်ပါတယ်။


# Example 1: Use dig to check DNS resolution
# ဥပမာ ၁: dig ကိုသုံးပြီး DNS resolution ကိုစစ်ဆေးပါ
dig server01.corp.local
# Example 2: Use nslookup
# ဥပမာ ၂: nslookup ကိုသုံးပါ
nslookup server01.corp.local

ဒီ command တွေက server01.corp.local ရဲ့ IP address ကို ပြန်ပေးနိုင်မယ်ဆိုရင် သင့်ရဲ့ configuration အောင်မြင်သွားပါပြီ။


အနှစ်ချုပ်

ဒီ architecture က EC2 instances တွေကို on-premise resources တွေနဲ့ ချိတ်ဆက်ဖို့ အကောင်းဆုံး၊ အကြံပြုထားတဲ့ နည်းလမ်းဖြစ်ပါတယ်။

  • EC2 instance မှာရှိတဲ့ DNS queries တွေက သင့်ရဲ့ VPC DNS resolver ဆီကို အရင်ဆုံးရောက်ပါတယ်။
  • VPC DNS resolver က Conditional Forwarding Rule ကို စစ်ဆေးပြီး *.corp.local queries တွေကို ဘယ်ကို ပို့ရမလဲဆိုတာကို သိပါတယ်။
  • အဲဒီ queries တွေကို Route 53 Resolver Outbound Endpoint ကနေတဆင့် VPN/ExpressRoute ကို ဖြတ်ပြီး on-premise AD DNS servers ဆီကို လမ်းညွှန်ပေးပါတယ်။
  • On-premise AD DNS server က နာမည်ကို resolve လုပ်ပြီး IP address ကို ပြန်ပေးလိုက်ပါတယ်။

ဒီနည်းလမ်းကို အသုံးပြုခြင်းအားဖြင့် သင့်ရဲ့ Hybrid Cloud ပတ်ဝန်းကျင်ဟာ ပိုမို စိတ်ချရပြီး ချောမွေ့စွာ အလုပ်လုပ်နိုင်ပါလိမ့်မယ်။


English Version

Forwarding DNS Queries from AWS EC2 to On-Premise AD DNS Server

In a hybrid cloud environment, a common challenge is ensuring seamless communication between your resources in AWS and your on-premise data center. Specifically, your EC2 instances in AWS might need to resolve hostnames of on-premise servers (e.g., database.corp.local), but they can’t because those names are not in the public DNS.

This article will explain in detail how to securely and efficiently forward DNS queries from your AWS EC2 instances to your on-premise Active Directory (AD) DNS server.

The Challenge

By default, EC2 instances are configured to use the DNS resolver within their VPC. This resolver is only aware of public domain names and some AWS internal hostnames. It has no knowledge of your private, on-premise network domain (e.g., .corp.local).

As a result, if an EC2 instance tries to reach server01.corp.local, the DNS resolution will fail. To solve this, you need a mechanism to tell the EC2 instances where to find the authoritative DNS server for your private domain.

The Recommended Solution: Route 53 Resolver

The best practice for this scenario is to use AWS Route 53 Resolver. This method is scalable and avoids the cumbersome and error-prone process of manually configuring DNS settings on each individual EC2 instance.

The Route 53 Resolver solution involves two main components:

  1. Outbound Endpoint: This acts as a DNS forwarding gateway within your VPC, allowing DNS queries to be sent from your VPC to an external network (in this case, your on-premise network).
  2. Conditional Forwarding Rules: These are rules that tell the VPC resolver to forward all queries for a specific domain name (e.g., all queries ending in .corp.local) to the Outbound Endpoint, which then forwards them to your on-premise DNS servers.

Step-by-Step Configuration Guide

This architecture requires that you have already established a network connection between your AWS VPC and your on-premise network using either a Site-to-Site VPN or ExpressRoute.

Step 1: Create an Outbound Endpoint in Route 53 Resolver.

  1. Navigate to the Route 53 console in AWS.
  2. Under Resolver, select Outbound endpoints and click Create outbound endpoint.
  3. Give the endpoint a name (e.g., OnPrem-Outbound-DNS).
  4. Select the VPC where your EC2 instances reside.
  5. Under Subnets, choose at least two subnets in different Availability Zones. This is crucial for high availability.
  6. For the Security group, select or create a security group that allows outbound traffic on port 53 (DNS) to your on-premise DNS servers.
  7. Click Create outbound endpoint.

Step 2: Create a Conditional Forwarding Rule.

  1. From the Route 53 Resolver console, select Rules and click Create rule.
  2. Give the rule a name (e.g., Corp-local-DNS-Rule).
  3. Enter your on-premise Domain name (e.g., corp.local).
  4. For Forwarding behavior, select Forward.
  5. Under Target IP addresses, enter the IP addresses of your on-premise Active Directory (AD) DNS servers. (It’s recommended to add at least two addresses for redundancy).
  6. Under VPC, select the VPC where your EC2 instances are located.
  7. Click Create rule.

Step 3: Verify and Test.

Once the above steps are complete, you can SSH into an EC2 instance in the VPC and use the following commands to test the configuration.


# Example 1: Use dig to check DNS resolution
dig server01.corp.local
# Example 2: Use nslookup
nslookup server01.corp.local

If these commands return the correct IP address for server01.corp.local, your configuration is successful.


Summary of the Architecture

This is the recommended and scalable method for connecting your EC2 instances to on-premise resources.

  • A DNS query from an EC2 instance first goes to the VPC’s DNS resolver.
  • The VPC resolver checks the Conditional Forwarding Rule and sees that queries for *.corp.local should be forwarded.
  • The query is then sent through the Route 53 Resolver Outbound Endpoint over your VPN/ExpressRoute connection to your on-premise AD DNS servers.
  • The on-premise AD DNS server resolves the name and returns the IP address.

By using this approach, your hybrid cloud environment will operate more reliably and seamlessly.


Scroll to Top
Share via
Copy link