{"id":7187,"date":"2023-12-13T15:16:02","date_gmt":"2023-12-13T07:16:02","guid":{"rendered":"https:\/\/i007.vip:15443\/wordpress\/?p=7187"},"modified":"2023-12-13T15:16:02","modified_gmt":"2023-12-13T07:16:02","slug":"%e5%b7%a7%e7%94%a8azure-dns-%e4%b8%ba%e5%ae%b6%e5%ba%adnas-%e6%8f%90%e4%be%9bddns-%e6%9c%8d%e5%8a%a1","status":"publish","type":"post","link":"https:\/\/i007.cc\/wordpress\/archives\/7187","title":{"rendered":"\u5de7\u7528Azure DNS \u4e3a\u5bb6\u5eadNAS \u63d0\u4f9bDDNS \u670d\u52a1"},"content":{"rendered":"<header class=\"post-header\">\n<p class=\"post-title\"><a href=\"https:\/\/www.51azure.cloud\/post\/2020\/2\/12\/azure-dns-nas-ddns\">cc from<\/a><\/p>\n<\/header>\n<section class=\"post-content clearfix\">&nbsp;<\/p>\n<p>\u5f88\u591a\u6444\u5f71\u7231\u597d\u8005\/IT\u4ece\u4e1a\u8005\u90fd\u4f1a\u8d2d\u4e70NAS\u4ea7\u54c1\u6216\u7740\u62e5\u6709\u6027\u80fd\u5f3a\u608d\u7684\u5de5\u4f5c\u7ad9\u53ca\u670d\u52a1\u5668\uff0c\u6bd4\u5982\u7b14\u8005\u5bb6\u91cc\u5c31\u8d2d\u4e70\u4e86NAS\u5b58\u50a8\uff0c\u540c\u65f6\u5bb6\u91cc\u4e5f\u6709\u4e00\u53f0\u5de5\u4f5c\u7ad9\uff0c\u51fa\u95e8\u5728\u5916\u53ef\u4ee5\u968f\u65f6\u5c06\u624b\u673a\u62cd\u6444\u7684\u56fe\u7247\u4f20\u5230\u5bb6\u91cc\u7684NAS\u4e0a\u6216\u8005\u901a\u8fc7\u7b14\u8bb0\u672c\u8fdc\u7a0b\u8fde\u63a5\u5230\u5bb6\u91cc\u7684\u670d\u52a1\u5668\u4e0a\u8fdb\u884c\u67d0\u4e9b\u7279\u5b9a\u7684\u64cd\u4f5c\u3002 \u4f46\u662f\u9274\u4e8e\u73b0\u5728\u7684\u5bb6\u7528\u7f51\u7edc\u72b6\u51b5\uff0c\u5bb6\u7528PPPOE\u7f51\u7edc\u4f1a\u5728\u5149\u732b\/\u8def\u7531\u5668\u91cd\u542f\u540e\uff0c\u53d1\u751fIP\u53d8\u66f4\uff0c\u4e00\u65e6IP\u53d8\u66f4\uff0c\u5982\u679c\u6211\u4eec\u4e0d\u77e5\u9053\u65b0\u7684IP\uff0c\u5c31\u65e0\u6cd5\u8fde\u63a5\u5230\u5bb6\u5ead\u7684\u7f51\u7edc\u4e2d\u4e86\uff0c\u9488\u5bf9\u8fd9\u79cd\u72b6\u51b5\uff0c\u6709\u4e00\u4e9bDDNS\u670d\u52a1\u5546\u63d0\u4f9b\u4e86\u52a8\u6001IP\u548c\u57df\u540d\u7ed1\u5b9a\u7684\u670d\u52a1\uff0c\u6bd4\u5982\u5178\u578b\u7684\u82b1\u751f\u58f3\uff0c\u516c\u4e91\uff0c\u8fd8\u6709\u56fd\u5916\u7684\u4e00\u4e9b\u670d\u52a1\u3002\u4f46\u8fd9\u4e9b\u670d\u52a1\u5927\u90e8\u5206\u90fd\u4f1a\u6536\u53d6\u4e00\u5b9a\u7684\u6d41\u91cf\u6216\u5e26\u5bbd\u8d39\u7528\uff0c\u7b14\u8005\u7684\u4e0a\u884c\u5e26\u5bbd\u4e3a50Mbps\uff0c\u4f7f\u7528\u8fd9\u4e9b\u670d\u52a1\u4f1a\u5bfc\u81f4\u989d\u5916\u5f88\u9ad8\u6602\u7684\u8d39\u7528\uff0c\u56e0\u6b64\uff0c\u7b14\u8005\u51b3\u5b9a\u81ea\u884c\u914d\u7f6e\u4e00\u5957\u7b80\u6613\u7684DDNS\u3002<\/p>\n<p>\u5728\u4e4b\u524d\u7684\u5185\u5bb9\u4e2d\uff0c\u6211\u4eec\u66fe\u5206\u4eab\u8fc7Azure DNS\u8fd9\u6b3e\u4ea7\u54c1( \u8bf7\u53c2\u89c1\u300a<a title=\"Azure DNS-\u6bcf\u4e00\u4e2a\u8bf7\u6c42\uff0c\u90fd\u503c\u5f97\u6258\u4ed8\" href=\"https:\/\/www.51azure.cloud\/post\/2019\/4\/18\/azure-dns\" target=\"_blank\" rel=\"noopener\">Azure DNS-\u6bcf\u4e00\u4e2a\u8bf7\u6c42\uff0c\u90fd\u503c\u5f97\u6258\u4ed8<\/a>\u300b)\uff0c\u5176\u5b9eAzure DNS\u662f\u6709\u5bf9\u5e94API\u7684\uff0c\u6211\u4eec\u5728\u672c\u4f8b\u4e2d\uff0c\u4f7f\u7528API\u7684\u65b9\u5f0f\u52a8\u6001\u7684\u4fee\u6539A\u8bb0\u5f55\uff0c\u5373\u53ef\u5b9e\u73b0DDNS\u7684\u6548\u679c\u3002<\/p>\n<p>\u5148\u770b\u4e0b\u5982\u4e0b\u793a\u610f\u56fe\uff1a<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" class=\"img-fluid img-thumbnail\" src=\"https:\/\/www.51azure.cloud\/image\/img-030794ef-3e13-4e57-a0ee-aad9686c3e3e.png\" \/><\/p>\n<p>\u6b65\u9aa4\u89e3\u91ca\uff1a<\/p>\n<p>1. IP\u68c0\u6d4b\u7a0b\u5e8f \u5b9a\u65f6\uff0c\u4f8b\u5982\u6bcf10\u5206\u949f\u8c03\u7528\u4e00\u6b21\u516c\u5f00\u7684\u516c\u7f51IP\u83b7\u53d6API\uff0c\u4e00\u65e6\u4e24\u6b21\u7ed3\u679c\u4e0d\u4e00\u6837\uff0c\u5219\u8868\u793a\u672c\u5730\u7684\u516c\u7f51IP\u53d1\u751f\u4e86\u53d8\u66f4\uff1b<\/p>\n<p>2. IP\u68c0\u6d4b\u7a0b\u5e8f\u901a\u8fc7 \u8c03\u7528Azure DNS\u7684 API\uff0c\u4fee\u6539A\u8bb0\u5f55\u7684IP\u4e3a \u4e0a\u4e00\u6b65\u5f97\u5230\u7684\u65b0IP\u5730\u5740\uff1b<\/p>\n<p>3. \u968f\u65f6\u968f\u5730\u5728\u4efb\u4f55\u5730\u65b9\u901a\u8fc7\u57df\u540d\u7684\u65b9\u5f0f\u8bbf\u95ee\u5bb6\u5ead\u7f51\u7edc\u7684\u670d\u52a1\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u5f53\u7136\u6839\u636e\u5b9e\u9645\u60c5\u51b5\uff0cIP\u68c0\u6d4b\u7a0b\u5e8f\u53ef\u4ee5\u4ee5\u5982\u4e0b\u5f62\u5f0f\u5b58\u5728\uff1a<\/p>\n<p>1. \u771f\u5b9e\u7684 \u7a0b\u5e8f\uff0c\u90e8\u7f72\u5728\u5bb6\u5ead\u7f51\u7edc\u91cc\u7684\u865a\u62df\u673a\uff0c\u670d\u52a1\u5668\u91cc\uff1b<\/p>\n<p>2. \u4e3b\u6d41\u7684NAS\u90fd\u63d0\u4f9b\u4e86\u68c0\u6d4b\u5916\u7f51IP\u7684\u529f\u80fd\uff0c\u5e76\u4e14\u5177\u5907\u8c03\u7528\u81ea\u5b9a\u4e49DDNS API\u7684\u529f\u80fd( \u7b14\u8005\u7684\u5a01\u8054\u901a NAS\uff0c\u5c31\u4f7f\u7528\u4e86\u6b64\u65b9\u5f0f)\uff1b<\/p>\n<p>3. \u4e3b\u6d41\u7684\u56fd\u4ea7NAS\uff08\u7fa4\u6656\uff0c\u5a01\u8054\u901a\u7b49\u90fd\u652f\u6301\u5bb9\u5668\uff09\uff0c\u53ef\u4ee5\u5c06\u8be5\u7a0b\u5e8f\u4ee5\u5bb9\u5668\u65b9\u5f0f\u90e8\u7f72\u5728NAS\u91cc\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u5728\u672c\u4f8b\u4e2d\uff0c\u7b14\u8005\u901a\u8fc7NAS\u81ea\u5e26\u7684\u5916\u7f51IP\u68c0\u6d4b\u548c\u81ea\u5b9a\u4e49DDNS\u529f\u80fd\u8fdb\u884c\u4e86\u8bbe\u7f6e\uff0cNAS\u6bcf10\u5206\u949f\u68c0\u6d4b\u4e00\u6b21IP\u662f\u5426\u53d1\u751f\u53d8\u66f4\uff0c\u4e00\u65e6\u53d8\u66f4\uff0c\u5219\u8c03\u7528\u81ea\u5b9a\u4e49\u7684API\u4fee\u6539A\u8bb0\u5f55\uff0c\u7b14\u8005\u628a\u81ea\u5b9a\u4e49\u7684API \u53d1\u5e03\u5230\u4e86Azure\u7684\u4e00\u53f0VM\u91cc\uff0c\u5f53\u7136\uff0c\u4e3a\u4e86\u7701\u94b1\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528Azure Function\uff0c \u514d\u8d39\u5c42\u7ea7\u5728\u8fd9\u4e2a\u573a\u666f\u4e2d\u6700\u9002\u5408\u4e86\u3002<\/p>\n<p><img decoding=\"async\" class=\"img-fluid img-thumbnail\" src=\"https:\/\/www.51azure.cloud\/image\/img-df250d6f-3dc0-4853-9125-9abafa73eb79.png\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" class=\"img-fluid img-thumbnail\" src=\"https:\/\/www.51azure.cloud\/image\/img-74be4feb-52eb-412b-93ef-4b7bff75c645.png\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u5f53\u7136\u5728\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u6709\u5982\u4e0b\u524d\u7f6e\u6761\u4ef6\uff1a<\/p>\n<p>1. \u4f60\u7684\u5bbd\u5e26\u8fd0\u8425\u5546\u63d0\u4f9b\u7684\u4e86\u516c\u7f51IP\u5730\u5740\uff08\u67d0\u4e9b\u5c0f\u578b\u8fd0\u8425\u5546\u5176\u5b9e\u76ee\u524d\u5df2\u7ecf\u4e0d\u63d0\u4f9b\u516c\u7f51IP\u4e86\uff09\uff1b<\/p>\n<p>2. \u4f60\u7684\u5149\u732b\/\u8def\u7531\u5668\u6709\u7aef\u53e3\u8f6c\u53d1\u7684\u529f\u80fd\uff1b<\/p>\n<p>3. \u5408\u6cd5\u4f7f\u7528DDNS\uff1b<\/p>\n<p>&nbsp;<\/p>\n<p>\u672c\u4f8b\u4e2d \u5982\u4f55\u68c0\u6d4b\u516c\u7f51IP\u53ef\u901a\u8fc7\u5982\u4e0bAPI\uff1a<\/p>\n<p><a href=\"http:\/\/pv.sohu.com\/cityjson\" target=\"_blank\" rel=\"noopener\">http:\/\/pv.sohu.com\/cityjson<\/a><\/p>\n<p>\u4f8b\u5982\u7b14\u8005\u7684IP\u5730\u5740\u5982\u4e0b\u56fe\uff08\u8be5IP\u4f1a\u5728\u8def\u7531\u5668\u91cd\u542f\u540e\u53d1\u751f\u53d8\u66f4\uff09\uff1a<\/p>\n<p><img decoding=\"async\" class=\"img-fluid img-thumbnail\" src=\"https:\/\/www.51azure.cloud\/image\/img-cdc6c303-961a-4175-b7a6-7eac57455146.png\" \/><\/p>\n<p>\u7aef\u53e3\u8f6c\u53d1\u5982\u4e0b\u56fe\u6240\u793a\uff08\u8be5\u6b65\u9aa4\u5728\u4f60\u5bb6\u7528\u8def\u7531\u5668\u4e2d\u8c03\u8bd5\uff09\uff1a<\/p>\n<p><img decoding=\"async\" class=\"img-fluid img-thumbnail\" src=\"https:\/\/www.51azure.cloud\/image\/img-8dd14ac4-2474-4d1c-86e0-c95a56f67418.png\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u53ef\u4ee5\u5728\u4efb\u4f55\u65f6\u5019\uff0c\u4efb\u4f55\u5730\u70b9\uff0c\u8bbf\u95ee\u5bb6\u91cc\u7684\u5b58\u50a8\/\u670d\u52a1\u5668\u4e86\uff1a<\/p>\n<p><img decoding=\"async\" class=\"img-fluid img-thumbnail\" src=\"https:\/\/www.51azure.cloud\/image\/img-b79a8ab0-76a4-4087-8c9c-4dd57eaf3502.png\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" class=\"img-fluid img-thumbnail\" src=\"https:\/\/www.51azure.cloud\/image\/img-997f18dc-3256-4a70-8d71-efdae410ca39.png\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u672c\u4f8b\u4e2d\uff0c\u4fee\u6539Azure DNS A\u8bb0\u5f55\u7684\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"language-csharp\"><code class=\"hljs\"> <span class=\"hljs-meta\">#<span class=\"hljs-meta-keyword\">region<\/span> Update A Record<\/span>\r\n            <span class=\"hljs-comment\">\/\/ **********************************************************************************************************<\/span>\r\n            <span class=\"hljs-comment\">\/\/ Update A Record<\/span>\r\n            <span class=\"hljs-comment\">\/\/ **********************************************************************************************************<\/span>\r\n\r\n            Console.Write(<span class=\"hljs-string\">\"Updating DNS 'A' record set with name '{0}'...\"<\/span>, recordSetName);\r\n            <span class=\"hljs-keyword\">try<\/span>\r\n            {\r\n                <span class=\"hljs-keyword\">var<\/span> recordSet = dnsClient.RecordSets.Get(resourceGroupName, zoneName, recordSetName, RecordType.A);\r\n\r\n                <span class=\"hljs-comment\">\/\/ Add a new record to the local object.  Note that records in a record set must be unique\/distinct<\/span>\r\n                recordSet.ARecords.Add(<span class=\"hljs-keyword\">new<\/span> ARecord(<span class=\"hljs-string\">\"5.6.7.8\"<\/span>));\r\n\r\n                <span class=\"hljs-comment\">\/\/ Update the record set in Azure DNS<\/span>\r\n                <span class=\"hljs-comment\">\/\/ Note: ETAG check specified, update will be rejected if the record set has changed in the meantime<\/span>\r\n                recordSet = <span class=\"hljs-keyword\">await<\/span> dnsClient.RecordSets.CreateOrUpdateAsync(resourceGroupName, zoneName, recordSetName, RecordType.A, recordSet, recordSet.Etag);\r\n\r\n                Console.WriteLine(<span class=\"hljs-string\">\"success\"<\/span>);\r\n            }\r\n            catch (System.Exception e)\r\n            {\r\n                Console.WriteLine(<span class=\"hljs-string\">\"failed: {0}\"<\/span>, e.Message);\r\n            }\r\n            <span class=\"hljs-meta\">#<span class=\"hljs-meta-keyword\">endregion<\/span><\/span><\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>\u66f4\u591aAzure DNS\u793a\u4f8b\u4ee3\u7801\uff0c\u8bf7\u4e0b\u8f7d\u5b98\u65b9\u6848\u4f8b\uff1a<\/p>\n<p><a href=\"https:\/\/download.microsoft.com\/download\/2\/A\/C\/2AC64449-1747-49E9-B875-C71827890126\/AzureDNSSample1_2016-09-14.zip\" target=\"_blank\" rel=\"noopener\">https:\/\/download.microsoft.com\/download\/2\/A\/C\/2AC64449-1747-49E9-B875-C71827890126\/AzureDNSSample1_2016-09-14.zip<\/a><\/p>\n<p>&nbsp;<\/p>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>cc from &nbsp; \u5f88\u591a\u6444\u5f71\u7231<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[24],"tags":[121],"class_list":["post-7187","post","type-post","status-publish","format-standard","hentry","category-value_docs","tag-05-"],"_links":{"self":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/7187","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/comments?post=7187"}],"version-history":[{"count":0,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/7187\/revisions"}],"wp:attachment":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/media?parent=7187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/categories?post=7187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/tags?post=7187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}