Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
willswire authored Feb 2, 2022
1 parent d56b919 commit 7411a70
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# Cloudflare DDNS for UniFi OS

This is a small Cloudflare Workers application that exposes an UniFi-compatible DDNS API to update the IP address of your DNS A records.
A Cloudflare Worker script that exposes a UniFi-compatible DDNS API to dynamically update the IP address of a DNS A record.

## Why?

I have an UniFi Dream Machine Pro (UDM-Pro), and I want to update my Cloudflare domain name DNS records when my IP changes. Unfortunately, UniFi does not come pre-configured to support Cloudflare as one of its DDNS providers.
I have a UniFi Dream Machine Pro (UDM-Pro), and I want to update my Cloudflare domain name DNS records when my public IP address changes. Unfortunately, UniFi does not come pre-configured to support Cloudflare as one of its DDNS providers.

## Configuring Cloudflare

1. Create a [Cloudflare Worker](https://workers.cloudflare.com)
2. 'Quick Edit' the worker within your browser
1. Create a new [Cloudflare Worker](https://workers.cloudflare.com)
2. 'Quick Edit' the worker within your browser.
3. Copy and paste the contents of [index.js](https://github.com/willswire/unifi-cloudflare-ddns/blob/main/index.js) into the code editor for your worker. Ensure that you are replacing any boilerplate/code that is currently there.
4. Create an API token so the worker can update your records. Go to https://dash.cloudflare.com/profile/api-tokens and select "Create custom token". Enable permissions for both **Zone:Read** and **DNS:Edit**. Copy your API Key - you will need it when configuring your UniFi OS Controller.
4. Once you have created the worker, take note of it's \*.workers.dev route. More on routes for Cloudflare Workers [here](https://developers.cloudflare.com/workers/platform/routes#routes-with-workersdev).
5. Create an API token so the Worker can update your DNS records. Go to https://dash.cloudflare.com/profile/api-tokens and select "Create custom token". Enable permissions for both **Zone:Read** and **DNS:Edit**. Copy your API Key - you will need it later when configuring your UniFi OS Controller.

## Configuring UniFi OS

1. Log on to your [UniFi Network Controller](https://unifi.ui.com/)
2. Navigate to Settings > Internet > WAN and scroll down to **Dynamic DNS**. Click **Create New Dynamic DNS**.
3. Enter the following information:
1. Log on to your [UniFi OS Controller](https://unifi.ui.com/)
2. Navigate to Settings > Internet > WAN and scroll down to **Dynamic DNS**.
3. Click **Create New Dynamic DNS** and enter the following information:
- `Service`: choose any service from the drop-down menu
- `Hostname`: the full subdomain and hostname of the record you want to update (e.g. `subdomain.mydomain.com`)
- `Username`: the domain name containing the record (e.g. `mydomain.com`)
Expand Down

0 comments on commit 7411a70

Please sign in to comment.