Gentoo Wiki


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


The following script is for people who would like to run an IPv6 router with a dynamic IP and 6to4 tunneling. The main issue here is that your IP will change from time to time and your 6to4 prefix depends on your IPv4 address. Therefore, we need a script that gets run when the 6to4 interface is started that will add the appropriate address to your internal interface.

The Script

First of all, I would like to point out that this is probably not the best way to do this, but it is simple yet effective.

The following should go in a file named /etc/init.d/set-ipv6-address or similar


depend() {
need net.6to4

start() {
ebegin "Setting IPv6 address for eth0"
ifconfig ethX inet6 add `ifconfig 6to4 |grep Global|sed 's/.*inet6 addr: //'|sed 's/::.*//'`:f101::1/64
eend $?

Note: ethX should be set to your LAN-facing interface.

To finish up, start it, and add it to your default runlevel.

# /etc/init.d/set-ipv6-address start
# rc-update add set-ipv6-address default

Now test to see that your clients can access the IPv6 web! Try for example. Unformatierten Text hier einf├╝gen

Retrieved from ""

Last modified: Fri, 05 Sep 2008 22:56:00 +0000 Hits: 594