设置全局本地ipv4接口
:global WANInterface “pppoe-out1”
设置tunnel-id
:local tid “141”
设置numbers,就是规则排序,从上往下,0开头
:local num “5”
设置 eoip name
:local eoname “eoip-tunnel-ns”
设置对方ddns地址
:local ddnsdomain “90.life”
########### 内部变量
设置变量 ipv4
:local localIP “”
:local remoteIP “”
:global WANip “”
########### 解析和设置IP变量
获取本地公网IPv4
:set localIP [/ip address get [/ip address find interface=$WANInterface ] address];
:set WANIP [:pick $localIP 0 [:find $localIP “/”]];
获取远程域名IPv4
:set remoteIP [:resolve $ddnsdomain];
/interface eoip
set name=”$eoname” tunnel-id=$tid local-address=$WANIP remote-address=$remoteIP numbers=$num;
:log info (“对方公网IPv4 $remoteIP”)
:log info (“当前公网IPv4 $WANip”)
ps:仅适用两方都有ddns并且都有公网地址.网上搜了一圈没有类似教程.故在此献丑了.然后自己按需求添加任务(Schedule)或者断线检测(netwatch)