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:
- An ISP that supports (routes) IPv6 and is willing to give you one or more IPv6 addresses.
- 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.
Here is what you need to do
Assuming you have- a recent version of Linux (e.g., RedHat 9), and
- a public IPv4 address, let's call it aa.bb.cc.dd,
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:
ping6 www.ipv6.org
ping6 www.kame.net
ping6 www6.altocumulus.org
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:- 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).
- 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 with2001:
.) - 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:- 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.
- 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!)
- permanently solve the problem with shortage of IP addresses (making NAT unnecessary, for example).
- simplify address allocation and routing (making it more hierarchical).
- make local network configuration easier (through stateless auto-configuration).
- provide better support for multi-cast, any-cast and mobility.
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:- Peter Bieringer's Linux-Section: IPv6.
- Linux IPv6 HOWTO by Peter Bieringer. This was my primary source for this tutorial.
- www.ipv6.org.
- www.kame.net. IPv6 for BSDs, with the animated turtle.
- About 192.88.99.1: RFC 3068: An Anycast Prefix for 6to4 Relay Routers. Note: the use of this anycast prefix has been deprecated since 2015 (RFC7526), due to unsolvable operational problems.
- 6to4 Configuration in Debian (requires a known IPv4 address)
- 6to4 on Wikipedia