What is dynamic DNS?
Dynamic DNS technology allows you to give your home network PC or server a permanent address on the Internet. Internet service providers change your IP address on a regular basis, but with dynamic DNS you can keep your domain name pointed to the current IP address of your home server or other devices.
Set up dynamic DNS (DDNS) for your Raspberry Pi using dynu.com free service
Sign up for a dynu.com account: Go to the dynu.com website (https://www.dynu.com/) and sign up for a free account. Provide the necessary information and create a new domain name (e.g., yourdomain.dynu.com) or use an existing domain if you have one.
Raspberry Pi
You can create a script in Raspberry Pi and setup a cron job to run every 5 minutes to keep your hostnames updated to the most current IP address.
1. Create a directory to put the files into.
cd ~
mkdir dynudns
cd dynudns
2. Create a dynu.sh script with the command to update the IP address. For security reasons, you should use the MD5 hash of your password. If you use the regular password, please be sure to URL encode any special characters in the password.
nano dynu.sh
echo url=”https://api.dynu.com/nic/update?username=USERNAME&password=PASSWORD” | curl -k -o ~/dynudns/dynu.log -K –
3. Make dynu.sh executable.
chmod 700 dynu.sh
4. Use a cron job to make the script run every 5 minutes.
crontab -
e
Add the following to the bottom of the crontab:
*/5 * * * * ~/dynudns/dynu.sh