Free DynDNS service - access with changing public IP.
Anyone who wants to access a private network from the Internet may need a DynDNS service (dynamic DNS, DynDNS or DDNS) for this purpose. If the Internet provider assigns a different IP address for each connection, a DynDNS service can react to this and enable access via a constant DNS name.
What is DynDNS?
DynDNS is a service on the Internet for dynamically updating DNS records. DynDNS updates the IP address of a DNS record when the IP address of the Internet access changes. With DynDNS, web services can be published from the private network even if the Internet connection does not have a fixed IP address.
How does DynDNS work?
The technology behind DynDNS is very simple. The core is a DNS server of a DynDNS provider with an extension for dynamically adjusting the entries. In order for the service to know the current IP address of the Internet access, the DynDNS service must be contacted regularly by a client service from the private network. As client a simple script is sufficient, which regularly initiates a HTTP GET call, similar to the call of a URL via the browser. The call can be made from the router or any device or service from the internal network. The DynDNS service needs a unique identifier in the call, so that it is able to link the request to the correct DNS name. As unique identifier a username and password, or a specific key can be used.
First of all, an account with a DynDNS provider and a stored DNS name are required.
The following schematic illustration shows how it works:
1) |
So that the DynDNS service knows the correct IP address, the service must first be contacted from the own network by calling a certain URL. When contacting the DynDNS service from the private network, the IP address is updated for the previously created DNS name, here myprivatehost.dyndns.tld.
The technique behind this is relatively simple: |
---|---|
2) | Devices on the Internet can change the DNS name for the connection to the private Internet access. |
3) | As with any access, the responsible DNS SERVER, here DynDNS server resolves the DNS name to the IP address. |
4) | The connection to the private Internet access is established. |
5) | In the private network the router accepts the connection and forwards it by means of port forwarding to the responsible web service. |
Why are there so many DynDNS providers?
The multitude of different DynDNS providers can probably be explained by the fact that the technology behind DynDNS is not really complex. As an example, there are some ready-made projects, including in the form of Docker containers, with the help of which it is very easy to run your own DynDNS service. The prerequisite for an own DynDNS service is a registered domain, the entry of a name server in the DNS zone and a web server with a static IP address. If you want to operate your own DynDNS service, you can already do this with a classic V-server or cloud server of a hosting provider.
DynDNS in practice: Concrete example with dynv6.com
Most recently, I used the DynDNS service of dynv6.com. The setup of dynv6 is very simple. Already during registration a DNS name is created:
Detailed instructions are listed for the setup:
If you call the URL from your own home network via any device in the browser, the IP address of the previously created domain name changes to the public IP address of the Internet access. The call should be executed regularly via a service on the router, or from a device in the internal network.
Dynamic DNS client directly at the router, example with OpenWrt
Certain routers have a DynDNS client service, like for example the free router firmware OpenWrt, see: topic/openwrt
In OpenWrt the DynDNS client is the software package luci-app-ddns available:
After activating the package, "Dynamic DNS" can be configured under "Services":
Templates for countless DDNS service providers are available for the configuration. I have tested the function with the DynDNS provider dynv6.com:
In my setup, the router on the WAN interface does not have a public IP address because I have the router upstream from the provider, so I had to change the settings "IP Address source" to "URL":
Details to my setup, see: Set up home network: Variant 2.
The check interval is stored in the timer settings. How often the IP should be checked, by default every 30 minutes:
If the update process works, the last successful update is listed under "Last Update":
A look back at the dynv6 website shows us the update:
If the router does not provide a DynDNS client, a simple Docker container can be used as an alternative.
DynDNS client Docker
If you use Docker for your web services anyway, or if the router does not provide a DynDNS function, you can deploy the DynDNS client using a simple Docker container:
For Docker, I created the file: docker-compose.yml with the following content:
version: "2"
services:
ddclient:
image: linuxserver/ddclient
container_name: ddclient
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/London
volumes:
- ./config:/config
restart: always
In addition, I created a folder with a config file:
config/ddclient.conf:
use=web
web=checkip.dyndns.com
server=ddnss.de
protocol=dyndns2
login=none
password=Password
yourcustomDomain.dynv6.net
Of course, the file needs to be modified accordingly. The start is done with docker compose up:
docker compose up -d
The status can be viewed at any time with the following command:
docker logs ddclient -f
[custom-init] No custom services found, skipping...
..
Setting up watches.
Watches established
..
s6-rc: info: service 99-ci-service-check successfully started
SUCCESS: updating mycustomurl.home-webserver.de: good: IP address set to xx.xx.xx.xx
Can DynDNS be used with the own domain?
If the provider where the domain was registered does not offer a DynDNS function, any DynDNS provider with a CNAME record on the own domain can be used alternatively. The CNAME entry of the own domain then points to the domain name of the DynDNS provider, which in turn has stored the dynamic IP address.
Conclusion
If the internet provider does not provide a fixed IP address, DynDNS can still be used to access a web service in the internal LAN.
The operation of the following web services is described in more detail on this page:
See also: secure https connection: Traefik Reverse Proxy + Let's Encrypt
{{percentage}} % positive