Connecting a Domain to a Network with a Changing IP using Dynamic DNS (Linux)
Please use the “Print” function at the bottom of the page to create a PDF.
A static IP address is usually required so that a computer, a home network, or a small company network can always be reached through the Internet under the same host name. This is also necessary if you want to connect to your home network using a VPN, for example. However, if your home network or small business network is connected to the Internet through certain types of connections like DSL, a new (dynamic) IP address is regularly assigned to the network. As a result, the computer, home network, or small business network cannot be permanently reached using the IP address.
In this case, you can use Dynamic Domain Name System (DNS) to automatically update the constantly changing IP addresses in the domain's DNS record so that your home network is permanently accessible under your domain.
To use the Dynamic DNS, you can use the multi-platform client from IONOS. This multi-platform client was written in Python.
The following describes the steps required to use the multi-platform client:
Installing Python on a Computer Running Ubuntu
The following step-by-step instructions will show you how to install Python on a computer running the Ubuntu operating system.
Check for the Installation
Check whether Python is already installed. To do this, enter the following command:
python --version
To check if pip is installed correctly, enter the following command:
pip --version
Install Python
To install Python 3.x, enter the following commands.
sudo apt update
sudo apt upgrade
sudo apt install software-properties-common
sudo apt-get install python3To install pip, enter the following command:
apt install python-pip
Installing the Multi-Platform Client
To install the multi-platform client, enter the following command:
pip install domain-connect-dyndns
To add the domain whose DNS settings are to be updated automatically, type the following command:
domain-connect-dyndns setup --domain NAME_OF_THE_DOMAIN
Example:
domain-connect-dyndns setup --domain example.com
Copy the URL and paste it into your browser.
Log in to IONOS.
Click Allow.
Make a copy of the code displayed.
Open the command prompt and enter the code.
To update all domains, type the following command:
domain-connect-dyndns update --all
For example, after entering the command, the following message appears:
[root@localhost ~]# domain-connect-dyndns update --all
Read example.com config.
IP 217.160.25.20 found in A record
New IP: 217.160.25.20
A record up to date.For the IP address to be updated regularly in the DNS record, a cronjob must be configured. To edit the crontab file, type the following command:
crontab -e
Please Note
Cron jobs are executed by the Cron-Deamon. The Cron-Deamon is a service with which you can execute time-based scripts and programs. The commands to be executed are stored in a table, which is called Crontab.
Information on editing and building the crontab file and syntax can be found in the article Cron.
Insert the cron job below:
*/1 * * * * /usr/bin/flock -n /tmp/ipupdate.lck /usr/local/bin/domain-connect-dyndns update --all --config /root/dyndns/settings.txt