{"id":202,"date":"2018-05-12T18:48:16","date_gmt":"2018-05-12T10:48:16","guid":{"rendered":"http:\/\/www.mhfohk.com\/wordpress\/?p=202"},"modified":"2023-05-03T14:11:05","modified_gmt":"2023-05-03T06:11:05","slug":"%e6%96%bcdsm%e5%85%a7%e5%a2%9e%e5%8a%a0namecheap%e7%9a%84ddns","status":"publish","type":"post","link":"https:\/\/www.mhfohk.com\/wordpress\/2018\/05\/12\/%e6%96%bcdsm%e5%85%a7%e5%a2%9e%e5%8a%a0namecheap%e7%9a%84ddns\/","title":{"rendered":"\u65bcDSM\u5167\u589e\u52a0NameCheap\u7684DDNS(\u5df2\u52a0\u4e0aDSM6.2\u9069\u7528\u7684\u7248\u672c)"},"content":{"rendered":"<p>\u9996\u5148\uff0c\u8981\u65b0\u589e\u4e00\u500bfile,\u00a0\/usr\/syno\/bin\/ddns\/namecheap.php<br \/>\n\u65e2\u7136\u4e4b\u524d\u90fd\u6559\u5de6\u5927\u5bb6\u53ef\u4ee5\u7528 <a href=\"http:\/\/www.mhfohk.com\/wordpress\/2017\/11\/12\/dsm-config-file-%E4%BD%8D%E7%BD%AE-config-file-editor\/\">Config File Editor<\/a> \u53bb\u4fee\u6539DSM\u5605System file\uff0c<br \/>\n\u7576\u7136\u4eca\u6b21\u90fd\u6703\u7528\u8fd4\u4f62\u5566\uff0c\u5514\u9700\u8981\u518dtelnet or ssh\u53bb\u505a\u3002<br \/>\n\u5148\u6253\u958b <a href=\"http:\/\/www.mhfohk.com\/wordpress\/2017\/11\/12\/dsm-config-file-%E4%BD%8D%E7%BD%AE-config-file-editor\/\">Config File Editor<\/a>\u5957\u4ef6\uff0cChoose config file\uff0c\u518d\u63c0\u6700\u5e95Config File Editor<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-203\" src=\"http:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/1.jpg\" alt=\"\" width=\"916\" height=\"561\" srcset=\"https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/1.jpg 916w, https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/1-300x184.jpg 300w, https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/1-768x470.jpg 768w\" sizes=\"auto, (max-width: 916px) 100vw, 916px\" \/><\/p>\n<p>\u7136\u5f8c\u52a0\u5165\/usr\/syno\/bin\/ddns\/namecheap.php,NameCheap<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-204\" src=\"http:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/2.jpg\" alt=\"\" width=\"915\" height=\"563\" srcset=\"https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/2.jpg 915w, https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/2-300x185.jpg 300w, https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/2-768x473.jpg 768w\" sizes=\"auto, (max-width: 915px) 100vw, 915px\" \/><\/p>\n<p>\u95dc\u9589\u4f62\uff0c\u91cd\u958b\uff0c\u61c9\u8a72\u5c31\u591a\u5de6NameCheap\u53ef\u4ee5\u63c0<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-205\" src=\"http:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/3.jpg\" alt=\"\" width=\"915\" height=\"563\" srcset=\"https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/3.jpg 915w, https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/3-300x185.jpg 300w, https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/3-768x473.jpg 768w\" sizes=\"auto, (max-width: 915px) 100vw, 915px\" \/><\/p>\n<p>\u518d\u5c07\u4ee5\u4e0b\u5462\u6bb5php code\u8cbc\u4e0a\uff0cSave<\/p>\n<hr \/>\n<p>#!\/usr\/bin\/php -d open_basedir=\/usr\/syno\/bin\/ddns<br \/>\n&lt;?php<br \/>\nif ($argc !== 5) {<br \/>\necho 'badparam';<br \/>\nexit();<br \/>\n}<br \/>\n$account = (string)$argv[1];<br \/>\n$pwd = (string)$argv[2];<br \/>\n$hostname = (string)$argv[3];<br \/>\n$ip = (string)$argv[4];<br \/>\n\/\/ check the hostname contains '.'<br \/>\nif (strpos($hostname, '.') === false) {<br \/>\necho 'badparam';<br \/>\nexit();<br \/>\n}<br \/>\n\/\/ only for IPv4 format<br \/>\nif (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {<br \/>\necho \"badparam\";<br \/>\nexit();<br \/>\n}<br \/>\n\/\/$array = explode('.', $hostname);<br \/>\n\/\/$domain = implode('.', array_slice($array, 1));<br \/>\n\/\/$hostname = implode('.', array_slice($array, 0, 1));<br \/>\n$url = 'https:\/\/dynamicdns.park-your-domain.com\/update?host='.$account.'&amp;domain='.$hostname.'&amp;password='.$pwd.'&amp;ip='.$ip;<br \/>\necho $url;<br \/>\n$req = curl_init();<br \/>\ncurl_setopt($req, CURLOPT_URL, $url);<br \/>\ncurl_setopt($req, CURLOPT_RETURNTRANSFER, true);<br \/>\n$res = curl_exec($req);<br \/>\ncurl_close($req);<br \/>\n\/*<br \/>\nSuccess response:<br \/>\n&lt;?xml version=\"1.0\"?&gt;<br \/>\n&lt;interface-response&gt;<br \/>\n&lt;Command&gt;SETDNSHOST&lt;\/Command&gt;<br \/>\n&lt;Language&gt;eng&lt;\/Language&gt;<br \/>\n&lt;IP&gt;%ip-address%&lt;\/IP&gt;<br \/>\n&lt;ErrCount&gt;%error-count%&lt;\/ErrCount&gt;<br \/>\n&lt;ResponseCount&gt;%response-count%&lt;\/ResponseCount&gt;<br \/>\n&lt;Done&gt;true&lt;\/Done&gt;<br \/>\n&lt;debug&gt;&lt;![CDATA[]]&gt;&lt;\/debug&gt;<br \/>\n&lt;\/interface-response&gt;<br \/>\n%ip-address% = IP address<br \/>\n%error-count% = 0<br \/>\n%response-count% = 0<br \/>\nFailure response:<br \/>\n&lt;?xml version=\"1.0\"?&gt;<br \/>\n&lt;interface-response&gt;<br \/>\n&lt;Command&gt;SETDNSHOST&lt;\/Command&gt;<br \/>\n&lt;Language&gt;eng&lt;\/Language&gt;<br \/>\n&lt;ErrCount&gt;%error-count%&lt;\/ErrCount&gt;<br \/>\n&lt;errors&gt;<br \/>\n&lt;Err1&gt;%error-message%&lt;\/Err1&gt;<br \/>\n&lt;\/errors&gt;<br \/>\n&lt;ResponseCount&gt;%response-count%&lt;\/ResponseCount&gt;<br \/>\n&lt;responses&gt;<br \/>\n&lt;response&gt;<br \/>\n&lt;ResponseNumber&gt;%response-number%&lt;\/ResponseNumber&gt;<br \/>\n&lt;ResponseString&gt;%response-message%&lt;\/ResponseString&gt;<br \/>\n&lt;\/response&gt;<br \/>\n&lt;\/responses&gt;<br \/>\n&lt;Done&gt;true&lt;\/Done&gt;<br \/>\n&lt;debug&gt;&lt;![CDATA[]]&gt;&lt;\/debug&gt;<br \/>\n&lt;\/interface-response&gt;<br \/>\n%error-count% = 1<br \/>\n%error-message% = Error message<br \/>\n%response-count% = 1<br \/>\n%response-number% = Code for response message<br \/>\n%response-message% = Response message (similar to %error-message%)<br \/>\n*\/<br \/>\n$xml = new SimpleXMLElement($res);<br \/>\nif ($xml-&gt;ErrCount &gt; 0) {<br \/>\n$error = $xml-&gt;errors[0]-&gt;Err1;<br \/>\nif (strcmp($error, \"Domain name not found\") === 0) {<br \/>\necho \"nohost\";<br \/>\n} elseif (strcmp($error, \"Passwords do not match\") === 0) {<br \/>\necho \"badauth\";<br \/>\n} elseif (strcmp($error, \"No Records updated. A record not Found;\") === 0) {<br \/>\necho \"nohost\";<br \/>\n} else {<br \/>\necho \"911 [\".$error.\"]\";<br \/>\n}<br \/>\n} else {<br \/>\necho \"good\";<br \/>\n}<\/p>\n<hr \/>\n<p>\u518d\u4f86\u5c31\u662f...\u7121\u6cd5\u907f\u514d\u7528telnet\u6216\u8005ssh\u7684\u6b65\u9a5f\uff0c\u56e0\u70ba\u8981\u4fee\u6539\u6211\u5011\u525b\u525b\u5efa\u7acb\u7684\u6a94\u6848\u7684\u6b0a\u9650<br \/>\n\u5148\u5728DSM\u5167\u6253\u958btelnet\u6216\u8005ssh\u7684\u529f\u80fd\uff0c\u4ee5\u4e0b\u7528telnet\u505a\u4f8b\u5b50\uff0c<br \/>\n\u73fe\u884cDSM\u7248\u672c\u90fd\u4e0d\u80fd\u76f4\u63a5\u7528root\u767b\u5165\uff0c\u8981\u5148\u4ee5admin\u767b\u5165\uff0c\u518d\u8f38\u5165sudo -i\u4f86\u5207\u63db\u6210root\u4f7f\u7528\u8005\uff0c<br \/>\n\u800c\u4e14\u4e00\u5b9a\u6703\u51fa\u73feSorry, try again\uff0c\u4e0d\u7528\u6015\uff0c\u518d\u8f38\u5165\u4e00\u6b21\u5bc6\u78bc\u5c31\u53ef\u4ee5\u4e86\uff0c\u6700\u5f8c\u8f38\u5165sudo chmod 755 \/usr\/syno\/bin\/ddns\/namecheap.php\u5c31\u53ef\u4ee5\u4e86<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-206\" src=\"http:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/4.jpg\" alt=\"\" width=\"979\" height=\"528\" srcset=\"https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/4.jpg 979w, https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/4-300x162.jpg 300w, https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/4-768x414.jpg 768w, https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/4-954x515.jpg 954w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/p>\n<p>\u73fe\u5728\uff0c\u6211\u5011\u518d\u56de\u5230<a href=\"http:\/\/www.mhfohk.com\/wordpress\/2017\/11\/12\/dsm-config-file-%E4%BD%8D%E7%BD%AE-config-file-editor\/\">Config File Editor<\/a>\u88e1\uff0c\u6709\u770b\u904e\u4e0a\u4e00\u7bc7\u7684\u8a71\uff0c\u61c9\u8a72\u5df2\u7d93\u52a0\u4e86ddns\uff0c<br \/>\n\u53ea\u8981\u5728\u6700\u5e95\u52a0\u4e0a\u4ee5\u4e0b\u9019\u4e00\u6bb5\uff0c\u518d\u5132\u5b58\u5c31\u53ef\u4ee5\u4e86\u3002<br \/>\n(\u4ee5\u4e0b\u9019\u6bb5\u9069\u7528\u65bcDSM 6.1.7\u6216\u4ee5\u524d\u7248\u672c)<br \/>\n[Namecheap]<br \/>\nmodulepath=\/usr\/syno\/bin\/ddns\/namecheap.php<br \/>\nqueryurl=https:\/\/dynamicdns.park-your-domain.com\/<br \/>\n(\u4ee5\u4e0b\u9019\u6bb5\u9069\u7528\u65bcDSM 6.2\u6216\u4ee5\u5f8c\u7248\u672c)<br \/>\n[Namecheap]<br \/>\nmodulepath=\/usr\/syno\/bin\/ddns\/namecheap.php<br \/>\nqueryurl=https:\/\/dynamicdns.park-your-domain.com\/update<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-207\" src=\"http:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/5.jpg\" alt=\"\" width=\"914\" height=\"559\" srcset=\"https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/5.jpg 914w, https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/5-300x183.jpg 300w, https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/5-768x470.jpg 768w\" sizes=\"auto, (max-width: 914px) 100vw, 914px\" \/><\/p>\n<p>\u91cd\u65b0\u555f\u52d5\u4f60\u7684NAS\u4e00\u6b21\uff0c\u5c31\u53ef\u4ee5\u5728\u5916\u90e8\u5b58\u53d6\u88e1\u627e\u5230NameCheap\u7684DDNS\u4e86\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-208\" src=\"http:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/6.jpg\" alt=\"\" width=\"997\" height=\"700\" srcset=\"https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/6.jpg 997w, https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/6-300x211.jpg 300w, https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/6-768x539.jpg 768w, https:\/\/www.mhfohk.com\/wordpress\/wp-content\/uploads\/2018\/05\/6-954x670.jpg 954w\" sizes=\"auto, (max-width: 997px) 100vw, 997px\" \/><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148\uff0c\u8981\u65b0\u589e\u4e00\u500bfile,\u00a0\/usr\/syno\/bin\/ddns\/namecheap.php \u65e2\u7136\u4e4b\u524d\u90fd\u6559\u5de6\u5927 &hellip; <a href=\"https:\/\/www.mhfohk.com\/wordpress\/2018\/05\/12\/%e6%96%bcdsm%e5%85%a7%e5%a2%9e%e5%8a%a0namecheap%e7%9a%84ddns\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> \"\u65bcDSM\u5167\u589e\u52a0NameCheap\u7684DDNS(\u5df2\u52a0\u4e0aDSM6.2\u9069\u7528\u7684\u7248\u672c)\"<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":""},"categories":[6,4],"tags":[],"class_list":["post-202","post","type-post","status-publish","format-standard","hentry","category-synology","category-xpenology"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9mX1K-3g","_links":{"self":[{"href":"https:\/\/www.mhfohk.com\/wordpress\/wp-json\/wp\/v2\/posts\/202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mhfohk.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mhfohk.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mhfohk.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mhfohk.com\/wordpress\/wp-json\/wp\/v2\/comments?post=202"}],"version-history":[{"count":7,"href":"https:\/\/www.mhfohk.com\/wordpress\/wp-json\/wp\/v2\/posts\/202\/revisions"}],"predecessor-version":[{"id":929,"href":"https:\/\/www.mhfohk.com\/wordpress\/wp-json\/wp\/v2\/posts\/202\/revisions\/929"}],"wp:attachment":[{"href":"https:\/\/www.mhfohk.com\/wordpress\/wp-json\/wp\/v2\/media?parent=202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mhfohk.com\/wordpress\/wp-json\/wp\/v2\/categories?post=202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mhfohk.com\/wordpress\/wp-json\/wp\/v2\/tags?post=202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}