UDR7 Dynamic DNS using Namecheap
How to configure Namecheap Dynamic DNS service and Unifi Dream Router 7
This procedure describes how to configure the Unifi Dream Router 7 Dynamic DNS service to periodically update A + Dynamic DNS Record router.dubravko.com at Namecheap DNS server with the public IP address of Primary (WAN1) interface.
Namecheap DNS Configuration
- Enable Dynamic DNS in the
Advanced DNSsettings - Note the
Dynamic DNS Passwordvalue, as it will be needed later - Add a new
A + Dynamic DNS Recordwith the following details
| Parameter | Value |
|---|---|
| Type | A + Dynamic DNS Record |
| Host | router |
| Value | 1.1.1.1 |
| TTL | Automatic |
UDR7 Dynamic DNS Configuration
- In the https://unifi.ui.com web console, navigate to
Settings > Internet > Primary (WAN1) - Set the Advanced option to
Manual - Under Dynamic DNS, click + Create New Dynamic DNS and set the following values
| Parameter | Value |
|---|---|
| Service | namecheap |
| Hostname | router |
| Username | dubravko.com |
| Password | Paste the password noted during Namecheap DNS Configuration |
| Server | https://dynamicdns.park-your-domain.com/update? |
Set up UDR7 periodic updates
When the UDR7 is behind a non-bridged telecom router, it cannot detect changes in its public IP address. This limitation prevents the automatic triggering of DDNS updates. To overcome this issue, you we can set up a cron job to periodically force DDNS updates. This involves editing the root crontab to add a line that runs the inadyn command at regular intervals, typically every five minutes.
This step is required only if your UDR7 is behind non-bridged telecom router. If the telecom router is set to bridge mode and the UDR7 is configured to connect to the Internet directly via a PPPoE connection, UDR7 will automatically detect each public IP change and trigger DynDNS update.
Detect inadyn configuration file name
The file /run/ddns-ethX-inadyn.conf is created by the UniFi Network Controller when you configure the Dynamic DNS service through the web UI. This configuration file contains the necessary settings for the inadyn DDNS client to update your Namecheap DDNS record. The filename may vary depending on which Ethernet interface is used for your WAN connection. It’s crucial to use the correct filename in your cron job to ensure proper DDNS updates.
To detect the proper file name for your configuration:
- SSH into your UDR7 device
- Navigate to the
/rundirectory:1
cd /run - List DDNS configuration files:
1
ls ddns-eth*-inadyn.conf
- Note the exact filename (e.g.,
ddns-eth3-inadyn.conf)
Edit the Crontab
- Open the root crontab for editing:
1
sudo crontab -e
- Add the following line to the crontab:
1 2
# Namecheap DynDNS record update every 5 minutes */5 * * * * /usr/bin/inadyn -n -s -C -f /run/ddns-eth3-inadyn.conf -1 -l --foreground --force
Save the Crontab
- Press Esc
- Type
:wq - Press Enter
Verify the Cron Job
- Display the current crontab:
1
sudo crontab -l
- Confirm the new line is present and correctly formatted.
This configuration will execute the Dynamic DNS update every 5 minutes, ensuring your public IP address remains current with your Namecheap Dynamic DNS record.