Mikaels blog
blosxom with a touch of python

Sun, 26 Feb 2006

6to4 tunnel that works with dhcp

My broadband provider stopped delivering my static ips so I had to make some modifications on my network. This is what I did to make my linksys continue serve 6to4 addresses for the correct ip.

~ # cat /jffs/radvd.conf
interface br0
{
        AdvSendAdvert on;
        MinRtrAdvInterval 3;
        MaxRtrAdvInterval 10;

        prefix 0:0:0:1::/64
        {
                AdvOnLink on;
                AdvAutonomous on;
                AdvRouterAddr on;
                Base6to4Interface vlan1;
                AdvPreferredLifetime 120;
                AdvValidLifetime 300;
        };
};
interface vlan1
{
        AdvSendAdvert on;
        MinRtrAdvInterval 3;
        MaxRtrAdvInterval 10;

        prefix 0:0:0:2::/64
        {
                AdvOnLink on;
                AdvAutonomous on;
                AdvRouterAddr on;
                Base6to4Interface vlan1;
                AdvPreferredLifetime 120;
                AdvValidLifetime 300;
        };
};

cat this text to the file apa ( to make my script survice the shell )

ip tunnel change sit0 ttl 64
ipv4_addr=`ip -4 addr |grep inet |grep vlan1 |cut -d ' ' -f6 | cut -d'/' -f1`
ipv6_addr=`printf '2002:%02x%02x:%02x%02x' \`echo $ipv4_addr | tr '.' ' '\``
ip -6 addr add $ipv6_addr::1/48 dev sit0         #Change to 6to4 prefix
ip -6 ro add 2000::/3 via ::192.88.99.1
ip -6 addr add $ipv6_addr:1::/64 dev br0        #Change to 6to4 prefix
ip -6 route add $ipv6_addr:2::/64 dev vlan1
/sbin/radvd -C /jffs/radvd.conf
cat > apa
nvram set rc_startup="`cat apa`"
nvram commit

[10:43] | [] | # |
Mikael Frykholm

Google
Webmail
Owncloud



atom
Tranquillity - Green hosting