This HowTo is intended to provide information on updating a No-IP user account from an NSLU2. No-IP provides DNS (domain name service) for sites with dynamic IP addresses. For more information: http://www.no-ip.com
To actively have your NSLU2 update your IP address with the No-IP service a client is needed. There is a client available using ipkg that appears to be the standard No-IP Linux client ported to the NSLU. This client appears to work well enough, but it runs in a daemon mode. This solution involves a shell script that checks for an updated IP address, updates if it has changed, and then exits. It can be scheduled using cron and will not consume CPU or memory when inactive.
I have this working on my NSLU2, but am I still trying to factor this out to the minimum requirements. My setup:
- ipkg - wget
- Ability to telnet or ssh into the NSLU2
- No-IP.com account (free)
# ipkg install wget
Create noipupdate script
# noipupdate - Update IP address for www.no-ip.com account.
# 2006/03/01 v0.01 firstname.lastname@example.org - Initial script
# 2006/03/02 v0.02 email@example.com - Updated based upon http://www.no-ip.com/integrate/
# Partial support for No-IP Dynamic DNS Update Request Specification v2.1 (Standard)
# 2006/03/12 v0.03 firstname.lastname@example.org - Require user intervention after an error.
# 2007/11/10 v0.04 email@example.com - errors corrections (return --> exit and "")
# Change the following to your NO-IP username (email address), password,
# and NO-IP hostname. Only supports a single hostname. No support for
# multiple hostnames or groups
# Define the user agent string
USERAGENT="noipupdate $VERSION NSLU2 Client (http://www.nslu2-linux.org/wiki/HowTo/NoIPUpdate)"
# Define some filenames
# Output timestamp
echo -n `date "+%Y/%m/%d %H:%M:%S"`" noipupdate "
# Determine if there was an error during a previous invocation.
if [ -f $LOCKFILE ]; then
echo "Not running due to previous error ($LOCKFILE: `cat $LOCKFILE`)."
# Get the current IP address from no-ip perspective
CURIP=`wget -U "$USERAGENT" -q http://ip1.dynupdate.no-ip.com/ -O -`
# Verify that the result
if ! (echo $CURIP | grep -q '^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*$'); then
echo "$0: Invalid IP address";
# Retrieve the previous IP address
if [ -f $PREVIPFILE ];then
# Compare the current with the old and see if there is a change
if [ "$CURIP" = "$OLDIP" ]; then
echo "No IP address change ($OLDIP)"
# Attempt to update IP address
RESULT=`wget -U "$USERAGENT" -q "http://dynupdate.no-ip.com/dns?username=\
$USER&password=$PASS&hostname=$HOST&ip=$CURIP" -O - | sed -e s/.*://`
if [ "$RESULT" = "0" ] || [ "$RESULT" = "1" ]; then
echo "Update successful ($CURIP)"
echo $CURIP > $PREVIPFILE
elif [ "$RESULT" = "2" ]; then
echo "Bad host";
echo "Bad host" >$LOCKFILE
elif [ "$RESULT" = "3" ]; then
echo "Bad password";
echo "Bad password" >$LOCKFILE
elif [ "$RESULT" = "4" ]; then
echo "Bad username";
echo "Bad username" >$LOCKFILE
echo "$0: Unexpected error ($RESULT)"
echo "Unexpected error ($RESULT)" >$LOCKFILE
The file can also be downloaded
Note that in some environments wget does not recognize the -U parameter (user agent). In this case, simply substitute -U by --header or remove the complete parameter with its value.
For those who intend to edit the script file in Windows: be sure you save it in UNIX format with only LF instead of CR+LF.
Make noipupdate executable
# chmod 755 /opt/bin/noipupdate
Modify the USER, PASS, and HOST values to your appropriate No-IP account settings
If the script has been installed and configuration has been completed then run noipupdate:
If everything was successful then you should see:
2006/03/02 22:59:57 noipupdate Update successful (220.127.116.11)
Otherwise you should see an error message such as:
2006/03/02 22:59:57 noipupdate Bad password (18.104.22.168)
Hopefully the reason for the error will be obvious. You should fix the issue and then force an update (see the next section).
Any invocation of the script after an error has occurred will refuse to update without
user intervention, as per the No-IP specifications:
2006/03/12 23:13:33 noipupdate Not running due to previous error (/var/tmp/noipupdate.lock: Bad password).
Fix the problem (in this case, by correcting the password in the script), then remove the /var/tmp/noipupdate.lock file.
Forcing an update
If for some reason noipupdate gets out of sync with the No-IP service or for some other reason you would like to force an update to the No-IP servers, then you should remove the /var/tmp/noipupdate.dat file that stores the last used IP address.
# rm /var/tmp/noipupdate.dat
Recovering from an error
If noipupdate complains about 'Not running due to previous error', you should look at the contents of the file /var/tmp/noipupdate.lock, which is also printed in the message. With the printout and possibly the description of error codes at http://www.no-ip.com/integrate/response/, determine what the problem is. Fix the problem, then remove the /var/tmp/noipupdate.lock file (and probably also the /var/tmp/noipupdate.dat file, to force an update), and rerun noipupdate:
# rm /var/tmp/noipupdate.lock /var/tmp/noipupdate.dat
Each time that noipupdate runs it checks the current external IP address and compares it to the IP address from the previous time noipupdate was run. If it is the same then noipupdate exits and takes no further action. If the IP addresses are different then noipupdate will attempt to update the No-IP service with the current IP address.
For most people the entire point of this exercise is to automate the updating of the No-IP information. So now that we have a working No-IP client we need a way to automatically run it.
Add the following to /etc/crontab:
*/15 * * * * root /opt/bin/noipupdate >> /var/log/noipupdate.log 2>&1
This will cause the noipupdate client to run every 15 minutes and log its results in /var/log/noipupdate.log
This script has been minimally tested and has been presented here on 2006/3/2 for testing and use by anyone who may be interested.
There is not support for updating multiple No-IP hosts or groups. This should be relatively simple to implement, but is probably not needed for the majority of users. If there is sufficient interest support for these functions can be added.
2006/3/2 - Initial page and script added to wiki - Slackmaster (kilgore$pillarcom.com)
2006/3/12 - Updated with support for not running after an error - firstname.lastname@example.org
ipkg install noip should just give you the official client as optware package,
/opt/bin/noip2 -h for usage.