IPv6 6in4 Tunnel via Hurricane Electric (Tunnelbroker.net): Tunnel Setup on Ubuntu 11.04

Using the CLI tool ip

I wrote the following script to set up the tunnelbroker.net IPv6 6in4 tunnel on Linux using the ip command. You have to adjust the constants to the values given on the tunnelbroker.net site on the tunnel that you created. Just execute it and you should be ready to go:


  • If you don't use the ufw firewall, comment out the line sudo ufw allow proto ipv6 from $HEIPV4SERVER as well as the following four lines.
  • To find out your current local IPv4 on the default interface, replace the line LOCALIPV4=... with this LOCALIPV4=`ip -4 addr show dev $(ip route | grep "default via" | cut -d " " -f 5) | grep inet | awk '{ print $2}' | cut -d "/" -f 1`
  • If you want to script an automatic tunnel endpoint update on the HE website (like in the script for Mac OS X) you may want to query your external IPv4 using this: EXTERNAL_IPV4=`wget -qO- http://v4.ipv6-test.com/api/myip.php`

Using /etc/network/interfaces

Hints found on https://wiki.kubuntu.org/IPv6#Get%20connected%20with%20Hurricane%20Electric and http://davecoyle.com/documents/ubuntu-ipv6-he-tunnel.html.

You can automatically set up the IPv6 tunnel by adding such an entry to your /etc/network/interfaces:

auto he-ipv6
  iface he-ipv6 inet6 v4tunnel
       address  2001:470:a:dabc::2
       netmask  64
       up ip -6 route add default dev he-ipv6
       down ip -6 route del default dev he-ipv6

You can also use the following script to add the configuration to /etc/network/interfaces:

Using ifconfig and route (deprecated)

OpenDNS via IPv6


To include an IPv6 DNS server, add the IPv6 OpenDNS servers to your /etc/resolv.conf:

nameserver 2620:0:ccc::2
nameserver 2620:0:ccd::2

Test your IPv6 connectivity

You may test your success on the site http://test-ipv6.com/.