ROS设置changeip动态域名脚本
#0.1
:local INTERFACE "pppoe-out2"
:local DDNSUSER "你的账号"
:local DDNSPASS "你的密码"
:local DDNSHOST "huakang.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
:global DDNSLASTIP $DDNSIP
}
}
}
interface 更改为自己的PPPOE-OUT
#1.0
:local INTERFACE "pppoe-out2"
:local DDNSUSER "你的账号"
:local DDNSPASS "你的密码"
:local DDNSHOST "huakang.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
/ppp profile set VPN local-address=$DDNSIP
:global DDNSLASTIP $DDNSIP
}
}
}
Dcr163的博客
http://dcr163.cn/343.html(转载时请注明本文出处及文章链接)