Skip to content

Instantly share code, notes, and snippets.

@codebutler
Created May 30, 2010 03:00
Show Gist options
  • Save codebutler/418735 to your computer and use it in GitHub Desktop.
Save codebutler/418735 to your computer and use it in GitHub Desktop.
#!/bin/sh
set -e
ip4=$1
echo "$ip4" | grep -q '^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*$' || \
{ echo 'Syntax: $0 a.b.c.d'; exit 1; }
prefix=$(printf '%02x%02x:%02x%02x\n' $(echo $ip4 | sed 's/\./ /g'))
ip tunnel add 6to4 mode sit remote any local $ip4
ip link set dev 6to4 up
ip addr add 2002:$prefix::1/16 dev 6to4
ip -6 route add ::/0 via ::192.88.99.1 dev 6to4 metric 1026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment