前面有写ROS上使用花生壳动态域名的,这个整理下3322的配置,其实方法都一样只是更换了脚本
3322脚本如下:
:global ednsuser "3322用户"
:global ednspass "3322密码"
:global ednshost "3322域名"
:global ednsinterface "PPPOE-WAN3"
:global members "http://members.3322.org/dyndns/update\?system=dyndns"
:global status
:global status [/interface get [/interface find name=$ednsinterface] running]
:if ($status!=false) do={
:global ednslastip [:resolve $ednshost]
:if ([ :typeof $ednslastip ] = nil ) do={ :global ednslastip "0" }
:global ednsiph [ /ip address get [/ip address find interface=$ednsinterface ] address ]
:global ednsip [:pick $ednsiph 0 [:find $ednsiph "/"]]
:global ednsstr "&hostname=$ednshost&myip=$ednsip"
:if ($ednslastip != $ednsip) do={
/tool fetch url="$members$ednsstr" mode=http user=$ednsuser password=$ednspass dst-path=$ednshost
:delay 4
:global result [/file get $ednshost contents]
:log info ($ednshost . " " .$result)
/file remove $ednshost ;
}
}
或者
:local ednsuser "3322用户"
:local ednspass "3322密码"
:local ednshost "3322域名"
:local ednsinterface "PPPOE-WAN4"
:local members "http://members.3322.org/dyndns/update?system=dyndns"
#:local members "http://members./nic/update?"
:local status
:local status [/interface get [/interface find name=$ednsinterface] running]
:if ($status!=false) do={
:local ednslastip [:resolve $ednshost]
:if ([ :typeof $ednslastip ] = nil ) do={ :local ednslastip "0" }
:local ednsiph [ /ip address get [/ip address find interface=$ednsinterface ] address ]
:local ednsip [:pick $ednsiph 0 [:find $ednsiph "/"]]
:local ednsstr "&hostname=$ednshost&myip=$ednsip"
:if ($ednslastip != $ednsip) do={/tool fetch url=($members . $ednsstr) mode=http user=$ednsuser password=$ednspass dst-path=$ednshost
:delay 2
:local result [/file get $ednshost contents]
:log info ($ednshost . " " .$result)
/file remove $ednshost ;
}
}
脚本利用ROS的/tool fetch来访问一个3322的网页
http://members.3322.net/dyndns/update?system=dyndns&hostname=xxx&myip=xxx
这个方法也是3322官方提供的,3322的server就可以从这个http请求中得到你的真实IP地址了
添加脚本以及创建任务计划参照前面的 ROS使用花生壳动态域名的配置