找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3606|回复: 3

[脚本] 发一个我的脚本。。。连接到动态IP上

[复制链接]
发表于 2008-9-27 19:08:43 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
通过PPTP连接到对方机器上。对方是动态IP。
话不多说,上脚本:
  1. :global The-Dst
  2. :global The-Previous-Dst
  3. :set The-Dst [:resolve www.sina.com.cn]
  4. :set The-Previous-Dst [/interface pptp-client get [/interface pptp-client find name=To-Dst-Connection] connect-to]

  5. :if ($The-Dst != $The-Previous-Dst) do={/interface pptp-client set [/interface pptp-client find name=To-Dst-Connection] connect-to=$The-Dst }
复制代码
请注意 3.X 变量中不支持"-"请将"-"去掉。
用得喜欢就顶一个。
www.sina.com.cn 改成你的域名,比如 aaa.changeip.com
routeros
 楼主| 发表于 2008-9-27 19:09:01 | 显示全部楼层
有啥问题可以提出。。。欢迎指正。
routeros
回复

使用道具 举报

发表于 2008-12-13 19:48:20 | 显示全部楼层
支持一下!学习。
routeros
回复

使用道具 举报

发表于 2008-12-13 20:01:37 | 显示全部楼层
3.x支持 “—”等 用引号,“” 就OK了。

很早前写的,类似
:global pptpname ("pptp-out1")
:global hostip ("www.baidu.com")
:global ddnsip [:tostr [:resolve $hostip] ]
:if ([ :typeof $ddnsip ] = nil ) do={ :global ddnsip "0" }
:global pptpip [ /interface pptp-client get [/interface pptp-client find name=$pptpname ] connect-to]
:if ($ddnsip != $pptpip) do={
/interface pptp-client set [/interface pptp-client find name=$pptpname ] connect-to=$ddnsip
:log info ("pptp:Change connect-to IP " . $pptpip . " to "  . $ddnsip)
  }
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-6-11 03:57 , Processed in 0.047516 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表