Skip to content

Rewriting my php-based dyndns service

You might probably read the post about my own dyndns service in conjunction with the ddns client of my router Fritzbox. It sends a few parameters to a php script, which calls the DNS api of the domain hoster. You can find the first post to this here.

As days went by, the connection was more or less stable, but somehow only the IPv4 part of it. The Fritzbox is spamming a message like “dyndns script said ok, but dns check seems not ok”, while resending the call to the php script per 15-25min periods. The IPv6 connection on :80/:443 would just get into the login screen of the router, which is not what I want.

Getting in contact with the support of AVM didn’t really brought any solution, as I’ve only got some links “for further info” to their wiki of the used router model. Well, yeah, … no. So I had to rethink my whole situation again. Fritzbox’ ddns client is not suitable for my need. The NAS has a ddns client on-board, but only limited to preset providers. Self-made it is, then.

With my newly acquired docker skills (👀), I’ve created a small container with a script based on the docker curl image.

Explaining the script in a few steps:

  • A cronjob runs every 5 minutes
  • The shellscript checks if the ipv6 prefix of the main interface has been changed since last run
  • If FALSE:
    • exit and wait for next cron run
  • If TRUE:
    • temp-save the new IPv6 in a file
    • start the docker container which does:
      • get the url with all needed parameters from a docker volume
      • send the request + params to the url, while forcing a ipv4 connection(!)
    • stop the docker container

I have no other tools on the NAS shell that might come in handy for receiving the change event of the IPs. In this case I went a probably overcomplicated route – but in the end it works out pretty well. The PHP script on the other end has just received minor changes.

All in all, the setup is more or less complete from here. The IP reset during nighttime goes on without further problems. The NAS reverse proxy is reachable with just a small outage of max. 5 minutes when the IP reset hits. Additionally, the log of the Fritzbox is quiet again.

Perfect. 👌

Leave a Reply

Your email address will not be published.