[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

auto 6to4 tunnel for dialup ppp



I wrote some scripts that automatically bring up a 6to4 tunnel when a PPP
session is started. It should hopefully be possible for anyone to drop
these scripts right into their system, and be up and running with IPv6
immediately. The addresses and tunnel names are all auto-generated, and
the 6to4 anycast address is used, so there is no need to make any changes
to configure the scripts.

I believe that 6to4 could be the "killer protocol" that will bring about
widespread adoption of IPv6. So, even though I do not subscribe to this
mailing list, I decided to send these scripts to the list (I hope it
is an appropriate place!). It would be really nice if someone could
package these scripts up, with an appropriate set of dependencies, so
people could just type "apt-get install ppp-6to4" and end up with a
working IPv6 connection. Or at least the scripts could be posted on one
of the IPv6 related web pages.

Most people reading this probably already know what 6to4 is, but for those
who don't: 6to4 is a system through which every IPv4 address automatically
has an IPv6 netblock tunneled to it. Since the IPv4 endpoint address is
used as part of the IPv6 network address, clients do not need to register
with the 6to4 routers, they can just start sending packets and it'll work.
This means that if you have a single IPv4 address, you automatically get
1 trillion trillion IPv6 addresses (that is not a typo!). Even if you
have a dynamic IPv4 address, you still get an IPv6 address, but it changes
every time your IPv4 address does. I feel that 6to4 has great potential 
since it uses existing IPv4 infrastructure to allow immediate, wide-scale
deployment of IPv6 without the overhead of tunnel broker accounts.

Anyway, here are the scripts. By the way, with some tweaking, they could
probably also be made to work with a DHCP client for cable-modem users.


vvv-cut here-vvv    /etc/ppp/ip-up.d/6to4
#!/bin/sh

ipv4_addr=$PPP_LOCAL
dev=$PPP_IFACE

gw=192.88.99.1

ipv4_hex=`echo $ipv4_addr|sed -e s/^/16o/ -e 's/\./p/g' -e s/$/pq/|dc`
ipv6_net=2002:`echo $ipv4_hex|sed -e 's/ //' -e 's/ /:/' -e 's/ //'`
ipv6_addr=$ipv6_net::1

tunnel_name=tun6to4_$dev

ip tunnel add $tunnel_name mode sit remote any local $ipv4_addr ttl 64
ip link set dev $tunnel_name up
ip -6 addr add $ipv6_addr/16 dev $tunnel_name
ip -6 route add 2000::/3 via ::$gw dev $tunnel_name metric 1
^^^-cut here-^^^


vvv-cut here-vvv    /etc/ppp/ip-down.d/6to4
#!/bin/sh

dev=$PPP_IFACE

tunnel_name=tun6to4_$dev

ip tunnel del $tunnel_name
^^^-cut here-^^^

-- uns



Reply to: