ROS DDNS脚本

 
更多

:local INTERFACE “pppoe-out1”
:local DDNSUSER “332719***@qq.com”
:local DDNSPASS “****”
:local DDNSHOST “****.changeip.net”
:global DDNSLASTIP
 
:if ([ /interface pppoe-client get [/interface pppoe-client find name=$INTERFACE ] running]=true) do={
  :local DDNSIP [ /ip address get [/ip address find dynamic=yes interface=”$INTERFACE” ] address ]
  :set DDNSIP [:pick $DDNSIP 0 [:find $DDNSIP “/”] ]
  :if ( [:typeof $DDNSLASTIP]=”nothing” ) do={ :global DDNSLASTIP 0.0.0.0/0 }
  :if ( [:typeof $DDNSIP]=”nothing” ) do={
   :log info (“DDNS: No ip address present on ” . $INTERFACE . “, please check.”)
  } else={
   :if ($DDNSIP != $DDNSLASTIP) do={
      :log info “DDNS: Sending Update”
      /tool dns-update name=$DDNSHOST address=$DDNSIP key-name=$DDNSUSER key=$DDNSPASS
#更新VPN地址
      /ppp profile set VPN_Profile local-address=$DDNSIP
      :global DDNSLASTIP $DDNSIP
   }
  }
}

打赏

本文固定链接: https://www.cxy163.net/archives/1058 | 绝缘体

该日志由 绝缘体.. 于 2016年04月25日 发表在 首页 分类下,
原创文章转载请注明: ROS DDNS脚本 | 绝缘体

报歉!评论已关闭.