Gentoo Wiki


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc
Wikipedia has an article on:


IPv6 Benefits

Kernel IPv6 Support

First, enable IPv6 support in your kernel:

Linux Kernel Configuration: Enable IPv6
Device Drivers --->
Networking support --->
Networking options --->
   <*> The IPv6 protocol (EXPERIMENTAL)
   [*] IPv6: IPv6-in-IPv4 tunnel (SIT driver)

Then recompile your kernel and reboot.

Connect to the IPv6 Network

To connect to IPv6 network, you first need an IPv6 address. Few ISP's provide their customers with IPv6 addresses. Tunneling is a way to connect to the IPv6 network without support from ISP. There are a few tunneling techniques, tunnel brokers and 6to4 being the most useful for a home user.

Tunnel brokers are organizations that provide IPv6-over-IPv4 tunneling end points for users. There's a list of IPv6 tunnel brokers in Gentoo IPv6 Router Guide. They usually require a registration, and then provide you an IPv6 address.

6to4 is defined in RFC 3068. It uses a special prefix to distinguish from other IPv6 addresses. The IPv6 address of a host is composed from the prefix and its IPv4 address. There are many 6to4 tunneling end points around the world, and all of them have the anycast IPv4 address 6to4 requires no registration, the user just needs to compose his IPv6 address using the prefix and his IPv4 address.

NOTE: if you are behind a NAT router, you will also need to install Miredo ( to use anycast prefix.

IPv6 Tunneling with Sixxs

Sixxs is a tunnel broker. To get an IPv6 address, you need to register.

To configure a static tunnel using the Gentoo init scripts add the following to your /etc/conf.d/net


depend_sixxs() {
       need net.eth1

iptunnel_sixxs="mode sit remote <RemoteIPv4Address> local <LocalIPv4Address> ttl 64 dev eth1"
routes_sixxs=("2003::/3 via <RemoteIPv6Address>")

IPv6 Tunneling with is a free tunnel broker. Registration is via website. Example configurations and user forums are online. There are examples for using either ifconfig or ip commands under Gentoo to quickly establish the tunnel.

IPv6 Tunneling with 6to4

Gentoo networking scripts provide automatic 6to4 support (with baselayout-1.12.0_pre16 or newer). To begin with, you need to come up with a name for the tunnel interface. If you have not installed iproute2, you have to use interface name sit0. Otherwise the name can be anything you want, Gentoo's own examples dictate using 6to4. The instructions below assume using 6to4 as a name. Replace it with sit0 if you are not using iproute2.

First, symlink net.lo to your new interface:

cd /etc/init.d/
ln -s net.lo net.6to4

Then, edit your /etc/conf.d/net and add the following, where "eth0" is your desired host interface with a public IPv4 address. The 6to4 address is calculated automatically by the system.

config_6to4=( "ip6to4" )
depend_6to4() {
        need net.eth0

That's all there is to it. You can verify the functionality by issuing

/etc/init.d/net.6to4 start
ifconfig 6to4

and checking that you indeed have a 6to4 address (starting with 2002:).

If you are running a 6to4 interface on say, a router, and you'd like to provide IPv6 tunneling to your clients, the following guide may be of interest.

IPv6 Tunneling with FreeNet6

Note: Kernel compiled with TUN/TAP Support (Driver) Required

FreeNet6 works behind NAT with no problems. Register for an account at Go6

emerge -av freenet6

Edit /etc/freenet6/gw6c.conf and add:


Change in:




/etc/init.d/gw6c start

[P.S] There are more parts for change IPV6. Use less :P

If you want a router instead of host. Enable the router in the config and install radvd. Then

ln -s /etc/freenet6/gw6c-rtadvd.conf /etc/radvd.conf
/etc/init.d/radvd start

Info Stealth` - Gentoo user =p

Native IPv6

There are two ways you can get native IPv6 (that I know of) : on a DSL link for your regular Internet access at home, and on an Ethernet link if you rent/own a dedicated server somewhere.


Firewall Using iptables and ip6tables

To set up a firewall for IPv6, use ip6tables. If you use tunneling (tunnel brokers), the IPv6 packets hit the IPv4 iptables first. You need to pass the IPv6 packets through to process them in the IPv6 iptables. This can be done by accepting packets with protocol ipv6: iptables -A INPUT -i eth0 -p ipv6 -j ACCEPT The command assumes that eth0 is your host interface with a public IPv4 address.

Let Your Applications Use IPv6

  1. Add ipv6 USE flag to your /etc/make.conf file.
  2. Then you will have to re-emerge some applications: emerge --newuse world

Some applications need explicit configuration to use IPv6, while some use it automatically. For IPv6 enabled Gentoo mirrors, see, and look for URLs ending in an asterisk (*). To configure wget prefer IPv6 over IPv4 when fetching files from Gentoo mirror, add the following lines in your /etc/make.conf.

# Make wget prefer IPv6
FETCHCOMMAND="/usr/bin/wget --prefer-family=IPv6 -t 5 --passive-ftp \${URI} -P \${DISTDIR}"
RESUMECOMMAND="/usr/bin/wget -c --prefer-family=IPv6 -t 5 --passive-ftp \${URI} -P \${DISTDIR}"
Note: An alternative is to edit /etc/wget/wgetrc and uncomment the last line:
prefer-family = IPv6

Further Reading

Retrieved from ""

Last modified: Fri, 26 Sep 2008 04:45:00 +0000 Hits: 32,924