#!/bin/bash ### The global IPv4 address for your host: GLOB_IP4=$1 ### Compute the 6TO4 tunnel IPv6 address: GLOB_IP6TO4=$(printf "2002:%x%02x:%x%02x::1" $(echo $GLOB_IP4 | tr . ' ')) ### Setup the tunnel ip tunnel add tun6to4 mode sit remote any local $GLOB_IP4 ttl 64 ip link set dev tun6to4 up ip addr add $GLOB_IP6TO4/16 dev tun6to4 ip route add 2000::/3 via ::192.88.99.1 dev tun6to4 metric 1