Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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=<password hash>
HE_tunnelid=<tunnelid>
#Get current ip.
CurrentIP=$(curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//')
#Initial update to services
echo ***Starting update script***
HE_updateparms='ipv4b='$CurrentIP'&user_id='$HE_userid'&pass='$HE_passwd'&tunnel_id='$HE_tunnelid
curl -F $HE_updateparms http://ipv4.tunnelbroker.net/ipv4_end.php
echo 'Ip set:'$CurrentIP
#Loop to keep time updated
address='dynamic'
until [$address -eq 'static'];
do
#Get Current IP again.
IP=$(curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.$//')
if ["$CurrentIP" != "$IP"];
then
#Could use AUTO instead of passing. But were've already got it.
#Might as well pass it
curl -F $HE_updateparms http://ipv4.tunnelbroker.net/ipv4_end.php
echo 'Updated IP:'$IP
else
echo 'Unchanged.'
fi
#Sleep for 30 Minutes
sleep 1800
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment