Skip to content

Instantly share code, notes, and snippets.

@bjo81
Last active January 24, 2019 13:03
Show Gist options
  • Save bjo81/463565fc4706aad2b80e31e660c25f75 to your computer and use it in GitHub Desktop.
Save bjo81/463565fc4706aad2b80e31e660c25f75 to your computer and use it in GitHub Desktop.
Script for dynamic 6in4 tunnel
#!/bin/sh
#ping endpoint
ping -q -c2 2a07:59c6:eeff:cafe::beef > /dev/null
if [ $? -eq 0 ]
then
#echo "ipv6 endpoint reachable"
echo
else
ip=$(dig +short bla.nsupdate.info)
echo "updating ipv4 endpoint to $ip"
ip tunnel del bjo
ip tunnel add bjo mode sit remote $ip local 185.194.141.xy ttl 255
ip link set bjo up
ip link set mtu 1472 bjo
ip addr add 2a07:59c6:eeff:cafe::cafe/64 dev bjo
ip route add 2a07:59c6:eeff:4011::/64 dev bjo table 42
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment