|
| 1 | +# Duck DNS |
| 2 | + |
| 3 | +Duckdns is a free public DNS service that provides you with a domain name you |
| 4 | +can update to match your dynamic IP-address. |
| 5 | + |
| 6 | +This container automates the process to keep the duckdns.org domain updated |
| 7 | +when your IP-address changes. |
| 8 | + |
| 9 | +## References |
| 10 | + |
| 11 | +* Register an account, add your subdomain and get your token from |
| 12 | + [http://www.duckdns.org/](http://www.duckdns.org/) |
| 13 | +* based on the linuxserver |
| 14 | + [docker-duckdns](https://github.com/linuxserver/docker-duckdns) container |
| 15 | + |
| 16 | +## Configuration |
| 17 | + |
| 18 | +Create the file `~/IOTstack/docker-compose.override.yml` and place your Duckdns |
| 19 | +token and chosen domain name there: |
| 20 | + |
| 21 | +``` yaml title="docker-compose.override.yml" |
| 22 | +version: '3.6' |
| 23 | +services: |
| 24 | + duckdns: |
| 25 | + environment: |
| 26 | + TOKEN: your-duckdns-token |
| 27 | + SUBDOMAINS: subdomain |
| 28 | +``` |
| 29 | +
|
| 30 | +Observe that at least the initial update is successful: |
| 31 | +
|
| 32 | +``` console |
| 33 | +$ cd ~/IOTstack |
| 34 | +$ docker-compose up -d duckdns |
| 35 | +$ docker-compose logs duckdns |
| 36 | +...SNIP... |
| 37 | +Retrieving subdomain and token from the environment variables |
| 38 | +log will be output to docker log |
| 39 | +Your IP was updated at Wed May 4 03:31:14 UTC 2022 |
| 40 | +...SNIP... |
| 41 | +``` |
| 42 | + |
| 43 | +If there is a problem, check that the resulting effective configuration of |
| 44 | +'duckdns:' looks OK: |
| 45 | +``` console |
| 46 | +$ cd ~/IOTstack && docker-compose config |
| 47 | +``` |
| 48 | + |
| 49 | +### Domain name for the private IP |
| 50 | + |
| 51 | +!!! note inline end "Example IP:s and domains" |
| 52 | + |
| 53 | + ``` mermaid |
| 54 | + flowchart |
| 55 | + I([Internet]) |
| 56 | + G("Router\npublic IP: 52.85.51.71\nsubdomain.duckdns.org") |
| 57 | + R(Raspberry pi\nprivate IP: 192.168.0.100\nprivate_subdomain.duckdns.org) |
| 58 | + I --- G --- |LAN| R |
| 59 | + ``` |
| 60 | + |
| 61 | +As a public DNS server, Duckdns is not meant to be used for private IPs. It's |
| 62 | +recommended that for resolving internal LAN IPs you use the [Pi |
| 63 | +Hole](Pi-hole.md) container or run a dedicated DNS server. |
| 64 | + |
| 65 | +That said, it's possible to update Duckdns to your LAN IP. This may be |
| 66 | +convenient if you have devices that don't support mDNS (.local) or don't want |
| 67 | +to run Pi-hole. This is especially useful if you can't assign a static IP to |
| 68 | +your RPi. No changes to your DNS resolver settings are needed. |
| 69 | + |
| 70 | +First, as for the public subdomain, add the domain name to your Duckdns account |
| 71 | +from their homepage. Then add a `PRIVATE_SUBDOMAIN` variable indicating this |
| 72 | +subdomain: |
| 73 | + |
| 74 | +``` yaml title="added variable to docker-compose.override.yml" |
| 75 | +version: '3.6' |
| 76 | +services: |
| 77 | + duckdns: |
| 78 | + environment: |
| 79 | + TOKEN: ... |
| 80 | + SUBDOMAINS: ... |
| 81 | + PRIVATE_SUBDOMAIN: private_subdomain |
| 82 | +``` |
0 commit comments