TECHNICAL GEMS

Setting up DDNS to Point to Your Windows 2022 Home Server – to Avoid IP Changes

Here are detailed step-by-step instructions for using Dynamic DNS (DDNS) and running your own DNS server on Windows Server 2022 at home, without Plesk. This guide assumes you want to:

  • Make your home server accessible at a domain/subdomain that tracks your changing public IP.
  • Use your own DNS server to manage DNS records (not just a third-party DDNS provider).

Step 1: Choose Your DDNS Approach

A. Use a DDNS Service (Recommended for Home IPs)

  1. Sign up for a DDNS host (e.g., DuckDNS, No-IP, Dynu, or Cloudflare with API scripts).
  2. Set up your router or a local client on your Windows Server to automatically update the DDNS hostname with your public IP.
    • Most home routers support automatic DDNS.
    • If not, run the provider’s DDNS updater software or script on your server.

B. Use Your Own DNS Server with Automatic Updates

  • If you control your DNS zone (registered at your registrar), you can point your domain to your home server and update DNS records using scripts or the Windows Dynamic DNS (details below).
  • You still need to manage how your public IP gets updated in DNS when it changes.

Step 2: Set a Static Local IP Address

Assign your Windows Server 2022 a static internal IP address so port forwarding (below) works reliably.

  • Go to Control Panel > Network and Internet > Network Connections.
  • Right-click your network adapter, select Properties → Internet Protocol Version 4 (TCP/IPv4) → Properties.
  • Enter a static IP (e.g., 192.168.1.100) and your local gateway.

Step 3: Install and Configure the Windows DNS Server Role

A. Install DNS Server

  • Via GUI: Open Server Manager → Manage → Add Roles and Features → Role-based or feature-based installation → select your server → check DNS Server → complete the wizard.
  • Via PowerShell:
    Run as administrator:powershellInstall-WindowsFeature -Name DNS -IncludeManagementTools

B. Configure a DNS Zone

  • Open DNS Manager (Server Manager > Tools > DNS).
  • Right-click Forward Lookup Zones → New Zone.
    • Choose Primary zone
    • Name it appropriately (e.g., yourdomain.com or home.yourdomain.com)
    • Allow only secure dynamic updates (if using with Active Directory) or set as appropriate for your use case.

Step 4: Update Your DNS Zone with Your Changing Public IP (DDNS)

Option 1: Update A Record with DDNS/Script

  1. Write a script (PowerShell, Python, or batch) that:
    • Checks your current public IP (e.g., using Invoke-RestMethod to ipinfo.io/ip).
    • Compares it to the current A record in your DNS zone.
    • If changed, updates the DNS record using Windows DNS cmdlets (e.g., Add-DnsServerResourceRecordASet-DnsServerResourceRecord).
    Example PowerShell logic (simplified):powershell$currentIP = (Invoke-RestMethod 'https://api.ipify.org/').Content $zoneName = "home.yourdomain.com" $record = Get-DnsServerResourceRecord -ZoneName $zoneName -Name "@" if ($record.RecordData.IPv4Address -ne $currentIP) { Set-DnsServerResourceRecord -ZoneName $zoneName -OldInputObject $record -NewData $currentIP }
  2. Run this script as a scheduled task every 5–10 minutes.

Option 2: Use Secure Dynamic Updates

  • Windows and Active Directory DNS support “dynamic updates” where Windows computers or DHCP automatically update DNS when their IP changes.
  • For typical small/home setups, using a script as above is more practical.

Step 5: Set Up Port Forwarding and Firewall

  • On Your Router: Forward UDP port 53 (DNS) and any other needed ports (like TCP 80/443 for web).
    • Point the port to your server’s static internal IP.
  • On Windows Firewall: Allow inbound connections for DNS and needed services.

Step 6: Register Your Custom Nameservers (if using your own domain)

If you own a domain and want to use your Windows Server’s DNS publicly:

  1. In your domain registrar’s control panel, create “glue records” for e.g. ns1.yourdomain.com → [your current public IP].
  2. Set your domain’s nameservers to your home’s public IP via these hostnames.
  3. Note: Some registrars do not allow glue for dynamic IPs or block home connections on port 53.

Step 7: Test Everything

  • Use nslookup yourdomain.com your-public-ip
  • Test remote resolution of your domain and confirm it tracks your home IP after an IP address change.

Example Flow

StepYour Action
1. Get a DDNS hostname OR use own domainSet up DDNS at provider or decide to use your own domain with your own DNS server
2. Static local IPEnsure Windows Server has a static internal IP
3. DNS server installAdd DNS Server role on Windows Server 2022
4. Create DNS zoneMake a Forward Lookup Zone for your domain (e.g., home.yourdomain.com)
5. DDNS automationUse DDNS client or a script to keep A record updated to your current public IP
6. Port forwarding/firewallOpen/forward UDP 53 from router to your server
7. Registrar glue/NSIf using own domain, register glue records and set nameservers to your home IP
8. TestUse dig/nslookup or online tools to confirm DNS works and updates with your public IP changes

