:global l2tpname ("l2tp1") ##l2tp接口名称
:global hostip ("l2tp.2288.org") ##l2tp服务器动态域名,可用希网或是dhcp.biz
:global ddnsip [:tostr [:resolve $hostip] ]
:if ([ :typeof $ddnsip ] = nil ) do={ :global ddnsip "0" }
:global l2tpip [ /interface l2tp-client get [/interface l2tp-client find name=$l2tpname ] connect-to]
:if ($ddnsip != $l2tpip) do={
/interface l2tp-client set [ /interface l2tp-client find name=$l2tpname ] connect-to=$ddnsip
:log info ("l2tp-client:$l2tpname Change connect-to IP " . $l2tpip . " to " . $ddnsip)
}
加入计划任务,每一段时间检测服务器ip是否变化,如果变化更新ip,连接vpn
阅读(4823) | 评论(0) | 转发(1) |