Vidéotron IPv6 6rd with Tomato

What/Why

Update: See end of post for easier way to get IPv6!


Ever since my ISP announced their IPv6 beta, I've wanted to use it. They chose a recent protocol for their offering: 6rd. Support for this protocol is very limited among home routers and I'm not ready to give up on the advanced features found in custom firmwares.

6rd is basically a 6to4 tunnel for which we receive configuration through dhcp by enabling a flag in the request we send to our ISP. Instead of using public anycast relays, the ISP sends you the IPv4 of his own relay. And instead of using the standard 6to4 prefix 2002::/16, the ISP sends you one of his own prefix that you must combine with part of your IPv4 address to create your assigned IPv6 prefix.

In theory calculation of our assigned prefix with the info received via dhcp is easy: If the assigned prefix length is a multiple of 8 (ex: Comcast's /64), it's easy, transform your IPv4 to hexadecimal with printf and append it to ISP's prefix. But if the assigned prefix length is not a multiple of 8 (Vidéotron's /60), we must work at the binary level and this is no fun with the limited busybox sh! (See the "Calculating your settings" in the log below to visualize how the combination is done)

The script is a proof of concept tested only with my own ISP and router(Toasman miniipv6). It retrieves the 6rd information with udhcpc and it configures your router accordingly (alternatively it can tell you the values you need to populate on the gui in 6in4 tunnel section without touching your configuration). It may be desirable to create the tunsit/tunnel manually with 6rd in mind, but I thought using existing 6in4 gui capability was easier for most people.

Prerequisites

  • The script will help you retrieves correct values to configure a ipv6 tunnel on any firmware (openwrt, dd-wrt, tomatousb mods) with a patched udhcpc and ipv6 support. Auto-configuration will only work on Toastman's firmware or one of its cousins (shibby, Teaman, etc...).

How to use

Easiest way:

#SSH to your router:
root@tomato# cd /tmp
root@tomato# wget http://alexou.net/pub/script-collection/tomato-6rd.sh
root@tomato# chmod +x tomato-6rd.sh
root@tomato# ./tomato-6rd.sh


Note: The script will have to be rerun every time your IPv4 changes (In Vidéotron's case it's almost never, unless your router's MAC changes.)

Real run output

root@tomato:/tmp/home/root# /tmp/6rd.sh
udhcpc (v1.18.5) started
I'm working as expected!
Sending discover...
Sending select for 96.20.41.45...
Lease of 96.20.41.45 obtained, lease time 83700
Bound...6rd :)
ip6rd 14 42 2607:FA48:6E00:0000:0000:0000:0000:0000 96.23.219.1
ip6rd_ipv4masklen 14
ip6rd_6rdprefixlen 42
ip6rd_6rdprefix 2607:FA48:6E00:0000:0000:0000:0000:0000
ip6rd_6rdbripv4address 96.23.219.1
--------------------------
Calculating your settings:
bin_ip6rd_6rdprefix = [001001100000011111111010010010000110111000]00000000000000000000000000000000000000000000000000000000000000000000000000000000000000
bin_wanip = 01100000000101[000010100100101101]
bin_client_prefix = 001001100000011111111010010010000110111000000010100100101101
--------------------------
6in4 static tunnel settings:
Assigned / Routed Prefix = 2607:FA48:6E02:92D0::
Prefix Length = 60
Router IPv6 Address = Default
Enable Router Advertisements = yes
Tunnel Remote Endpoint (IPv4 Address) = 96.23.219.1
Tunnel Client IPv6 Address = 2607:FA48:6E02:92D0:: / 60
Do you want me to configure it for you? [y/n]y
Applying settings...done
Do you want to commit to nvram now? (Say no if you are testing) [y/n]n
Restarting network.................................................................................Killed
.........................................
Done.

root@tomato:/tmp/home/root# ping6 ipv6.google.com
PING ipv6.google.com (2607:f8b0:4002:802::1012): 56 data bytes
64 bytes from 2607:f8b0:4002:802::1012: seq=0 ttl=55 time=41.180 ms
64 bytes from 2607:f8b0:4002:802::1012: seq=1 ttl=55 time=40.246 ms
64 bytes from 2607:f8b0:4002:802::1012: seq=2 ttl=55 time=40.457 ms
64 bytes from 2607:f8b0:4002:802::1012: seq=3 ttl=55 time=40.468 ms

