RouterOS 解析动态域名自动更新 PPTP网卡IP

 admin   2020-11-05 14:40   3012 人阅读  0 条评论

适用:ROS 连接没有固定 IP 的 PPTP 时使用

脚本更新网卡时根据网卡备注查找,请确认备注正确。

脚本如下:

:global xin

:global adb

ip dns cache flush

#上面这一行在测试环境下使用,如果真实环境请注释

:set xin [:resolve www.xcloud.xyz]

#域名请修改为自己的域名

:set adb [/interface pptp-client get [find comment ="sdvp"] connect-to]

#查找是基于备注查找,如果你的备注是123

#那么将comment ="sdvp"中的sdvp改为123

:if ($xin !=$adb) do={

/interface pptp-client set [/interface pptp-client find comment ="sdvp"] connect-to=$xin

/interface pptp-client enable [/interface pptp-client find comment ="sdvp"]

/ip firewall filter set [/ip firewall filter find comment="sdvp"] src-address=$xin

}


1.png

本文地址:https://www.zxbblog.com/?id=326
版权声明:本文为原创文章,版权归 admin 所有,欢迎分享本文,转载请保留出处!

 发表评论


表情

还没有留言,还不快点抢沙发?