Update clients¶
Anything that speaks the dyndns2 protocol – most routers, ddclient, inadyn – or can send an HTTPS request updates your hosts. It logs in with your user name and an update token (create one on your profile; it is shown once). An update token can update and remove records, nothing else: not your password, not the web pages.
In the examples, replace flyingport.example.org with your FlyingPort server, alice with your user name, fpu_… with
your token and router.home.example.org with your host.
The request¶
https://flyingport.example.org/nic/update?hostname=router.home.example.org&myip=203.0.113.7
hostname: the host, or up to 20 hosts separated by commas.myip: the address – IPv4 sets the A record, IPv6 the AAAA record, both separated by a comma set both. Without it, the address the request comes from is used.offline=yesinstead ofmyip: removes the host's A and AAAA records; the host stays yours.
The user name and the token go as HTTP Basic authentication. FlyingPort answers one line per host:
| Answer | Meaning |
|---|---|
good <address> |
The record is set. |
nochg <address> |
The host had that address already; nothing changed. |
badauth |
The user name or the token is wrong (HTTP 401). |
nohost |
Not your host, its zone is disabled, or the token is limited to another host. |
notfqdn |
Not a full domain name. |
numhost |
More than 20 hosts; nothing changed. |
dnserr |
Not a valid public address (private, loopback, documentation ranges are refused). |
abuse |
The token sent more than 120 requests in the last hour; nothing changed. |
911 |
PowerDNS could not be reached or refused the change; nothing changed – try later. |
A client updating once a minute stays below the limit; most only send when the address changed.
A router¶
In the router's dynamic DNS settings choose a custom or "user-defined" provider:
- Update URL:
https://flyingport.example.org/nic/update?hostname=<domain>&myip=<ipaddr>,<ip6addr>– the placeholders in angle brackets are the router's own (these are a FRITZ!Box's; see your router's manual). - Domain name:
router.home.example.org - User name:
alice; password: the update token.
ddclient¶
# /etc/ddclient.conf
protocol=dyndns2
ssl=yes
server=flyingport.example.org
login=alice
password='fpu_…'
router.home.example.org
inadyn¶
# /etc/inadyn.conf
custom flyingport {
username = alice
password = fpu_…
ddns-server = flyingport.example.org
ddns-path = "/nic/update?hostname=%h&myip=%i"
hostname = router.home.example.org
}
A cron job with curl¶
The token in a file only its owner reads – not on the command line, where every user's ps sees it:
printf 'machine flyingport.example.org login alice password %s\n' 'fpu_…' > ~/.flyingport.netrc
chmod 600 ~/.flyingport.netrc
*/5 * * * * curl -fsS --netrc-file ~/.flyingport.netrc 'https://flyingport.example.org/nic/update?hostname=router.home.example.org'
Without myip, the address the request comes from is set.
A script that needs the address itself -- to compare it, or for another client -- gets it as one plain line from /ip,
without a token:
curl -s https://flyingport.example.org/ip
The JSON API¶
Scripts may use the JSON API instead; the update token goes as a Bearer token:
curl -fsS -H 'Authorization: Bearer fpu_…' -H 'Content-Type: application/json' \
-d '{"hostname": "router.home.example.org"}' https://flyingport.example.org/api/v1/update
It answers {"results": [{"host": "router.home.example.org", "answer": "good 203.0.113.7"}]}. GET /api/v1/ip answers
the address a request comes from, without a token. A personal API token (profile) does everything you can do on the
pages: list, claim and release hosts, read the history, manage update tokens – PATCH /api/v1/tokens/<id> with
{"name": "…"} renames one.