Talk:HOWTO Dynamic DNS with EveryDNS

From Gentoo Linux Wiki

Jump to: navigation, search

The note stated in the article is exactly is what my situation is, since my router handles the PPoE connection to the isp, my computer does not know exactly when the WAN ip changes! Any suggestions on how to resolve this issue? I was thinking of running a script that compares what the dns resolves to the output of whatismyip.com or something to run the dns updater script.

here you go:

File: edns-updater
#!/bin/sh

user=$1
pass=$2

ip=`wget -q http://checkip.dyndns.org/ -O - | awk -F"Current IP Address: " '{ printf $2 }' | awk -F\< '{ printf $1 }' && echo`

echo "Current ip: $ip" | logger -t everydns
if [ ! -r /tmp/edns-ip ] || [ $ip != `cat /tmp/edns-ip` ]; then
	echo "Updating dns" | logger -t everydns
	/usr/local/bin/edns -u $user -p $pass -ip $ip > /tmp/edns-messages
	ret=$?
	cat /tmp/edns-messages | logger -t everydns
	
	if [ $ret -eq 0 ]; then
		echo $ip > /tmp/edns-ip
		echo "Updating /tmp/edns-ip" | logger -t everydns
	else
		echo "Failed to update dns" | logger -t everydns
	fi	
fi

Personal tools