--- ipv6.google.com ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 40.246/40.587/41.180 ms

Download

http://alexou.net/pub/script-collection/tomato-6rd.sh

DD-WRT Version

Alexandre Blanchette made changes to the script to make it compatible with DD-WRT, you can download his version there: https://fc.csvdc.qc.ca/~blancha/ddwrt-6rd.txt. I also mirrored it there: https://alexou.net/pub/script-collection/ddwrt-6rd.txt

Update: Shibby

A reader sent me good news. Apparently Shibby firmware, version 100 up to 108, supports 6rd natively and have working RA! Why version 108? Because newer versions use dnsmasq for RA announcements and for some reason it doesn't work with Vidéotron IPv6. Version 108 or earlier use radvd.

You can see the changelog here: http://tomato.groov.pl/?page_id=78
You can download the firmware here: http://tomato.groov.pl/?page_id=164

Commentaires
avatar
Interested in checking out your script but your webserver appears to be broken (says I'm not sending a Host: header when I definitely am).

ps: nice error video.
avatar
alex
Administrateur
I fixed the wget line, thank you!
avatar
I used the script a few month ago and all went well. The mac of my router changed recently, and I rerun the script because my wan ip changed.

Now, I always get this result:

udhcpc (v1.21.1) started
I'm working as expected!
Sending discover...
Sending select for 70.81.87.12...
Lease of 70.81.87.12 obtained, lease time 2700
Bound...6rd :)
ip6rd 14 42 2607:fa48:6d80:0000:0000:0000:0000:0000 70.80.0.17
ip6rd_ipv4masklen 14
ip6rd_6rdprefixlen 42
ip6rd_6rdprefix 2607:fa48:6d80:0000:0000:0000:0000:0000
ip6rd_6rdbripv4address 70.80.0.17
--------------------------
Calculating your settings:
Unable to convert PREFIX IP to binary. Make sure it is in expanded form (::)
avatar
alex
Administrateur
Hello Simon,

Thank you for trying my script, I appreciate feedback!

In the past, Vidéotron sent the IP in higher cases (for example 22CD:CDBD instead of 22cd:cdbd). My script didn't support lower case letters. I fixed this bug and now it should work correctly.
avatar
Wow, I tried to understand the way the script was working before posting, I should have post sooner...

That's perfect, I redownload it and everything is back to normal in a matter of minutes!

Thanks!

Simon
avatar
Alexandre Blanchette
I took your script, adapted it to DD-WRT.

There's the result: https://fc.csvdc.qc.ca/~blancha/ddwrt-6rd.txt
avatar
alex
Administrateur
I'll add a link to your script in my article and will look if I can incorporate your changes in my own version when I have time. Thanks!
avatar
Hi Alex, I'm the one that had initially added the 6rd "PoC" to Shibby. I wasn't aware that Shibby had moved from radvd to dnsmasq for RA. Ever since I switched to EBox for ISP I no longer have access to any IPv6... I'll have a look at the code to see if it'd be an easy fix...
avatar
Nice work! Unfortunately, didn't work for me on OpenWRT (14.07). See:

root@OpenWrt:/tmp# ./tomato-6rd.sh: line 9: nvram: not found

Moreover, could this be turned onto an in-browser javascript tool?
avatar
Vu que cette page arrive en tête des recherche pour "videotron ipv6", notez que TomatoUSB supporte nativement le "6RD - Option 212" depuis la version Toastman 1.28.0509.2.

Juste à selectionner l'option, cliquez Save, et ça marche.
avatar
Hi,
I am trying to use your skip on a DD-WRT Netgear R8000 unfortunately I get the following error:

6in4 static tunnel settings:
Assigned / Routed Prefix = 2A00:61E0:42A9:6A00
Prefix Length = 56
Router IPv6 Address = Default
Enable Router Advertisements = yes
Tunnel Remote Endpoint (IPv4 Address) = 100.127.0.1
Tunnel Client IPv6 Address = 2A00:61E0:42A9:6A00 / 56
ioctl: No buffer space available
RTNETLINK answers: File exists
RTNETLINK answers: File exists
RTNETLINK answers: File exists
Connectez-vous ou postez en tant qu'invité:
Your Name Your Email


Vérification: 2130
Go to Top