Skip to content

Netcup DynDNS is a lightweight tool written in TypeScript that updates your domains with your current public IP address.

License

Notifications You must be signed in to change notification settings

tekgator/netcup-dyndns

Repository files navigation

netcup-dyndns

GitHub Workflow Status GitHub Release Date GitHub last commit

Netcup DynDNS is a lightweight tool written in TypeScript that updates your domains with your current public IP address. This project is not affiliated with Netcup GmbH or any other service provider.

buy-me-a-coffee

If I've helped you and you like some of my work, feel free to buy me a coffee ☕ (or more likely a beer 🍺)

Buy Me a Coffee at ko-fi.com

Description

Since ddclient does not support Netcup, I decided to develop a small tool to update DNS records with the current public IP address. While there are existing solutions, none fully meet my requirements. For instance, some rely on running a PHP script via a cron job, lack support for managing multiple domains, or cannot handle updates for specific subdomains within a domain.

The goal of this tool is to provide an easy-to-use solution packaged as a Docker image. It should be simple to configure and adaptable to various needs, making it a convenient and efficient choice for managing DNS updates.

Details

  • Configurable refresh interval
  • Multi domain support
  • Multi subdomain / host support
  • IPv4 and IPv6 support
  • Multiple public IP providers to choose from
  • If multiple IP providers are configured a fallback will be used if one fails
  • more to come...

Notes on the AVM FRITZ!Box IP Provider

Using the FRITZ!Box API to request the current local IP address is the fastest way to retrieve the public IP address. No API key or password is required, and no external requests are made, ensuring speed and keeping everything local. The drawback of the SOAP request is that it returns either an IPv4 or an IPv6 address, but not both. Based on my testing, the results are as follows:

From my testing I get the following results:

Internet Provider Setup SOAP returns IPv4 SOAP returns IPv6
Ipv4 and Ipv6 Yes No
Ipv4 only Yes No
Ipv6 only No Yes

Conclusion

  • If your provider offers an IPv4 address and you only need IPv4, the FRITZ!Box IP provider is the best choice.
  • If your provider only offers an IPv6 address and you only need IPv6, the FRITZ!Box IP provider is the best choice.
  • If you require both IPv4 and IPv6, the FRITZ!Box IP provider is not the ideal solution.

Requirements

  • a host within your network to run the tool
  • either Docker installed or NodeJS if executed without Docker
  • a Netcup account
  • a API key and password which can be obtained via the Netcup control panel

Run

Configuration / Environment Variables

Name Description Optional Default Example
CUSTOMER_ID Customer ID can be found in the Netcup CC Panel No 123456
API_KEY API access information can be created and found in the Netcup CC Panel No samplekey
API_PASSWORD API access information can be created and found in the Netcup CC Panel No samplepassword
REFRESH_INTERVAL Refresh inteval for dynamic DNS updates Yes 5m 5m = 5 minutes
60s = 60 seconds
1h = 1 hour
60 = 60 seconds
IP_VERSION IP version for dynamic DNS updates Yes 4 0 = Both
4 = IPv4
6 = IPv6
USE_CACHE Cache public IP address
true = use IP cache; only query Netcup DNS records if IP address change is detected locally
false = do not use IP cache; always query DNS records
Yes true true or 1
false or 0
IP_PROVIDERX IP provider to use for dynamic DNS updates Yes icanhazip
identme
ipify
myip
seeip
IP_PROVIDER1=icanhazip
IP_PROVIDER2=ipify
IP_PROVIDER3=identme
IP_PROVIDER4=myip
IP_PROVIDER5=seeip
IP_PROVIDER6=fritzbox
IP_PROVIDER7=randomip
DOMAINX Provide only the zone name, e.g. sample.com or including its subdomains, comma seperated after the zone name (required, at least one domain is required) No DOMAIN1=sample1.com
DOMAIN2=sample2.com,sub1,sub2
DOMAIN3=sample3.com,*,@,sub1

Use with docker-compose:

A sample docker-compose file can be found within the repository.

netcup-dyndns:
  image: tekgator/netcup-dyndns:latest
  container_name: netcup-dyndns
  restart: unless-stopped
  environment:
    # Customer ID can be found in the Netcup CC Panel (required)
    CUSTOMER_ID: 123456

    # API access information can be created and found in the Netcup CC Panel (required)
    API_KEY: samplekey
    API_PASSWORD: samplepassword

    # Domain configuration: Provide only the zone name, e.g. sample.com
    # or including its subdomains, comma seperated after the zone name
    # (required, at least one domain is required)
    DOMAIN1: sample1.com
    DOMAIN2: sample2.com,sub1,sub2
    DOMAIN3: sample3.com,*,@,sub1

Use with docker run:

docker run -d \
  --name netcup-dyndns \
  --restart unless-stopped \
  # Customer ID can be found in the Netcup CC Panel (required)
  -e CUSTOMER_ID=123456 \

  # API access information can be created and found in the Netcup CC Panel (required)
  -e API_KEY=samplekey \
  -e API_PASSWORD=samplepassword \

  # Domain configuration: Provide only the zone name, e.g. sample.com
  # or including its subdomains, comma seperated after the zone name
  # (required, at least one domain is required)
  -e DOMAIN1=sample1.com \
  -e DOMAIN2=sample2.com,sub1,sub2 \
  -e DOMAIN3=sample3.com,*,@,sub1 \

  tekgator/netcup-dyndns:latest