I was recently trying to configure a dynamic DNS to host a server at home, but wanted it to be reliable and simple.
I found that namecheap provide multiple ways to configure a dynamic DNS, and even include a small executable that you can install to do this automatically. The thing is my server is running Fedora, not Windows. After searching on the namecheap website I found this article that explains how to setup dynamic DNS using DDClient.
Note : This tutorial is targeted at Fedora 31 , but should be compatible newer versions.
1. First install DDClient :
sudo dnf install ddclient
2. After DDClient is installed, we now need to generate a one time password on the namecheap website. In the domain list, navigate to manage -> Advanced Dns and toggle the dynamic dns option. This will generate a random password that will be used with DDClient.
You can then specify an A+Dynamic DNS Record (instead of the classic A Record)
After edit /etc/ddclient.conf
to add :
protocol=namecheap
use=web, web=dynamicdns.park-your-domain.com/getip
server=dynamicdns.park-your-domain.com
login=<your domain name without the www>
password=<password generated>
<subdomain>
Replace subdomain with the the one specified in the Host value of your A+Dynamic DNS Record.
You can test the config file by running the following command. You should see at the end of the logfile SUCCESS: <subdomain you specified>
sudo ddclient -daemon=0 -debug -verbose -noquiet
3. Finally we’ll create a systemd service to make sure our program keep running. Create a file in /etc/systemd/system/ddclient.service
that contains the following content:
#/usr/lib/systemd/system/ddclient.service
[Unit]
Description=ddclient Service
After=network.target
[Service]
Type=forking
PIDFile=/var/run/ddclient.pid
ExecStart=/usr/sbin/ddclient -pid /var/run/ddclient.pid -file /etc/ddclient.conf -daemon 300
ExecStop=/usr/bin/pkill -SIGKILL -P /var/run/ddclient.pid
We now need to register this service by running sudo systemctl enable ddclient.service
.
And finally we run the new service with sudo systemctl start ddclient.service
The value of the A+Dynamic DNS Record in the namecheap interface should now be updated with your current IP address!