How do you update your dynamic IP address with cURL and LoopiaDNS?

cURL is a command-line tool for UNIX and Linux systems that can be used to update your dynamic IP address with Loopia’s DynDNS service. This article shows the commands to send an update and provides a small shell script that detects your current IP address automatically.

Important: In the --user option you always enter the username and password for your Loopia Customer Zone account, regardless of which domain name you want to update. The domain name is not your username. The domain name to update goes in the hostname parameter.

Update the IP address manually

The command below sends an update for a single hostname. It is written here on several lines for readability, but it should be run as a single line (the \ markers show line breaks that must be removed).

curl -s --user 'customerzone-username:customerzone-password' \
"https://dyndns.loopia.se? \
hostname=example.com&myip=youripaddress"

Replace customerzone-username:customerzone-password with the username and password for your Loopia Customer Zone account, example.com with the domain name you want to update, and youripaddress with the IP address you want to register. The Customer Zone username is the same for every domain name you update.

Update the IP address automatically

The script below fetches your current public IP address and sends it to Loopia in one go. Again, it must be run as a single line.

#!/bin/sh
curl -s --user 'customerzone-username:customerzone-password' \
"https://dyndns.loopia.se?\
hostname=example.com&myip="`curl -s dyndns.loopia.se/checkip | \
sed 's/^.*: \([^<]*\).*$/\1/'`; echo

Save the contents to a file named loopiadns.sh and make it executable with chmod +x loopiadns.sh. A ready-made copy of the script is available to download here.

Was this article helpful?

Related Articles