cURL

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.

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 'user:password' \\
"https://dns.loopia.se/XDynDNSServer/XDynDNS.php? \\
hostname=example.com&myip=youripaddress"

Replace user:password with your Loopia API credentials, example.com with the hostname you want to update, and youripaddress with the IP address you want to register.

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 'user:password' \\
"https://dns.loopia.se/XDynDNSServer/XDynDNS.php? \\
hostname=example.com&myip="`curl -s  dns.loopia.se/checkip/checkip.php | \\
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