selfhosted-apps-docker/ddclient/readme.md

101 lines
2.5 KiB
Markdown
Raw Permalink Normal View History

2020-05-10 10:32:16 +00:00
# DDclient
2020-04-09 22:52:11 +00:00
2020-05-18 22:49:18 +00:00
###### guide-by-example
2020-04-09 22:52:11 +00:00
2020-05-10 01:49:45 +00:00
# Purpose & Overview
2020-04-09 22:52:11 +00:00
2020-05-10 01:49:45 +00:00
Automatic DNS entries update.
2020-04-09 22:52:11 +00:00
2020-04-25 11:40:05 +00:00
* [Official site](https://sourceforge.net/p/ddclient/wiki/usage/)
2020-04-09 22:52:11 +00:00
* [Github](https://github.com/ddclient/ddclient)
2020-04-25 11:31:51 +00:00
* [DockerHub](https://hub.docker.com/r/linuxserver/ddclient)
2020-04-09 22:52:11 +00:00
2020-05-10 01:49:45 +00:00
DDclient is a Perl client used to update dynamic DNS records.</br>
2020-05-10 10:32:16 +00:00
Very useful if not having a static IP from the ISP.
It makes sure that if you reset your router, or have a power outage,
and you get a new public IP assigned, this IP gets automaticly set
in the DNS records for your domains.
2020-05-10 01:49:45 +00:00
2020-05-10 10:38:34 +00:00
This setup runs directly on the host machine.</br>
It works by checking every 10 minutes
2020-05-10 01:49:45 +00:00
[checkip.dyndns.org](http://checkip.dyndns.org/),
2020-05-10 10:38:34 +00:00
and if the IP changed from the previous one, it logs in to the DNS provider and
updates the DNS records.
2020-05-10 01:49:45 +00:00
2020-04-25 11:37:41 +00:00
# Files and directory structure
2020-04-09 22:52:11 +00:00
2020-04-25 23:04:12 +00:00
```
2020-05-10 10:17:00 +00:00
/etc/
└── ddclient/
└── ddclient.conf
2020-04-25 23:04:12 +00:00
```
2020-04-25 11:31:51 +00:00
2020-05-10 10:17:00 +00:00
# Installation
2020-04-25 23:04:12 +00:00
2020-05-10 10:17:00 +00:00
Install ddclient from your linux official repos.
2020-04-25 23:04:12 +00:00
2020-04-25 11:35:54 +00:00
# Configuration
2020-04-09 22:52:11 +00:00
2020-04-25 11:31:51 +00:00
Official ddclient config example
2020-04-27 21:01:48 +00:00
[here](https://github.com/ddclient/ddclient/blob/master/sample-etc_ddclient.conf).
2020-05-12 17:55:28 +00:00
This setup assumes the DNS records are managed on Cloudflare.</br>
2020-05-10 01:49:45 +00:00
Make sure all subdomains in the config have A-records.
2020-04-09 22:52:11 +00:00
2020-04-25 23:04:12 +00:00
`ddclient.conf`
```bash
daemon=600
syslog=yes
mail=root
mail-failure=root
2020-05-10 10:17:00 +00:00
pid=/var/run/ddclient.pid
2020-04-25 23:04:12 +00:00
ssl=yes
use=web, web=checkip.dyndns.org/, web-skip='IP Address'
##
## CloudFlare (www.cloudflare.com)
##
protocol=cloudflare, \
2020-05-16 13:18:21 +00:00
zone=example.com, \
2020-04-25 23:04:12 +00:00
ttl=1, \
2020-05-16 13:18:21 +00:00
login=bastard@gmail.com, \
2020-05-21 22:06:39 +00:00
password=<global-api-key-goes-here> \
2020-05-16 13:18:21 +00:00
example.com,*.example.com,subdomain.example.com
2020-04-25 23:04:12 +00:00
2020-04-25 23:06:08 +00:00
##
2020-04-25 23:04:12 +00:00
protocol=cloudflare, \
2020-05-16 13:18:21 +00:00
zone=example.org, \
2020-04-25 23:04:12 +00:00
ttl=1, \
2020-05-16 13:18:21 +00:00
login=bastard@gmail.com, \
2020-05-21 22:06:39 +00:00
password=<global-api-key-goes-here> \
2020-05-16 13:18:21 +00:00
example.org,*.example.org,whatever.example.org
2020-04-25 23:04:12 +00:00
```
2020-04-09 22:52:11 +00:00
2020-05-10 10:32:16 +00:00
# Start the service
`sudo systemctl enable --now ddclient`
2020-05-10 10:38:34 +00:00
# Troubleshooting
2020-05-10 10:42:04 +00:00
If it would timeout on start, check the real location of `ddclient.pid`</br>
2020-05-10 10:38:34 +00:00
`sudo find / -name ddclient.pid`
If it is correctly set in the `ddclient.conf`.
2020-04-25 11:31:51 +00:00
# Update
2020-04-09 22:52:11 +00:00
2020-05-10 10:17:00 +00:00
During host linux packages update.
# Backup and restore
#### Backup
Using [borg](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/borg_backup)
2020-05-10 10:42:04 +00:00
that makes daily snapshot of the /etc directory which contains the config file.
2020-05-10 10:17:00 +00:00
#### restore
2020-04-09 22:52:11 +00:00
2020-05-10 10:42:04 +00:00
Replace the content of the config file with the one from the backup.