Linux NetworkManager IPv6 Tunnel Config

From AAISP Support Site

If you've tried all the listed methods of creating a 6in4 tunnel and found them unreliable or not working, it could be NetworkManager interfering with your setup - this is often the case if you want the tunnel to work with your 3G connection.

One workaround would be to set it up like this - this was done on Debian jessie, but should be similar for others:

First, find the name of the connection file in /etc/NetworkManager/system-connections - in my case it's "Andrews & Arnold connection" - the name is passed to NM Dispatcher scripts in $CONNECTION_ID and will be used in the example below.

In /etc/NetworkManager/dispatcher.d, create the file 99smart6in4.sh, containing the following:

#!/bin/sh
STATUS=$2
REMOTE=81.187.81.6
IPADDR=2001:8b0:XXXX:YYYY::1/64 (where XXXX is the third "word" of your /48, and YYYY is the fourth word of a suitable /64)

if [ "$CONNECTION_ID" = "Andrews & Arnold connection" ] && [ "$STATUS" = "up" ]; then
        ip tunnel add 6in4 mode sit remote $REMOTE
        ip link set 6in4 up mtu 1280
        ip addr add $IPADDR dev 6in4
        ip route add ::/0 dev 6in4
fi

if [ "$CONNECTION_ID" = "Andrews & Arnold connection" ] && [ "$STATUS" = "down" ]; then
        ip link set 6in4 down
        ip tunnel del 6in4
fi

Set the file's ownership and permissions to root.root, 755.

This should give you IPv6 on the connection in question, and tear the tunnel down when you are not using it so that native IPv6 will work on other connections.