6to4 is a small script to create/delete 6to4 tunnels.
6to4 is a small script to create/delete 6to4 tunnels.

This creates a standard 6to4 tunnel. With this tunnel, everyone with an IPv4 connection can give their network full IPv6 connectivity without the need for further configuration. In case of a dynamically assigned IPv4 address, this creates a dynamic, but fully functional, IPv6 network prefix. See RFC 3056, RFC 3068.

Requires Linux 2.6 and an appropriate version of iproute; radvd recommended.

Assume your IPv4 address (e.g. the local end of your PPP connection) is, the tunnel is created from 2002:0102:0304::1 to :: Also the local network is assigned the address 2002:0102:0304::/48 and the IPv6 default route is set into the tunnel. (Where "default" currently means 2000::/3, which includes all assigned global unicast addresses.) The kernel routing handles the 2002::/16 prefix specially as defined in RFC 3056. The remote address is a globally assigned anycast address for tunneling; there are routers all over the world which handle this transparently. (If you happen to have a dedicated IPv6 tunnel router change the REMOTE addresses below.)

This script can be called from /etc/ppp/ip-up like:

6to4 up "$4" eth0

and likewise from /etc/ppp/ip-down:

6to4 down "$4" eth0

Substitute the local ethernet interface for eth0 as needed.

To announce the 6to4 network prefix and default route into your local network, use the following radvd.conf:

interface eth0 {
AdvSendAdvert on;
MinRtrAdvInterval 20;
MaxRtrAdvInterval 60;
AdvLinkMTU 1400; adapt as needed
prefix 2002::/64 {
AdvOnLink off;
AdvAutonomous on;
AdvRouterAddr on;
Base6to4Interface tun64; note this!
AdvPreferredLifetime 90;
AdvValidLifetime 120;

The trick here is that we assign the local IPv4 address (redundantly) to the tunnel interface, so radvd picks it from the tunnel instead of the PPP device. So radvd announces the tunnel only when it's really up.

last updated on:
January 25th, 2007, 17:46 GMT
license type:
Public Domain 
developed by:
Olaf Titz
ROOT \ System \ Networking
Download Button

In a hurry? Add it to your Download Basket!

user rating



Rate it!

Add your review!