Notes & Caveats

  • Home ISPs may block inbound DNS (UDP 53), web (80/443), or may not permit self-hosted nameservers.
  • A reliable DDNS service is safer for most home users.
  • If you use Cloudflare or a similar DNS host, point your domain’s A record to your DDNS host (e.g., myserver.duckdns.org), and you don’t need to open port 53.

For more in-depth command syntax, see Microsoft’s official quickstart and dynamic DNS documentation.

If you specify which DDNS provider you wish to use, or want a full script for automated A record updates, let me know!


If you are smart enough to have Plesk installed on your server, use this procedure to setup DDNS

To set up DDNS and use your Plesk server (on Windows, at home) as your own DNS with custom nameservers, follow these steps:

1. Set Up Dynamic DNS (DDNS)

You need your public IP address at home to be reliably reachable even if it changes. There are two approaches:

Option A: Use a DDNS provider (like No-IP, DynDNS, DuckDNS)

  • Register a hostname with the DDNS provider (e.g. yourname.ddns.net).
  • Configure your router or a DDNS client on your network to automatically update your DDNS hostname whenever your IP changes.
  • This gives you a hostname always resolving to your (changing) home IP.

Option B: Use Plesk’s own DDNS capability (advanced; can be achieved with the [jkapi/plesk-ddns extension])

  • Install the extension: Download and install the Plesk DDNS extension.shellplesk bin extension -i /path-to/ddns-version.zip
  • Enable DDNS for domains/subdomains:
    • Go to Websites & Domains > your domain > Hosting & DNS > Dynamic DNS.
    • Enable Dynamic DNS for the subdomain or root you want.
  • Update record as needed: Use the unique URL provided for your DDNS record to update your IP (with a script, cURL call, etc.).

2. Set Up Your Domain’s DNS in Plesk

  1. Install and enable the DNS server on your Plesk for Windows server if not already done.
  2. Open UDP port 53 on your home firewall/router and forward it to your Plesk server’s local IP (critical for external DNS queries to your box).
  3. Add your domain to Plesk via Websites & Domains > Add Domain.
  4. Check or edit the DNS zone:
    • In Websites & Domains > <yourdomain.com> > DNS Settings, review the automatically created zone.
    • Add/Edit records as appropriate.
  5. Set up your desired nameservers:
    • Usually, you’ll want names like ns1.yourdomain.com and ns2.yourdomain.com pointing to your current public IP. These are called “glue” records.
    • In the DNS zone, set:
      • ns1.yourdomain.com. A [your current public IP]
      • ns2.yourdomain.com. A [your current public IP]
    • Set the NS records so that yourdomain.com. lists both ns1.yourdomain.com.ns2.yourdomain.com.

3. Register Your Nameservers at Your Registrar

  • Login to your domain registrar.
  • Register (as “host records” or “glue records”) the following:
    • ns1.yourdomain.com → [your home public IP]
    • ns2.yourdomain.com → [your home public IP]
  • Change your domain to use these as its authoritative nameservers (ns1.yourdomain.comns2.yourdomain.com).

4. Keep IP Up to Date (DDNS and glue sync!)

When your IP changes, the A records for ns1/2.yourdomain.com in your Plesk DNS zone (and the glue records at the registrar) must stay in sync.

  • Simplest: Use a DDNS provider for the A record (step 1A), and set your glue/NS to point to their hostname (if your registrar allows).
  • With Plesk-DDNS extension: Have your update script update the A records automatically in your Plesk DNS when your IP changes.
  • Manual backup: Each time your public IP changes, update the glue and DNS A records immediately.

5. Test configuration

  • After DNS changes propagate (can take hours to days), test:
    • nslookup yourdomain.com ns1.yourdomain.com
    • Use online tools to check that your custom nameservers resolve and that your site is accessible.

Summary Table

StepAction
DDNS Client SetupSet up DDNS on router/device or with Plesk-DDNS extension
PortsForward UDP 53 (DNS), TCP 80/443 (web) to Plesk server
Plesk DNSCreate/edit DNS zone, use A + NS records for ns1/ns2 points to public IP
RegistrarRegister glue (host) records for ns1/ns2, update domain to use these as nameservers
Ongoing IP changesEnsure A/glue records update when IP changes (via DDNS or script)

Note:

  • Some registrars do not allow glue records pointing to dynamic or non-static IPs; check your registrar’s policy.
  • Home ISPs may block inbound port 53 (DNS) or port 80; such issues may prevent a public Plesk DNS from being reliable.

References:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *