Azure DNS配置外部VPS疑问:德国VPS自定义NS及解析设置
Got it, let's break down exactly how to set up Azure DNS for your German VPS and configure that custom nameserver ns1.MyWebSite.com—no confusing jargon, just step-by-step actions.
Option 1: Use Custom Nameserver Pointing to Your VPS (Requires DNS Server on VPS)
This is if you want ns1.MyWebSite.com to resolve directly to your VPS's IP (5.179.x.x) and have your VPS handle DNS forwarding to Azure.
Step 1: Set Up a DNS Server on Your VPS
First, you need a DNS server running on your German VPS to forward queries for your domain to Azure's DNS servers. For example:
- On Ubuntu/Debian, install BIND9 with
sudo apt install bind9. - Configure BIND9 to forward all requests for
MyWebSite.comto Azure's default nameservers (you can find these in your Azure DNS Zone's overview page). Add this to your BIND config:zone "MyWebSite.com" { type forward; forwarders { <AZURE_NS1_IP>; <AZURE_NS2_IP>; }; }; - Restart BIND9 with
sudo systemctl restart bind9and make sure port 53 (UDP/TCP) is open in your VPS firewall.
Step 2: Create Glue Record in Azure DNS Zone
- Go to your Azure DNS Zone (
MyWebSite.com) in the Azure Portal. - Add an A record:
- Name:
ns1 - IP Address:
5.179.x.x(your VPS's public IP)
- Name:
- This is the glue record that tells the internet where
ns1.MyWebSite.comlives.
Step 3: Configure Custom Nameservers in Azure
- In your Azure DNS Zone, go to the Nameservers section (left sidebar).
- Select Custom nameservers and enter
ns1.MyWebSite.com. Azure will validate the glue record exists before saving. - (Optional) If your registrar requires multiple nameservers, repeat steps 2-3 for
ns2.MyWebSite.com(use the same or a different IP).
Step 4: Point Your Domain to the Custom Nameserver
- Log into your domain registrar’s control panel (where you registered
MyWebSite.com). - Find the Nameservers or DNS Management section.
- Replace the default nameservers with
ns1.MyWebSite.com(andns2.MyWebSite.comif you added it). Save the changes.
Option 2: Use Custom Nameserver Aliased to Azure DNS (No VPS DNS Server Needed)
This is the simpler route if you just want a custom nameserver name but let Azure handle all DNS resolution.
Step 1: Get Azure DNS Server IPs
- Go to your Azure DNS Zone's Nameservers page to get the default Azure nameservers (e.g.,
ns1-01.azure-dns.com). - Use
digornslookupto get their IP addresses. For example:dig ns1-01.azure-dns.com A - Note down 2-3 of these IPs.
Step 2: Create Glue Records in Azure
- In your Azure DNS Zone, add A records for your custom nameservers:
- Name:
ns1, IP: First Azure DNS server IP - Name:
ns2, IP: Second Azure DNS server IP
- Name:
- These glue records will map
ns1.MyWebSite.comto Azure's actual DNS servers.
Step 3: Set Custom Nameservers in Azure
- Go to your Azure DNS Zone's Nameservers section, select Custom nameservers, and add
ns1.MyWebSite.comandns2.MyWebSite.com. Azure will validate the glue records.
Step 4: Update Registrar Nameservers
- Same as Option 1: Go to your domain registrar, replace default nameservers with
ns1.MyWebSite.comandns2.MyWebSite.com.
Final Step: Point Your Domain to Your VPS
Now that the nameserver setup is done, configure Azure DNS to resolve your domain to your VPS:
- In your Azure DNS Zone, add an A record:
- For your root domain (
MyWebSite.com): Name =@, IP Address =5.179.x.x - For a subdomain like
www.MyWebSite.com: Name =www, IP Address =5.179.x.x
- For your root domain (
- Save the record.
Important Notes
- DNS Propagation: Changes can take 5 minutes to 48 hours to spread globally. Use
nslookup MyWebSite.comordig MyWebSite.com Ato check if the records are live. - Glue Record Validation: Azure will block adding custom nameservers if the corresponding A record (glue record) doesn't exist—double-check that first if you get an error.
内容的提问来源于stack exchange,提问作者Admin
相关产品推荐
相关产品推荐

