Community discussions

MikroTik App
 
Xenhat
just joined
Topic Author
Posts: 7
Joined: Fri Dec 30, 2016 9:41 pm

Working 6rd script for Videotron customers without Helix

Sun May 20, 2018 3:16 pm

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.
: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
All the credit goes to him.
 
belanger
just joined
Posts: 6
Joined: Sat Feb 19, 2022 5:03 am

Re: Working 6rd script for Videotron customers without Helix

Sat Feb 19, 2022 5:19 am

Took me long to find this script, I finally have a smile on my face and can let go google. tomorrow afternoon I'm supposed configure my new Fizz modem in bridge and at the same time, this new mikrotik router :) It's a lot of changes happening at the same time and if I can't make both v4/v6 coexist, I won't stick with fizz more than a month.

My understanding is that your script will also work for Fizz... but just earlier by chat, I was told they assign IPv6 address only when the IPv4 pool is exhausted Apparently you never get both and I'm worried now. I do wonder if I'll be able to do things like I've done since a long time. Will find out tomorrow.

Just so I understand clearly your script.

. ipv4relay
This is the IPv4 assigned to the modem?

. ipv4mask 0.3.255.255
I've never been a videotron customer, is that the actual IPv4 network for the 74.x.x.x/xx ?

Thanx for providing this script here even if it was a little bit hard to find.
 
Xenhat
just joined
Topic Author
Posts: 7
Joined: Fri Dec 30, 2016 9:41 pm

Re: Working 6rd script for Videotron customers without Helix

Sun Feb 20, 2022 4:35 pm

Hi!
I will address the points I can individually.
[...]
My understanding is that your script will also work for Fizz...
[...]
Technically speaking, this script will work with any provider, as long as the values it needs are available. It is tailored for Videotron, but a free tunnel provided by Hurricane Electric (He) uses a similar configuration as they both uses encapsulation methods to "shove" ipv6 inside ipv4. This is far from ideal, but it allows access to ipv6 until native rollout happens.
. ipv4relay
This is the IPv4 assigned to the modem?
No. The values are named as they are presented by the tool from Videotron. This is most likely the address of the ISP router doing the encapsulating/whatever.
. ipv4mask 0.3.255.255
I've never been a videotron customer, is that the actual IPv4 network for the 74.x.x.x/xx ?
There is no guarantee you can use this value as-is. I believe the network mask is dynamic/provided by the ISP script from internal data, these values don't appear to be calculable by themselves. Since Videotron owns several address pools, the value can be different depending on your public IPv4 address.

Final note: I do not know much about Fizz. If it uses the Videotron address pools, you may have some luck using this script without too many changes, but I wouldn't hold my breath.
 
belanger
just joined
Posts: 6
Joined: Sat Feb 19, 2022 5:03 am

Re: Working 6rd script for Videotron customers without Helix

Sun Feb 20, 2022 5:06 pm

Since my post above, I learned Fizz is owned by Videotron! The technician had a regular Videotron van to deliver the modem and check to make sure we had cable signal. 55$/m for 120/20 - speedtest ~130/24. No contract/no install fee, it's a no brainer. If you decide to switch - ELWLH.

Yes they use the same address space/network as Videotron.

With this new info, I'm going to try your script as-is and reply a little later.
 
belanger
just joined
Posts: 6
Joined: Sat Feb 19, 2022 5:03 am

Re: Working 6rd script for Videotron customers without Helix

Sun Feb 20, 2022 6:53 pm

I tried everything but couldn't get IPv6 to work... since I'm still quite new w/ mikrotik and first script, here's what I did to try it out.
. scp videotron-6rd.rsc mikrotik-gw:.
. ssh mikrotik-gw
. > import file-name=videotron-6rd.rsc
Script file loaded and executed successfully
FYI I noticed the IPv4 relay in your config currently points to a modem-cable IP address.
1.126.59.74.in-addr.arpa = modemcable001.126-59-74.mc.videotron.ca.
I've seen post from other users where the IP was different but within the same network range. As a Fizz customer, we don't have access to the Videotron tool to figure out the IPv6 config :/ If you have any suggestions to try, let me know - otherwise Fizz IPv6 might not an option for now.

Who is online

Users browsing this forum: Bing [Bot], Ratatouille, Scoobyn8 and 11 guests