{"id":745,"date":"2021-01-18T05:31:51","date_gmt":"2021-01-18T05:31:51","guid":{"rendered":"https:\/\/hkc.nasclub.vip\/wordpress\/?p=745"},"modified":"2024-06-04T22:25:13","modified_gmt":"2024-06-04T14:25:13","slug":"%e7%ae%80%e5%8d%95%e8%ae%be%e7%bd%ae%e7%be%a4%e6%99%96nas%e7%bb%91%e5%ae%9a%e9%98%bf%e9%87%8c%e4%ba%91%e5%9f%9f%e5%90%8d","status":"publish","type":"post","link":"https:\/\/hkc.nasclub.vip\/?p=745","title":{"rendered":"\u7b80\u5355\u8bbe\u7f6e\u7fa4\u6656NAS\u7ed1\u5b9a\u963f\u91cc\u4e91\u57df\u540d"},"content":{"rendered":"<p><!--more--><\/p>\n<h4><strong>\u65b9\u6cd5\u4e00\uff1a<\/strong><\/h4>\n<p>1.\u6ce8\u518c\u963f\u91cc\u4e91\u8d26\u53f7\u3002<br \/>\n2.\u6ce8\u518c\u4e00\u4e2a\u57df\u540d\u3002<br \/>\n3.\u5230<a href=\"https:\/\/dc.console.aliyun.com\/next\/index#\/domain\/list\/all-domain\">\u963f\u91cc\u4e91<\/a>\u63a7\u5236\u4e2d\u5fc3\u627e\u5230access key\u548csecret\u5e76\u4fdd\u5b58\u4e0b\u6765<\/p>\n<p><img decoding=\"async\" title=\"001\" src=\"https:\/\/nas.swihp.cn:39997\/file\/wordpress\/\u963f\u91cc\u4e91\u57df\u540d\/001.png\" alt=\"001\" \/><\/p>\n<p><img decoding=\"async\" title=\"002\" src=\"https:\/\/nas.swihp.cn:39997\/file\/wordpress\/\u963f\u91cc\u4e91\u57df\u540d\/002.png\" alt=\"002\" \/><br \/>\n4.\u5230\u7fa4\u6656\u63a7\u5236\u9762\u677f\u627e\u5230\u4efb\u52a1\u8ba1\u5212\u65b0\u589e\u4e00\u4e2a\u8ba1\u5212\u3002<br \/>\n\u65b0\u589e-&gt;\u8ba1\u5212\u7684\u4efb\u52a1-&gt;\u7528\u6237\u81ea\u5b9a\u4e49\u811a\u672c<\/p>\n<p><img decoding=\"async\" title=\"003\" src=\"https:\/\/nas.swihp.cn:39997\/file\/wordpress\/\u963f\u91cc\u4e91\u57df\u540d\/003.png\" alt=\"003\" \/><\/p>\n<p>\u4efb\u52a1\u540d\u79f0\u81ea\u5df1\u968f\u4fbf\u8bbe\u7f6e<\/p>\n<p><img decoding=\"async\" title=\"004\" src=\"https:\/\/nas.swihp.cn:39997\/file\/wordpress\/\u963f\u91cc\u4e91\u57df\u540d\/004.png\" alt=\"004\" \/><\/p>\n<p>\u8fd0\u884c\u9891\u7387\u63a8\u8350\u9009\u62e910\u5206\u949f<\/p>\n<p><img decoding=\"async\" title=\"005\" src=\"https:\/\/nas.swihp.cn:39997\/file\/wordpress\/\u963f\u91cc\u4e91\u57df\u540d\/005.png\" alt=\"005\" \/><\/p>\n<p>\u590d\u5236\u4e0b\u9762\u7684\u5185\u5bb9\u5230\u81ea\u5b9a\u4e49\u7684\u811a\u672c<\/p>\n<p><span style=\"color: #ff0000;\">\u4e00\u5b9a\u8981\u4fee\u6539\u524d\u8fb9\u6c49\u5b57\u90e8\u5206\uff01\u4e00\u5b9a\u8981\u4fee\u6539\u524d\u8fb9\u6c49\u5b57\u90e8\u5206\uff01\u4e00\u5b9a\u8981\u4fee\u6539\u524d\u8fb9\u6c49\u5b57\u90e8\u5206\uff01<\/span><\/p>\n<p><img decoding=\"async\" title=\"006\" src=\"https:\/\/nas.swihp.cn:39997\/file\/wordpress\/\u963f\u91cc\u4e91\u57df\u540d\/006.png\" alt=\"006\" \/><\/p>\n<div class=\"hljs-ln-code\"><\/div>\n<div class=\"hljs-ln-code\">\n<div class=\"hljs-ln-line\">#!\/bin\/shaliddns_name=&#8221;\u4f60\u7684\u57df\u540d\u524d\u7f00&#8221;<br \/>\naliddns_domain=&#8221;\u4f60\u7684\u57df\u540d&#8221;<br \/>\naliddns_ak=&#8221;\u4f60\u7684AccessKeyId&#8221;<br \/>\naliddns_sk=&#8221;\u4f60\u7684AccessKeySecret&#8221;<\/p>\n<p>aliddns_curl=&#8221;curl -s whatismyip.akamai.com&#8221;<br \/>\naliddns_dns=&#8221;223.5.5.5&#8243;<br \/>\naliddns_ttl=&#8221;600&#8243;<\/p>\n<p>ip=`$aliddns_curl 2&gt;&amp;1`<\/p>\n<p>current_ip=`nslookup $aliddns_name.$aliddns_domain $aliddns_dns 2&gt;&amp;1`<\/p>\n<p>if [ &#8220;$?&#8221; -eq &#8220;0&#8221; ]<br \/>\nthen<br \/>\ncurrent_ip=`echo &#8220;$current_ip&#8221; | grep &#8216;Address 1&#8217; | tail -n1 | awk &#8216;{print $NF}&#8217;`<br \/>\nif [ &#8220;$ip&#8221; = &#8220;$current_ip&#8221; ]<br \/>\nthen<br \/>\nexit 0<br \/>\nfi<br \/>\nfi<\/p>\n<p>timestamp=`date -u &#8220;+%Y-%m-%dT%H%%3A%M%%3A%SZ&#8221;`<\/p>\n<p>urlencode() {<br \/>\n# urlencode &lt;string&gt;<br \/>\nout=&#8221;&#8221;<br \/>\nwhile read -n1 c<br \/>\ndo<br \/>\ncase $c in<br \/>\n[a-zA-Z0-9._-]) out=&#8221;$out$c&#8221; ;;<br \/>\n*) out=&#8221;$out`printf &#8216;%%%02X&#8217; &#8220;&#8216;$c&#8221;`&#8221; ;;<br \/>\nesac<br \/>\ndone<br \/>\necho -n $out<br \/>\n}<br \/>\nenc() {<br \/>\necho -n &#8220;$1&#8243; | urlencode<br \/>\n}<br \/>\nsend_request() {<br \/>\nlocal args=&#8221;AccessKeyId=$aliddns_ak&amp;Action=$1&amp;Format=json&amp;$2&amp;Version=2015-01-09&#8221;<br \/>\nlocal hash=$(echo -n &#8220;GET&amp;%2F&amp;$(enc &#8220;$args&#8221;)&#8221; | openssl dgst -sha1 -hmac &#8220;$aliddns_sk&amp;&#8221; -binary | openssl base64)<br \/>\ncurl -s &#8220;http:\/\/alidns.aliyuncs.com\/?$args&amp;Signature=$(enc &#8220;$hash&#8221;)&#8221;<br \/>\n}<br \/>\nget_recordid() {<br \/>\ngrep -Eo &#8216;&#8221;RecordId&#8221;:&#8221;[0-9]+&#8221;&#8216; | cut -d&#8217;:&#8217; -f2 | tr -d &#8216;&#8221;&#8216;<br \/>\n}<br \/>\nquery_recordid() {<br \/>\nsend_request &#8220;DescribeSubDomainRecords&#8221; &#8220;SignatureMethod=HMAC-SHA1&amp;SignatureNonce=$timestamp&amp;SignatureVersion=1.0&amp;SubDomain=$aliddns_name.$aliddns_domain&amp;Timestamp=$timestamp&#8221;<br \/>\n}<br \/>\nupdate_record() {<br \/>\nsend_request &#8220;UpdateDomainRecord&#8221; &#8220;RR=$aliddns_name&amp;RecordId=$1&amp;SignatureMethod=HMAC-SHA1&amp;SignatureNonce=$timestamp&amp;SignatureVersion=1.0&amp;TTL=$aliddns_ttl&amp;Timestamp=$timestamp&amp;Type=A&amp;Value=$ip&#8221;<br \/>\n}<br \/>\nadd_record() {<br \/>\nsend_request &#8220;AddDomainRecord&amp;DomainName=$aliddns_domain&#8221; &#8220;RR=$aliddns_name&amp;SignatureMethod=HMAC-SHA1&amp;SignatureNonce=$timestamp&amp;SignatureVersion=1.0&amp;TTL=$aliddns_ttl&amp;Timestamp=$timestamp&amp;Type=A&amp;Value=$ip&#8221;<br \/>\n}<br \/>\nif [ &#8220;$aliddns_record_id&#8221; = &#8220;&#8221; ]<br \/>\nthen<br \/>\naliddns_record_id=`query_recordid | get_recordid`<br \/>\nfi<br \/>\nif [ &#8220;$aliddns_record_id&#8221; = &#8220;&#8221; ]<br \/>\nthen<br \/>\naliddns_record_id=`add_record | get_recordid`<br \/>\necho &#8220;added record $aliddns_record_id&#8221;<br \/>\nelse<br \/>\nupdate_record $aliddns_record_id<br \/>\necho &#8220;updated record $aliddns_record_id&#8221;<br \/>\nfi<\/p>\n<\/div>\n<\/div>\n<div><\/div>\n<div><\/div>\n<div>\u9009\u4e2d\u4efb\u52a1\uff0c\u70b9\u51fb\u8fd0\u884c\uff0c\u7136\u540e\u5c31\u53ef\u4ee5\u4f7f\u7528\u60a8\u7684\u57df\u540d\u8bbf\u95eeNAS\u4e86\u3002<\/div>\n<div><\/div>\n<div><\/div>\n<div><\/div>\n<h4><strong>\u65b9\u6cd5\u4e8c\uff1a<\/strong><\/h4>\n<p>1.\u6ce8\u518c\u963f\u91cc\u4e91\u8d26\u53f7\u3002<br \/>\n2.\u6ce8\u518c\u4e00\u4e2a\u57df\u540d\u3002<br \/>\n3.\u5230<a href=\"https:\/\/dc.console.aliyun.com\/next\/index#\/domain\/list\/all-domain\">\u963f\u91cc\u4e91<\/a>\u63a7\u5236\u4e2d\u5fc3\u627e\u5230access key\u548csecret\u5e76\u4fdd\u5b58\u4e0b\u6765<\/p>\n<p><img decoding=\"async\" title=\"001\" src=\"https:\/\/nas.swihp.cn:39997\/file\/wordpress\/\u963f\u91cc\u4e91\u57df\u540d\/001.png\" alt=\"001\" \/><\/p>\n<p><img decoding=\"async\" title=\"002\" src=\"https:\/\/nas.swihp.cn:39997\/file\/wordpress\/\u963f\u91cc\u4e91\u57df\u540d\/002.png\" alt=\"002\" \/><\/p>\n<p>4.<span style=\"font-size: inherit;\">\u8bbe\u7f6e\u57df\u540d\u89e3\u6790<\/span><\/p>\n<div class=\"index-module_textWrap_3ygOc\">\n<p><span class=\"bjh-p\">\u767b\u5f55<a href=\"https:\/\/dc.console.aliyun.com\/next\/index\">\u963f\u91cc\u4e91\u63a7\u5236\u53f0\u57df\u540d\u670d\u52a1<\/a>\uff0c\u8bbe\u7f6e\u57df\u540d\u89e3\u6790\uff0c\u6dfb\u52a0\u4e00\u4e2aA\u8bb0\u5f55\u5230\u4efb\u610fIP<\/span><\/p>\n<\/div>\n<div class=\"index-module_textWrap_3ygOc\">\n<p><span class=\"bjh-p\">\u4f8b\u5982\uff1a\u8bbe\u7f6e A \u8bb0\u5f55 hkcnas.com \u5230 1.1.1.1<\/span><\/p>\n<p><img decoding=\"async\" title=\"008\" src=\"https:\/\/nas.swihp.cn:39997\/file\/wordpress\/\u963f\u91cc\u4e91\u57df\u540d\/008.png\" alt=\"008\" \/><\/p>\n<p>5.<span style=\"font-size: inherit;\">Docker\u955c\u50cf\u4e0b\u8f7d\u5e76\u542f\u52a8\u5bb9\u5668<\/span><\/p>\n<div class=\"index-module_textWrap_3ygOc\">\n<p><span class=\"bjh-p\">\u5b89\u88c5\u5e76\u6253\u5f00Docker\u7684\u6ce8\u518c\u8868\uff0c\u641c\u7d22aliyun\u3002\u4e0b\u8f7d chenhw2\/aliyun-ddns-cli<\/span><\/p>\n<p><img decoding=\"async\" title=\"009\" src=\"https:\/\/nas.swihp.cn:39997\/file\/wordpress\/\u963f\u91cc\u4e91\u57df\u540d\/009.png\" alt=\"009\" \/><\/p>\n<p>\u9009\u62e9\u521a\u521a\u4e0b\u8f7d\u7684\u6620\u50cf\uff0c\u9009\u62e9\u542f\u52a8\uff0c\u8fdb\u5165\u9ad8\u7ea7\u8bbe\u7f6e<\/p>\n<p><img decoding=\"async\" title=\"010\" src=\"https:\/\/nas.swihp.cn:39997\/file\/wordpress\/\u963f\u91cc\u4e91\u57df\u540d\/010.png\" alt=\"010\" \/><\/p>\n<div class=\"index-module_textWrap_3ygOc\">\n<p><span class=\"bjh-p\">\u5728\u9ad8\u7ea7\u8bbe\u7f6e &gt; \u73af\u5883\u4e2d\u4fee\u6539\u4ee5\u4e0b\u5185\u5bb9\uff0c\u5e76\u70b9\u51fb\u5e94\u7528\u4fdd\u5b58<\/span><\/p>\n<p><img decoding=\"async\" title=\"011\" src=\"https:\/\/nas.swihp.cn:39997\/file\/wordpress\/\u963f\u91cc\u4e91\u57df\u540d\/011.png\" alt=\"011\" \/><\/p>\n<\/div>\n<div class=\"index-module_textWrap_3ygOc\">\n<p>AKID \u586b\u5199\u521a\u521a\u521b\u5efa\u7684 AccessKeyID<\/p>\n<p>AKSCT \u586b\u5199\u521a\u521a\u521b\u5efa\u7684 AccessKeySecret<\/p>\n<p>DOMAIN \u586b\u5199\u4f60\u89e3\u6790\u7684\u57df\u540d<\/p>\n<p>REDO \u586b\u5199 600<\/p>\n<p>\u5176\u4ed6\u4fdd\u6301\u9ed8\u8ba4<\/p>\n<p>\u786e\u8ba4\u4fe1\u606f\u2192\u70b9\u51fb\u5e94\u7528<\/p>\n<p><img decoding=\"async\" title=\"012\" src=\"https:\/\/nas.swihp.cn:39997\/file\/wordpress\/\u963f\u91cc\u4e91\u57df\u540d\/012.png\" alt=\"012\" \/><\/p>\n<div class=\"index-module_textWrap_3ygOc\">\n<p><span class=\"bjh-p\">\u70b9\u51fb\u5bb9\u5668\u9875\u9762\uff0c\u53ef\u770b\u5230\u5bb9\u5668\u5df2\u542f\u52a8\u6210\u529f\uff0c<\/span><span style=\"font-size: inherit;\">\u67e5\u770b\u8be6\u60c5\uff0c\u5728\u65e5\u5fd7\u4e2d\u53ef\u770b\u5230\u5df2\u89e3\u6790\u6210\u529f<\/span><\/p>\n<p><img decoding=\"async\" title=\"013\" src=\"https:\/\/nas.swihp.cn:39997\/file\/wordpress\/\u963f\u91cc\u4e91\u57df\u540d\/013.png\" alt=\"013\" \/><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,6],"tags":[],"class_list":["post-745","post","type-post","status-publish","format-standard","hentry","category-hkc","category-synology"],"_links":{"self":[{"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/posts\/745","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=745"}],"version-history":[{"count":3,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/posts\/745\/revisions"}],"predecessor-version":[{"id":1543,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/posts\/745\/revisions\/1543"}],"wp:attachment":[{"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=745"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=745"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}