DebianIPv6 – Debian Wiki

IPv6 6to4 Configuration

You may not know this, but if you have a public IPv4 address you already have IPv6 addresses reserved. There is a transitional system called 6to4 (sometimes written stf or 6 to 4) that maps any IPv4 address an entire subnet of IPv6 addresses. You can use it to assign a single address to your system, or as the prefix for your local IPv6 network. You can also use the method for making a private IPv6 network by using a private IPv4 (RFC 1918) address instead of the deprecated « site-local » fec0::/10 addresses.

To configure 6to4, you need to calculate an IPv6 address, based on your existing IPv4 address. You can do so using the shell. In this example the IPv4 address is, you’ll replace that with your actual public internet address. The ::1 on the end says this is machine address 1 in subnet 0. You have 16 bits of network and 64 bits of host addresses available.

$ printf « 2002:%02x%02x:%02x%02x::1\n » 192 0 2 3


or use ipv6calc which gives you the prefix

$ ipv6calc –quiet –action conv6to4


Now edit /etc/network/interfaces, and add a stanza like this using a dedicated tunnel device named tun6to4 (or whatever you wish to call it):

auto tun6to4

iface tun6to4 inet6 v4tunnel

address 2002:c000:0203::1

netmask 16

gateway ::

endpoint any

local #fits address

Or using the deprecated sit0 interface:

auto sit0

iface sit0 inet6 static

address 2002:c000:0203::1

netmask 16

gateway ::

The address is a special anycast address that points to the nearest 6to4 router. Assuming that your nearest 6to4 router work, all you should need to do is ifup tun6to4 (or sit0) and enjoy your new IPv6 connectivity!

Experienced IPv6 users will wonder why the netmask for sit0 is /16, not /48; by setting the netmask to /16, you instruct your system to send packets directly to the IPv4 address of other 6to4 users; if it was /48, you’d send packets via the nearest relay router, increasing latency.

The sit0 example may result in a responses with an IPv4 address that doesn’t match the 6to4 address on a multihomed host. Also the generic tunnel device sit0 doesn’t let you specify filtering per device.

viaDebianIPv6 – Debian Wiki.