From 9be7f752811596235c0df5a92ef0752bd1a597ee Mon Sep 17 00:00:00 2001 From: Huw Jones Date: Tue, 20 Feb 2024 21:29:22 +0000 Subject: [PATCH] README: document USG debugging --- README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 01b8609..c9ad5ad 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A Cloudflare Worker script that provides a UniFi-compatible DDNS API to dynamica ## Why? -UniFi Dream Machine Pro (UDM-Pro) users may need to update Cloudflare domain name DNS records when their public IP address changes. UniFi does not natively support Cloudflare as a DDNS provider. +UniFi Dream Machine Pro (UDM-Pro) or UniFi Security Gateway (USG) users may need to update Cloudflare domain name DNS records when their public IP address changes. UniFi does not natively support Cloudflare as a DDNS provider. ### Configuring Cloudflare @@ -32,7 +32,7 @@ Ensure you have a Cloudflare account and your domain is configured to point to C ### Configuring UniFi OS 1. Log in to your [UniFi OS Controller](https://unifi.ui.com/). -2. Navigate to Settings > Internet > WAN and scroll down to **Dynamic DNS**. +2. Navigate to Settings > Internet > WAN and scroll down to **Dynamic DNS**. 3. Click **Create New Dynamic DNS** and provide: - `Service`: Choose `dyndns`. - `Hostname`: Full subdomain and hostname to update (e.g., `subdomain.mydomain.com`, `mydomain.com` for root domain). @@ -41,8 +41,9 @@ Ensure you have a Cloudflare account and your domain is configured to point to C - `Server`: Cloudflare Worker route `..workers.dev/update?ip=%i&hostname=%h`. - For older UniFi devices, omit the URL path. - Remove `https://` from the URL. - -To test the configuration and force an update: + +#### Testing Changes - UDM-Pro +To test the configuration and force an update on a UDM-Pro: 1. SSH into your UniFi device. 2. Run `ps aux | grep inadyn`. @@ -50,6 +51,15 @@ To test the configuration and force an update: 4. Run `inadyn -n -1 --force -f ` (e.g., `inadyn -n -1 --force -f /run/ddns-eth4-inadyn.conf`). 5. Check `/var/log/messages` for related error messages. +#### Testing Changes - USG +To test the configuration and force an update on a USG: + +1. SSH into your USG device. +2. Run `ls /run/ddclient/` (e.g.: `/run/ddclient/ddclient_eth0.pid`) +3. Note the pid file path as this will tell you what configuration to use. (e.g.: `ddclient_eth0`) +4. Run `sudo ddclient -daemon=0 -verbose -noquiet -debug -file /etc/ddclient/.conf` (e.g., `sudo ddclient -daemon=0 -verbose -noquiet -debug -file /etc/ddclient/ddclient_eth0.conf`). +5. This should output `SUCCESS` when the DNS record is set. + #### Important Notes! - For subdomains (`sub.example.com`), create an A record manually in Cloudflare dashboard first.