To set up Dynamic DNS (DDNS) with an OpenVPN server on Windows, follow these steps:
1. Set Up a DDNS Service
1. Choose a DDNS Provider: Options include:
• No-IP
• DynDNS
• DuckDNS
2. Create a Hostname:
• Sign up with the DDNS provider.
• Create a hostname (e.g., myopenvpn.ddns.net).
3. Update Public IP:
• Download and install the DDNS client provided by your service (e.g., No-IP’s DUC or another update tool).
• Configure the client with your DDNS account credentials to ensure it updates your hostname automatically when your public IP changes.
2. Configure OpenVPN with DDNS
1. Locate OpenVPN Configuration Files:
• By default, the OpenVPN configuration files are located in:
C:\Program Files\OpenVPN\config
2. Edit the Server Configuration:
• Open the server configuration file (e.g., server.ovpn or server.conf) in a text editor.
• Replace any references to your server’s public IP with the DDNS hostname:
local myopenvpn.ddns.net
(If local is not present, OpenVPN will listen on all interfaces by default.)
3. Edit the Client Configuration:
• Update the client configuration file (client.ovpn) to use the DDNS hostname:
remote myopenvpn.ddns.net 1194 udp
3. Install a DDNS Updater on Windows
1. Install the DDNS Client:
• For example, download the No-IP Dynamic Update Client from No-IP.
• Install and log in using your DDNS account credentials.
• Configure the client to monitor your current public IP and update your DDNS hostname automatically.
2. Test the DDNS Client:
• Force an IP update in the DDNS client tool to ensure it works.
• Verify your hostname resolves to your public IP using nslookup or a similar tool:
nslookup myopenvpn.ddns.net
4. Restart the OpenVPN Server
1. Restart OpenVPN:
• Open the Services window (Windows Key + R, then type services.msc).
• Find the OpenVPNService.
• Right-click and choose Restart.
2. Check the OpenVPN log files for any errors:
• Logs are typically located in C:\Program Files\OpenVPN\log.
5. Test the Configuration
1. Verify Connectivity:
• On a client device, import the updated client.ovpn file with the DDNS hostname.
• Connect to the OpenVPN server.
2. Ensure DDNS is Resolving:
• If there are connectivity issues, confirm the DDNS hostname resolves to your server’s current public IP using:
nslookup myopenvpn.ddns.net
• Check firewall rules on the server to ensure the OpenVPN port (e.g., 1194) is open.
By setting up DDNS, your OpenVPN clients can reliably connect to the server even if the public IP changes, ensuring seamless remote access.