This method no longer works for Videotron.
I will update this guide with a method compatible with the Helix router (in bridge mode) when I have one.
It should however be possible to adapt it for Hurricane Electric's free tunneling service.
-----------------------------
2021 update:
A friend (Mezmenir) brewed me a new script:
Simply edit the values at the top as necessary. You can obtain the values you need on the Videotron 6RD Calculator.
Code: Select all
:local ipv4mask 0.3.255.255
:local ipv4relay 74.59.126.1
:local ipv6mask [ :toip6 "0000:0000:003F:FFFF::" ]
:local ipv6prefix [ :toip6 "2607:FA48:6DC0:0000::" ]
:local broadcast "bridge"
:local hex do={
:local a [ :tonum $1 ]
:local b [ :tonum $2 ]
:local c
:local result ""
:for i from=0 to=($a - 1) step=4 do={
:set c (($b >> $i) & 0xF)
:set result ([ :pick "0123456789ABCDEF" $c ($c + 1) ] . $result)
}
:return $result
}
/ipv6 {
nd {
set [ find default ] interface=$broadcast \
advertise-dns=yes \
advertise-mac-address=yes \
managed-address-configuration=no \
other-configuration=yes
}
}
:local wanip
:local addr4
:local addr6
#:while (true) do={
:do {
:set addr4 [ /ip address get [ find interface="ether1" ] address ]
:set addr4 [ :pick $addr4 0 [ :find $addr4 "/" ] ]
:if (([ :len $addr4 ] = 0) || ($wanip = $addr4)) do={ :error "" }
:set wanip $addr4
:set addr4 ($addr4 & $ipv4mask); # extract the relevant bits
:set addr4 ($addr4 << 4 ); # shift for prefix alignment
:set addr4 [ $hex 32 [ :tonum $addr4 ] ]; # expand to padded hex for ipv6
:set addr6 ($ipv6mask & [ :toip6 ("0000:0000:" . [ :pick $addr4 0 4 ] . ":" . [ :pick $addr4 4 8 ] . "::") ])
:set addr6 ($ipv6prefix | $addr6)
# from here, assign as you would -> addr6 contains your prefix
:do {
/ipv6 route remove [ find where comment="6rd" ]
/ipv6 address remove [ find where comment="6rd" ]
/ipv6 pool remove [ find where name="6rd" ]
/interface 6to4 remove [ find where name="6rd" ]
/interface 6to4 add clamp-tcp-mss=yes dscp=inherit !keepalive name="6rd" \
local-address=$wanip remote-address=$ipv4relay
/ipv6 firewall filter {
remove [ find where comment="6rd" ]
add action=accept chain=input connection-state=established,related comment="6rd"
add action=accept chain=input connection-state=new in-interface=!ether1 comment="6rd"
add action=accept chain=input protocol=icmpv6 limit=100/5s,0:packet comment="6rd"
add action=drop chain=input comment="6rd"
add action=accept chain=forward connection-state=established,related comment="6rd"
add action=accept chain=forward connection-state=new in-interface=!ether1 out-interface=ether1 comment="6rd"
add action=accept chain=forward connection-state=new in-interface=!ether1 out-interface=!ether1 comment="6rd"
add action=drop chain=forward comment="6rd"
add action=accept chain=input connection-state=established,related comment="6rd"
add action=accept chain=input connection-state=new in-interface=!6rd comment="6rd"
add action=accept chain=input protocol=icmpv6 limit=100/5s,0:packet comment="6rd"
add action=drop chain=input comment="6rd"
add action=accept chain=forward connection-state=established,related comment="6rd"
add action=accept chain=forward connection-state=new in-interface=!6rd out-interface=6rd comment="6rd"
add action=accept chain=forward connection-state=new in-interface=!6rd out-interface=!6rd comment="6rd"
add action=drop chain=forward comment="6rd"
}
/ipv6 pool add name="6rd" prefix=($addr6 . "/60") prefix-length=64
/ipv6 address {
add address=::/64 advertise=yes interface=$broadcast from-pool="6rd" comment="6rd"
add address=($addr6 . "/60") advertise=no interface="6rd" comment="6rd"
}
/ipv6 route add distance=1 dst-address=2000::/3 gateway="6rd" comment="6rd"
} on-error={ :log error "failed to create 6rd interface" }
} on-error={}
# :delay 30s
#}
:log info $wanip
:log info $addr6