Skip to content

Instantly share code, notes, and snippets.

@peaceman
Created July 14, 2012 09:09
Show Gist options
  • Save peaceman/3110152 to your computer and use it in GitHub Desktop.
Save peaceman/3110152 to your computer and use it in GitHub Desktop.
ipv6 tunnel script
#!/bin/bash
old_ip=$(cat last_ip)
ip=$(dig +short googlerocks.dyndns.org)
echo $ip > last_ip
if [ "$ip" = "$old_ip" ]; then
echo "nothing to do"
else
echo "updating tunnel"
ip tunnel del v6-tunnel
ip tunnel add v6-tunnel mode sit remote $ip local 176.9.43.248 ttl 255
ip link set v6-tunnel up
ip addr add 2a01:4f8:150:54e3:abcd::1/80 dev v6-tunnel
ip route add 2a01:4f8:150:5ff5::/64 dev v6-tunnel
ip -f inet6 addr
fi
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment