I found this script that I wanted to use for updating dyndns. This is to be run on my router which is linux based. Here is the script
This is what 'nslookup username.dyndns.org' returns
The script returns 192.168.1.1#53 for the 'OLD_IP' variable. If I change the first two 1's in the 'OLD_IP' variable to 2's, it returns my real WAN address that is on the second 'Address' line above. However, the script still always says that the addresses don't match even when they do and still updates dyndns. If my current WAN matches what dyndns has for my address the script should stop. Help!
Code:
#!/bin/sh
DYNDNS_ALIAS=username.dyndns.org
OLD_IP=`nslookup ${DYNDNS_ALIAS} | grep Address | head -n 1 | sed 's/Address 1: \([0-9\.]*\).*/\1/'`
NOW_IP=`/sbin/ifconfig ppp0 | /bin/grep inet | /bin/sed 's/.*addr:\([^ ]*\).*/\1/'`
if [ "${OLD_IP}" != "${NOW_IP}" ]; then
echo "Old IP ${OLD_IP} does not match new IP of ${NOW_IP}"
/usr/bin/wget -O /dev/null http://username:password@members.dyndns.org/nic/update?hostname=${DYNDNS_ALIAS}
fi
This is what 'nslookup username.dyndns.org' returns
Code:
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
Name: username.dyndns.org
Address: **.*.***.***
The script returns 192.168.1.1#53 for the 'OLD_IP' variable. If I change the first two 1's in the 'OLD_IP' variable to 2's, it returns my real WAN address that is on the second 'Address' line above. However, the script still always says that the addresses don't match even when they do and still updates dyndns. If my current WAN matches what dyndns has for my address the script should stop. Help!
