For using a dynamic ip address, dyndns.com provides a great free service. Below is a script which takes care of updating the account host ip periodically, taking care only to update when the local address and host ip differs. It uses whatismyip.org for looking up the local ip address - useful if you are sitting behind a router.
#!/bin/sh
USER=xxx
PASS=xxx
HOST=xxx
HOSTIP=`host $HOST | cut -d ” ” -f4`
MYIP=`wget -q -O - whatismyip.org`
if [ “$HOSTIP” != “$MYIP” ];
then wget –http-user=$USER –http-password=$PASS -O /dev/null \
http://members.dyndns.org:8245/nic/update?system=dyndns&hostname=${HOST}&myip=${MYIP}&wildcard=ON”
fi
No comments:
Post a Comment