Mikrotik支持IPv6的配置教程
我们首先要注册 IPv6 运营商
打开:https://www.tunnelbroker.net/
哈哈 这里我们看着挺简单的,制作可是挺麻烦的事情。
下面的我们要做的是在Mikrotik的路由器里进行配置
/interface 6to4 add comment="Hurricane Electric IPv6 Tunnel Broker" disabled=no local-address=221.9.44.54 mtu=1280 name=sit1 remote-address=66.220.18.42
/ipv6 route add comment="" disabled=no distance=1 dst-address=2000::/3 gateway=2001:470:c:5db::1 scope=30 target-scope=10
/ipv6 address add address=2001:470:c:5db::2/64 advertise=no disabled=no eui-64=no interface=sit1
命令:
/interface 6to4 add comment="Hurricane Electric IPv6 Tunnel Broker" disabled=no local-address=221.9.44.54 mtu=1280 name=sit1 remote-address=66.220.18.42
/ipv6 route add comment="" disabled=no distance=1 dst-address=2000::/3 gateway=2001:470:c:5db::1 scope=30 target-scope=10
/ipv6 address add address=2001:470:c:5db::2/64 advertise=no disabled=no eui-64=no interface=sit1
执行完毕看一下Mikrotik 的状态:
接下来我们要做ipv6的路由
不是固定ip 的用户可以用动态更新,下面我们来做一下
# Update Hurricane Electric IPv6 Tunnel Client IPv4 address
# Add /system scheduler
:local HEtunnelinterface "sit1"
:local HEtunnelid "这里填ID:460632"
:local HEuserid "这里是账号:333duo"
:local HEpass "这里是密钥:cFJZFKTzJcbUpn8o"
:local HEupdatehost "ipv4.tunnelbroker.net"
:local HEupdatepath "/nic/update"
:local WANinterface "这里是外网网卡的名字:PPPOE-OUT"
:local outputfile ("HE-" . $HEtunnelid . ".txt")
# Internal processing below...
# ----------------------------------
:local HEipv4addr
# Get WAN interface IP address
:set HEipv4addr [/ip address get [/ip address find interface=$WANinterface] address]
:set HEipv4addr [:pick [:tostr $HEipv4addr] 0 [:find [:tostr $HEipv4addr] "/"]]
:if ([:len $HEipv4addr] = 0) do={
:log error ("Could not get IP for interface " . $WANinterface)
:error ("Could not get IP for interface " . $WANinterface)
}
# Update the HEtunnelinterface with WAN IP
/interface 6to4 {
:if ([get ($HEtunnelinterface) local-address] != $HEipv4addr) do={
:log info ("Updating " . $HEtunnelinterface . " local-address with new IP " . $HEipv4addr . "...")
set ($HEtunnelinterface) local-address=$HEipv4addr
}
}
/tool fetch mode=http \
host=($HEupdatehost) \
url=("http://" . $HEupdatehost . $HEupdatepath . \
"?username=" . $HEuserid . \
"&password=" . $HEpass . \
"&hostname=" . $HEtunnelid . \
"&myip=" . $HEipv4addr) \
dst-path=($outputfile)
:log info ([/file get ($outputfile) contents])
/file remove ($outputfile)
更新脚本:
# Update Hurricane Electric IPv6 Tunnel Client IPv4 address
# Add /system scheduler
:local HEtunnelinterface "sit1"
:local HEtunnelid "这里填ID:460632"
:local HEuserid "这里是账号:333duo"
:local HEpass "这里是密钥:cFJZFKTzJcbUpn8o"
:local HEupdatehost "ipv4.tunnelbroker.net"
:local HEupdatepath "/nic/update"
:local WANinterface "这里是外网网卡的名字:PPPOE-OUT"
:local outputfile ("HE-" . $HEtunnelid . ".txt")
# Internal processing below...
# ----------------------------------
:local HEipv4addr
# Get WAN interface IP address
:set HEipv4addr [/ip address get [/ip address find interface=$WANinterface] address]
:set HEipv4addr [:pick [:tostr $HEipv4addr] 0 [:find [:tostr $HEipv4addr] "/"]]
:if ([:len $HEipv4addr] = 0) do={
:log error ("Could not get IP for interface " . $WANinterface)
:error ("Could not get IP for interface " . $WANinterface)
}
# Update the HEtunnelinterface with WAN IP
/interface 6to4 {
:if ([get ($HEtunnelinterface) local-address] != $HEipv4addr) do={
:log info ("Updating " . $HEtunnelinterface . " local-address with new IP " . $HEipv4addr . "...")
set ($HEtunnelinterface) local-address=$HEipv4addr
}
}
/tool fetch mode=http \
host=($HEupdatehost) \
url=("http://" . $HEupdatehost . $HEupdatepath . \
"?username=" . $HEuserid . \
"&password=" . $HEpass . \
"&hostname=" . $HEtunnelid . \
"&myip=" . $HEipv4addr) \
dst-path=($outputfile)
:log info ([/file get ($outputfile) contents])
/file remove ($outputfile)
上面的脚本内容我们通过工具来一键生成 到www.rosjb.com下载
https://pan.baidu.com/share/init?surl=eS4BRNk (cfaw)解压密码:4321
做一下测试ipv6的入网测试
http://test-ipv6.com/
以上就做完了
联系QQ:1064331063
转载勿扰!