Setting Up a 6to4 Tunnel In Debian
As I was wondering about IPv6 and because my current host (www.slicehost.com) doesn’t have native support, I decided to try out a 6to4 on my box.
Basically, a 6to4 is a system that allows IPv6 packets transmitted over IPv4 network (IPv4 Internet). (see: http://en.wikipedia.org/wiki/6to4)
First, we need to create a tunnel device. You need to install iproute package if you haven’t already
$ sudo aptitude install iproute
Create a tunnel device
$ sudo ip tunnel add tun6to4 mode sit remote anyCalculate your IPv6 address reserved to your IPv4 address. Yes, if you have a public IPv4 address you already have a IPv6 address reserved for you.
$ export MYIP=173.45.232.146 $ printf "2002:%02x%02x:%02x%02x::1\n" $(echo $MYIP | sed -e "s%\.% %g") 2002:ad2d:e892::1
Edit your /etc/network/interfaces file and add your 6to4 device
auto tun6to4 iface tun6to4 inet6 v4tunnel address 2002:ad2d:e892::1 netmask 16 gateway ::192.88.99.1 endpoint any local 173.45.232.146 #fits address
::192.88.99.1 is a special anycast address that points to the nearest 6to4 router. And assuming that router is working, get your new device up
$ sudo ifconfig tun6to4 up
You may now enjoy your IPv6 connectivity. For example:
$ ping6 -c 4 www6.ulak.net.tr PING www6.ulak.net.tr(2001:a98:10::36) 56 data bytes 64 bytes from 2001:a98:10::36: icmp_seq=1 ttl=51 time=228 ms 64 bytes from 2001:a98:10::36: icmp_seq=2 ttl=51 time=224 ms 64 bytes from 2001:a98:10::36: icmp_seq=3 ttl=51 time=224 ms 64 bytes from 2001:a98:10::36: icmp_seq=4 ttl=51 time=224 ms --- www6.ulak.net.tr ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3000ms rtt min/avg/max/mdev = 224.013/225.013/228.013/1.732 ms
References:
- http://en.wikipedia.org/wiki/6to4
- http://tldp.org/HOWTO/Linux+IPv6-HOWTO/configuring-ipv6to4-tunnels.html
- http://wiki.debian.org/DebianIPv6


1 Trackback(s)