mercoledì 29 dicembre 2010

Ubuntu & IPv6 (6to4 solution)

To join the Internet v6 world from an ubuntu box is really simple.

All you have to do is to follow the instructions from Zebastian on the Ubuntu forum.

The script, which will be called by NetworkManager, will take as parameters the IPv4 address of the interface just brought up and the command "up" (or "down", when the network interface will be shut).

The result is that, automatically, you will see a tun6to4 new interface, used by the 6to4 stack to route any IPv6 address your browser (or whatever else) will ask for.

The script needs anyway a fix: in fact it works out-of-the-box only as long as you don't use a ppp0 interface (the one used by a GPRS/UMTS modem, for example). The actual version cannot cope with the slightly different sintax of "sbin/ip" when the interface is ppp0, because expects a / character after the IPv4 address, while ppp0 returns a space.

To correct the behaviour of the script, just modify the sed regular expression as follows.

Old one:

sed -r -e 's:.*inet ([0-9\.]+)/.*:\1:'

Fixed one:

sed -r -e 's:.*inet ([0-9\.]+)[ /].*:\1:'

As you may notice, I introduced a pair of square brackets containing a space and a slash. So instead of expecting just a slash after the IP address, it now expectes a space (the case for ppp0) OR a slash (the case for eth0 and wlan0).

The square brackets containing the space and the slash are required, obviously.

Hope it helps, enjoy.

Nessun commento:

Posta un commento