{"id":246,"date":"2011-11-27T19:47:00","date_gmt":"2011-11-27T11:47:00","guid":{"rendered":"https:\/\/ros.tw\/wp\/?p=246"},"modified":"2011-11-27T19:47:00","modified_gmt":"2011-11-27T11:47:00","slug":"routeros-v5-x-%e7%89%88%e7%9a%84-ddns-for-dyndns-%e8%85%b3%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/ros.tw\/wp\/?p=246","title":{"rendered":"RouterOS V5.x \u7248\u7684 DDNS for DynDNS \u8173\u672c"},"content":{"rendered":"<p><b>\u5b98\u7db2 RouterOS V5.x \u7248\u7684 DDNS for DynDNS \u8173\u672c<\/b><br \/><b><br \/><\/b><br \/><span>:local ddnsuser &#8221;\u00a0DynDNS\u7684\u5e33\u865f&#8221;<\/span><br \/><span>:local ddnspass &#8221;\u00a0DynDNS\u7684\u5bc6\u78bc&#8221;<\/span><br \/><span>:local theinterface &#8220;pppoe-out\u90a3\u7247\u7db2\u5361\u4ecb\u9762&#8221;<\/span><br \/><span>:local ddnshost &#8220;\u60a8\u6240\u7533\u8acb\u7684DDNS\u7db2\u5740&#8221;<\/span><\/p>\n<p><span>:local ipddns [:resolve $ddnshost];<\/span><br \/><span>:local ipfresh [ \/ip address get [\/ip address find interface=$theinterface ] address ]<\/span><br \/><span>:if ([ :typeof $ipfresh ] = nil ) do={<\/span><br \/><span>\u00a0 \u00a0:log info (&#8220;DynDNS: No ip address on $theinterface .&#8221;)<\/span><br \/><span>} else={<\/span><br \/><span>\u00a0 \u00a0:for i from=( [:len $ipfresh] &#8211; 1) to=0 do={<\/span><br \/><span>\u00a0 \u00a0 \u00a0 :if ( [:pick $ipfresh $i] = &#8220;\/&#8221;) do={<\/span><br \/><span>\u00a0 \u00a0 :set ipfresh [:pick $ipfresh 0 $i];<\/span><br \/><span>\u00a0 \u00a0 \u00a0 }<\/span><br \/><span>}<\/span><\/p>\n<p><span>:if ($ipddns != $ipfresh) do={<\/span><br \/><span>\u00a0 \u00a0 :log info (&#8220;DynDNS: IP-DynDNS = $ipddns&#8221;)<\/span><br \/><span>\u00a0 \u00a0 :log info (&#8220;DynDNS: IP-Fresh = $ipfresh&#8221;)<\/span><br \/><span>\u00a0 \u00a0:log info &#8220;DynDNS: Update IP needed, Sending UPDATE&#8230;!&#8221;<\/span><br \/><span>\u00a0 \u00a0:local str &#8220;\/nic\/update?hostname=$ddnshost&#038;myip=$ipfresh&#038;wildcard=NOCHG&#038;mx=NOCHG&#038;backmx=NOCHG&#8221;<\/span><br \/><span>\u00a0 \u00a0\/tool fetch address=members.dyndns.org src-path=$str mode=http user=$ddnsuser \\<\/span><br \/><span>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0password=$ddnspass dst-path=(&#8220;\/DynDNS.&#8221;.$ddnshost)<\/span><br \/><span>\u00a0 \u00a0 :delay 1<\/span><br \/><span>\u00a0 \u00a0 :local str [\/file find name=&#8221;DynDNS.$ddnshost&#8221;];<\/span><br \/><span>\u00a0 \u00a0 \/file remove $str<\/span><br \/><span>\u00a0 \u00a0 :global ipddns $ipfresh<\/span><br \/><span>\u00a0 :log info &#8220;DynDNS: IP updated to $ipfresh!&#8221;<\/span><br \/><span>\u00a0 \u00a0 } else={<\/span><br \/><span>\u00a0 \u00a0 \u00a0:log info &#8220;DynDNS: dont need changes&#8221;;<\/span><br \/><span>\u00a0 \u00a0 }<\/span><br \/><span>\u00a0}<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b98\u7db2 RouterOS V5.x \u7248\u7684 DDNS for DynDNS \u8173\u672c:l &hellip; <a href=\"https:\/\/ros.tw\/wp\/?p=246\">\u95b1\u8b80\u5168\u6587 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-246","post","type-post","status-publish","format-standard","hentry","category-ros"],"_links":{"self":[{"href":"https:\/\/ros.tw\/wp\/index.php?rest_route=\/wp\/v2\/posts\/246","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ros.tw\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ros.tw\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ros.tw\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ros.tw\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=246"}],"version-history":[{"count":0,"href":"https:\/\/ros.tw\/wp\/index.php?rest_route=\/wp\/v2\/posts\/246\/revisions"}],"wp:attachment":[{"href":"https:\/\/ros.tw\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ros.tw\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=246"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ros.tw\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}