Skip to content

Instantly share code, notes, and snippets.

@geekgonecrazy
Created March 23, 2011 02:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geekgonecrazy/882540 to your computer and use it in GitHub Desktop.
Save geekgonecrazy/882540 to your computer and use it in GitHub Desktop.
Bash script update he ipv6 tunnel info
#!/bin/bash
#
#Script to update ip on Hurricane Electric every 30 minutes
#@author Aaron Ogle
#Variables
HE_userid=<userid>
HE_passwd=<passwordhash> #echo -n "yourpassword" | md5sum
HE_tunnelid=<tunnelid>
#Tossing it in a function
updateip() {
#Loop to keep IP updated
while [ true ]
do
#Get Current IP.
NewIP=$(curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//')
if [ "$OldIP" != "$NewIP" ]
then
curl -k -s "https://ipv4.tunnelbroker.net/ipv4_end.php?ipv4b=AUTO&pass=$HE_passwd&user_id=$HE_userid&tunnel_id=$HE_tunnelid" > /dev/null
echo 'Updated IP:'$NewIP
else
echo 'Unchanged'
fi
#Sleep for 30 Minutes
OldIP="$NewIP"
sleep 1800
done
}
#Calling it. This is done so it can be added to the startup.
updateip &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment