The following script allows you to set up an auto-updating DynDNS using the Netcup API.
Note
You do not necessarily need a Fritz!Box. Anything that can call some URL and provide an IP address will work.
Who is this for?
Anyone who is a customer with Netcup GmbH and has a Domain there, and wants to point, e.g., a subdomain of that to their own home router.
What do you need?
You'll need to be a customer with Netcup and you need to have a domain there that uses Netcup's DNS Nameservers. You also need some web space where PHP runs, and which is publicly accessible. Also, the PHP needs the cURL extension.
You can get started in a few easy steps:
- Download the script
ddns.phpand place it somewhere accessible onto a web server. - Check that it works by visiting the correct domain (e.g.,
http://example.com/ddns.php) and confirm that the script is accessible - Once that is confirmed, think of a username or password and set them in the script (
updateUserandupdatePass). These are NOT the Netcup login credentials. These are just so that nobody can just arbitrarily run this script. - Next, retrieve your credentials from Netcup. You can find all of them in the Customer Control Panel:
customerID,apiKey,apiPass. You will need to accept some terms to generate a new key, and you then also need to generate a password for that key. - Now, ensure that you have your wanted DNS record set in the customer control panel. For example, if you wish to use the domain
ddns.example.com, ensure that there is an "A"-entry for "ddns" under the domain "example.com" that points to somewhere. I recommend you leave it to something "wrong" so that you can later verify that the script correctly runs. - Once the entry is created, use your browser's developer tools to inspect the new entry and retrieve the record ID. (The input element should have a
nameproperty with a value looking like this:record[1234567][host]). The number is what you want. - Now, place all of this information into the script and save it.
You can now provide the link to the script to your Fritz!Box (or whatever else) so that it automatically updates the DNS record whenever your IP address changes. A full example for an Update URL with Fritz!Box would look like this: https://example.com/ddns.php?ipv4=<ipaddr>&user=<username>&pass=<pass>&domain=<domain>. (Note that this script has hard-coded the domain, because I only need one. If you want to, update the script accordingly.)