This script working for ::/32 IPv6 segment and 100.0.0.0/8 IPv4 segment
what you need to do on mikrotik (you just need to set uplink/local interface and of course your IPv6 prefix, 6RD relay):
Code: Select all
:global ipv6localinterface "PASTE YOUR LOCAL IFACE NAME HERE"
:global uplinkinterface "PASTE YOUR UPLINK IFACE NAME HERE"
:global IPv4addr [/ip address get [find interface=$uplinkinterface] address];
:global IPv4addr [:pick $IPv4addr 0 [:find $IPv4addr "/"]]
:global IPv4addr2 [:pick $IPv4addr 4 30]
:global IPv6temp [:toip6 ("1::" . $IPv4addr2)]
:global IPv4hex [:pick $IPv6temp 3 15]
:global IPv6addr [("PASTE YOUR IPv6 PREFIX FOR 6RD HERE". $IPv4hex ."00::1/64")]
:global IPv6addrLoc [("PASTE YOUR IPv6 PREFIX FOR 6RD HERE". $IPv4hex ."01::1/64")]
#6to4 interface
:global 6to4id [/interface 6to4 find where name="6rd"]
:if ($6to4id!="") do={
:global 6to4addr [/interface 6to4 get $6to4id local-address]
if ($6to4addr != $IPv4addr) do={ :log warning "Updating local-address for 6to4 tunnel '6rd' from '$6to4addr' to '$IPv4addr'."; /interface 6to4 set [find name="6rd"] local-address=$IPv4addr }
} else { :log warning "Creating 6to4 interface '6rd'. "; /interface 6to4 add !keepalive local-address=$IPv4addr mtu=1480 name="6rd" remote-address=PASTE YOUR IPv4 ADDRESS OF 6RD RELAY HERE }
#ipv6 for uplink
:global IPv6addrnumber [/ipv6 address find where comment="6rd" and interface="6rd"]
:if ($IPv6addrnumber!="") do={
:global oldip ([/ipv6 address get $IPv6addrnumber address])
if ($oldip != $IPv6addr) do={ :log warning "Updating 6rd IPv6 from '$oldip' to '$IPv6addr'."; /ipv6 address set number=$IPv6addrnumber address=$IPv6addr disabled=no }
} else {:log warning "Setting up 6rd IPv6 '$IPv6addr' to '6rd'. "; /ipv6 address add address=$IPv6addr interface="6rd" comment="6rd" advertise=no }
#ipv6 for local
:global IPv6addrnumberLocal [/ipv6 address find where comment=("6rd_local") and interface=$ipv6localinterface]
:if ($IPv6addrnumberLocal!="") do={
:global oldip ([/ipv6 address get $IPv6addrnumberLocal address])
if ($oldip != $IPv6addrLoc) do={ :log warning "Updating 6rd LOCAL IPv6 from '$oldip' to '$IPv6addrLoc'."; /ipv6 address set number=$IPv6addrnumberLocal address=$IPv6addrLoc disabled=no }
} else {:log warning "Setting up 6rd LOCAL IPv6 '$IPv6addrLoc' na '$ipv6localinterface'. "; /ipv6 address add address=$IPv6addrLoc interface=$ipv6localinterface comment="6rd_local" advertise=yes }
#ipv6 route
:global routa [/ipv6 route find where dst-address="2000::/3" and gateway="6rd"]
if ($routa="") do={ :log warning "Setting IPv6 route '2000::/3' pres '6rd'. "; /ipv6 route add distance=1 dst-address="2000::/3" gateway="6rd" }
and here is, what do you need to do on your debian machine.
To check if your kernel supports 6RD, run: $ grep 6RD /boot/config-$(uname -r)
/etc/network/interfaces
Code: Select all
#ipv4
iface eth0 inet static
address 100.110.0.10
netmask 255.255.255.240
gateway 100.110.0.2
#ipv6
iface eth0 inet6 static
address PASTE YOUR IPv6 PREFIX FOR RELAY HERE:110::10
netmask 64
gateway PASTE YOUR IPv6 PREFIX FOR RELAY HERE:110::1
#6rd
auto tun6rd
iface tun6rd inet6 v4tunnel
address PASTE YOUR IPv6 PREFIX FOR 6RD HERE:6e00:0a00::1
netmask 32
local 100.110.0.10
endpoint any
ttl 64
up ip tunnel 6rd dev tun6rd 6rd-prefix PASTE YOUR IPv6 PREFIX FOR 6RD HERE::/32 6rd-relay_prefix 100.0.0.0/8
up ip link set mtu 1480 dev tun6rd