How to start using IPv6 under Linux in less than 5 minutes

(Not updated since 2004, except to add a couple of small notes.)
[Denna sida på svenska]

Introduction

In case you didn't know, IPv6 is a new version of the Internet Protocol. The current version is IPv4. The primary purpose of IPv6 is to alleviate the shortage of IP addresses by extending the size of addresses from 32 bits to 128 bits. (Some more benefits are listed below.)

If you are like me, you probably thought that to start using IPv6, except locally on your own network, you would need one of the following:

  1. An ISP that supports (routes) IPv6 and is willing to give you one or more IPv6 addresses.
  2. Some other organization that can give you an IPv6 address and lets you create a IPv6-in-IPv4 tunnel to their IPv6 network and routes traffic to your IPv6 address through that tunnel.
It seems like you would have to go through a certain amount of trouble for a questionable benefit. But as explained below, it is much easier than that, and there is at least a couple of immediate benefits!

Here is what you need to do

Assuming you have
  1. a recent version of Linux (e.g., RedHat 9), and
  2. a public IPv4 address, let's call it aa.bb.cc.dd,
here is all you need to do to enable IPv6 networking on your computer:
setup6to4 aa.bb.cc.dd
where setup6to4 is the following shell script: I also created a more elaborate script, tun6to4, that figures out which IPv4 address to use automatically. I still use it on my own machines (October 2017).

The script assigns an IPv6 address to your computer and connects it to other IPv6 networks through a tunnel to an IPv6 relay router. The IPv6 address of your computer will be 2002:aabb:ccdd::1.

You can now try accessing some IPv6 hosts:

You can also try traceroute6 or tracepath6.

After restarting mozilla, you can also access the web sites on the above mentioned hosts, e.g. www6.altocumulus.org and www.kame.net. The latter is accessible both through IPv4 and IPv6, but the turtle near the top of the page will be animated only when you access it through IPv6.

How does it work?

There are a few key ingredients that explains why this is so simple:
  1. A lot of software already supports IPv6. This includes the Linux kernel and a lot of common Internet applications, for example Mozilla, Apache httpd, OpenSSH and Gnomemeeting (>=0.98).
  2. There is a standard called 6to4, that to every IPv4 address assigns a IPv6 network prefix, which denotes "the IPv6 network that is reachable by tunneling to that IPv4 address". The use of these IPv6 addresses is considered an interim solution until all hosts on the Internet are reachable directly with IPv6, without tunneling through IPv4. (The 6to4 IPv6 addresses begin with 2002:, while proper, permanent IPv6 addresses often begin with 2001:.)
  3. There is a special IPv4 address 192.88.99.1 that denotes "the nearest router to which all non-local IPv6 traffic can be tunneled". That router can then forward the IPv6 traffic to the appropriate IPv6 network.

What are the benefits?

Here are two immediate benefits that I can think of:
  1. If you have an uncooperative ISP that blocks certain IPv4 traffic, but doesn't block IPv6-in-IPv4 encapsulated traffic, you can do things that otherwise wouldn't be possible.
  2. Since the 6to4 standard assigns a network prefix to every IPv4 address (not just a single IPv6 address), hosts that have to hide behind NAT with IPv4 can now have their own unique, publicly visible IPv6 addresses. (Since the 6to4 network prefix associated with every IPv4 address is 48 bits long, and IPv6 addresses are 128 bits long, you have 280 IPv6 addresses at your disposal!)
In the long run, the transition to IPv6 should On the whole, it appears that completing the transition to IPv6 should thus make the Internet cheaper and better for everybody.

December 2020: many ISPs and hosting services still do not provide IPv6 connectivity, and since the use of the 6to4 anycast address is no longer supported, for many people the situation is now worse than it was 5-10 year ago…

More information

A few starting points:
Valid HTML 5!
TH, 2004-01-10 (updated 2004-02-20, thanks to Corwin Burgess).