{"id":5577,"date":"2021-09-19T00:03:13","date_gmt":"2021-09-18T16:03:13","guid":{"rendered":"https:\/\/damogame.cn:15443\/wordpress\/?p=5577"},"modified":"2021-09-19T00:03:13","modified_gmt":"2021-09-18T16:03:13","slug":"routeros%e5%88%a9%e7%94%a8aliyun%e7%9a%84api%e6%8e%a5%e5%8f%a3%e5%ae%9e%e7%8e%b0ddns%e5%8a%a8%e6%80%81%e8%a7%a3%e6%9e%90","status":"publish","type":"post","link":"https:\/\/i007.cc\/wordpress\/archives\/5577","title":{"rendered":"RouterOS\u5229\u7528aliyun\u7684API\u63a5\u53e3\u5b9e\u73b0DDNS\u52a8\u6001\u89e3\u6790"},"content":{"rendered":"<div class=\"entry-head\">\n<p class=\"entry-title\"><a style=\"font-size: 16px;\" href=\"https:\/\/showdoi.com\/461.html\">\u539f\u6587\u5730\u5740<\/a><\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<div class=\"entry-head\">\n<div class=\"entry-info\"><span class=\"vcard\"><a class=\"nickname url fn j-user-card\" href=\"https:\/\/showdoi.com\/author\/bi4jgm\" data-user=\"1\">bi4jgm<\/a><\/span><span class=\"dot\">\u2022<\/span>\u00a0<time class=\"entry-date published\" datetime=\"2021-01-31T02:57:16+08:00\">2021\u5e741\u670831\u65e5 am2:57\u00a0<\/time><span class=\"dot\">\u2022<\/span>\u00a0<a href=\"https:\/\/showdoi.com\/category\/%e5%ae%b6%e5%b1%85%e7%89%a9%e8%81%94%e7%bd%91\/%e8%bd%af%e8%b7%af%e7%94%b1\/proxmox-ve\" rel=\"category tag\">ProXmoX VE<\/a>,\u00a0<a href=\"https:\/\/showdoi.com\/category\/%e5%ae%b6%e5%b1%85%e7%89%a9%e8%81%94%e7%bd%91\/%e8%bd%af%e8%b7%af%e7%94%b1\" rel=\"category tag\">\u8f6f\u8def\u7531<\/a>\u00a0<span class=\"dot\">\u2022<\/span>\u00a0\u9605\u8bfb 23750<\/div>\n<\/div>\n<div class=\"entry-content clearfix\">\n<p>\u9996\u5148\u533a\u5206\uff1a\u52a8\u6001\u89e3\u6790\uff0c\u5185\u7f51\u7a7f\u900f\u7684\u533a\u522b<\/p>\n<p><strong>\u52a8\u6001\u89e3\u6790\uff1a<\/strong>\u52a8\u6001\u57df\u540d\u89e3\u6790\u670d\u52a1\uff0c\u662f\u5c06\u7528\u6237\u7684\u52a8\u6001IP\u5730\u5740\u6620\u5c04\u5230\u4e00\u4e2a\u56fa\u5b9a\u7684\u57df\u540d\u89e3\u6790\u670d\u52a1\u4e0a\uff0c\u7528\u6237\u6bcf\u6b21\u8fde\u63a5\u7f51\u7edc\u7684\u65f6\u5019\uff0c\u5ba2\u6237\u7aef\u7a0b\u5e8f\u5c31\u4f1a\u901a\u8fc7\u4fe1\u606f\u4f20\u9012\u628a\u8be5\u4e3b\u673a\u7684\u52a8\u6001IP\u5730\u5740\u4f20\u9001\u7ed9\u4f4d\u4e8e\u670d\u52a1\u5546\u4e3b\u673a\u4e0a\u7684\u670d\u52a1\u5668\u7a0b\u5e8f\uff0c\u670d\u52a1\u7a0b\u5e8f\u8d1f\u8d23\u63d0\u4f9bDNS\u670d\u52a1\u5e76\u5b9e\u73b0\u52a8\u6001\u57df\u540d\u89e3\u6790\u3002\u5c31\u662f\u8bf4DDNS\u6355\u83b7\u7528\u6237\u6bcf\u6b21\u53d8\u5316\u7684IP\u5730\u5740\uff0c\u7136\u540e\u5c06\u5176\u4e0e\u57df\u540d\u76f8\u5bf9\u5e94\uff0c\u8fd9\u6837\u57df\u540d\u5c31\u53ef\u4ee5\u59cb\u7ec8\u89e3\u6790\u5230\u975e\u56fa\u5b9aIP\u7684\u670d\u52a1\u5668\u4e0a\uff0c\u4e92\u8054\u7f51\u7528\u6237\u901a\u8fc7\u672c\u5730\u7684\u57df\u540d\u670d\u52a1\u5668\u83b7\u5f97\u7f51\u7ad9\u57df\u540d\u7684IP\u5730\u5740\uff0c\u4ece\u800c\u53ef\u4ee5\u8bbf\u95ee\u7f51\u7ad9\u7684\u670d\u52a1\u3002<span id=\"more-461\"><\/span><\/p>\n<p><strong>\u5185\u7f51\u7a7f\u900f\uff1a<\/strong>\u4e5f\u5373 NAT \u7a7f\u900f\u4f20\u7edf\u7684NAT\u6280\u672f\u662f\u901a\u8fc7\u5c06\u4e13\u7528\u7684\u7f51\u7edc\u5730\u5740\uff08\u5982\u4f01\u4e1a\u5185\u90e8\u7f51Internet\uff09\u8f6c\u6362\u4e3a\u516c\u7528\u5730\u5740\uff08\u5982\u4e92\u8054\u7f51Internet\uff09\uff0c\u4ece\u800c\u5bf9\u5916\u9690\u85cf\u4e86\u5185\u90e8\u7ba1\u7406\u7684IP\u5730\u5740\u3002\u8fd9\u6837\uff0c\u901a\u8fc7\u5728\u5185\u90e8\u4f7f\u7528\u975e\u6ce8\u518c\u7684IP\u5730\u5740\uff0c\u5e76\u5c06\u5b83\u4eec\u8f6c\u6362\u4e3a\u4e00\u5c0f\u90e8\u5206\u5916\u90e8\u6ce8\u518c\u7684IP\u5730\u5740\uff0c\u4ece\u800c\u51cf\u5c11\u4e86IP\u5730\u5740\u6ce8\u518c\u7684\u8d39\u7528\u4ee5\u53ca\u8282\u7701\u4e86\u76ee\u524d\u8d8a\u6765\u8d8a\u7f3a\u4e4f\u7684\u5730\u5740\u7a7a\u95f4\u3002<\/p>\n<p>\u672c\u6587\u4e3b\u8981\u8bb2\u89e3\u5982\u4f55\u501f\u52a9\u963f\u91cc\u4e91aliyun\u7684\u4e91\u89e3\u6790API\u63a5\u53e3\u6765\u5b9e\u73b0RouterOS\uff08\u4ee5\u4e0b\u7b80\u79f0ROS\uff09\u7684DDNS\u52a8\u6001\u89e3\u6790\u3002<\/p>\n<p><a class=\"j-wpcom-lightbox\" href=\"https:\/\/showdoi.com\/wp-content\/uploads\/2021\/01\/Snipaste_2021-01-31_20-10-33.png\" data-group=\"nogroup\" data-id=\"0\" data-index=\"0\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-516 j-lazy\" src=\"https:\/\/showdoi.com\/wp-content\/uploads\/2021\/01\/Snipaste_2021-01-31_20-10-33.png\" alt=\"RouterOS\u5229\u7528aliyun\u7684API\u63a5\u53e3\u5b9e\u73b0DDNS\u52a8\u6001\u89e3\u6790\" width=\"949\" height=\"604\" data-original=\"https:\/\/showdoi.com\/wp-content\/uploads\/2021\/01\/Snipaste_2021-01-31_20-10-33.png\" \/><\/a><\/p>\n<p>\u8bf7\u70b9\u51fb\u4e0b\u65b9\u8fde\u63a5\u79fb\u6b65\u67e5\u770b<\/p>\n<ul>\n<li><a href=\"https:\/\/blog.csdn.net\/qiaohewei\/article\/details\/108284491\">RouterOS(ROS)\u8f6f\u8def\u7531\u963f\u91cc\u4e91\u52a8\u6001\u57df\u540d\u89e3\u6790Aliyun DDNS_Hewitt\u7684\u535a\u5ba2-CSDN\u535a\u5ba2<\/a>\u00a0 \u00a0\u6b64\u94fe\u63a5\u662f\u5e26\u6709\u56fe\u7247\u5206\u6b65\u9aa4\u7684\u65b0\u624b\u66f4\u5bb9\u6613\u4e0a\u624b\uff08\u4ee3\u7801\u5728\u4e0b\u9762\u7684\u94fe\u63a5\u91cc\uff09<\/li>\n<li><a href=\"https:\/\/www.myxzy.com\/alidns-api-php.html\">RouterOS\u5229\u7528aliyun\u7684API\u63a5\u53e3\u5b9e\u73b0DDNS\u52a8\u6001\u89e3\u6790 \u2013 \u7f51\u7edc\u6280\u672f \u2013 \u661f\u77e5\u82d1 (myxzy.com)<\/a>\u00a0\u6b64\u94fe\u63a5\u662f\u89e3\u6790\u4ee3\u7801\u4f5c\u8005\u7f51\u7ad9<\/li>\n<\/ul>\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff1a<\/p>\n<ol>\n<li>\u4ee3\u7801\u4e00\u5171\u4e24\u4e2a\uff0c\u4e00\u4e2a\u5728\u963f\u91cc\u4e91\u5b98\u7f51\u8bbe\u7f6e\uff0c\u4e00\u4e2a\u5728\u672c\u5730ROS\u8f6f\u8def\u7531\u91cc\u8bbe\u7f6e<\/li>\n<li>\u5efa\u8bae\u5148\u770b\u539f\u4f5c\u8005\u7f51\u7ad9\uff0c\u7136\u540e\u5728\u770bcsdn\u535a\u5ba2\u91cc\u7684\u8bbe\u7f6e\u3002<\/li>\n<li>\n<blockquote><p>\u5173\u952e\u63d0\u793a\uff08\u66f4\u6539\u7684\u5730\u65b9\u6211\u505a\u6807\u8bb0\uff09\u5269\u4e0b\u4e0d\u52a0\u7c97\u7684\u4e0d\u8981\u66f4\u6539<\/p>\n<p>{<\/p>\n<p>\u201cVersion\u201d: \u201c1\u201d,<\/p>\n<p>\u201cStatement\u201d: [<\/p>\n<p>{<\/p>\n<p>\u201cAction\u201d: [<\/p>\n<p>\u201calidns:AddDomainRecord\u201d,<\/p>\n<p>\u201calidns:DescribeDomainRecords\u201d,<\/p>\n<p>\u201calidns:UpdateDomainRecord\u201d<\/p>\n<p>],<\/p>\n<p>\u201cResource\u201d: \u201cacs:alidns:*:*:domain\/<strong>myxzy.com\u6539\u6210\u4f60\u7684\u57df\u540d<\/strong>\u201c,<\/p>\n<p>\u201cEffect\u201d: \u201cAllow\u201d<\/p>\n<p>}<\/p>\n<p>]<\/p>\n<p>}<\/p><\/blockquote>\n<\/li>\n<li>\n<blockquote><p>\u5173\u952e\u63d0\u793a\uff08\u66f4\u6539\u7684\u5730\u65b9\u6211\u505a\u6807\u8bb0\uff09\u5269\u4e0b\u4e0d\u52a0\u7c97\u7684\u4e0d\u8981\u66f4\u6539<\/p>\n<p>#aliyun Access Key<\/p>\n<p>:local id \u201c<strong>AccessKeyId<\/strong>\u201d<\/p>\n<p>:local secret \u201c<strong>AccessKeySecret<\/strong>\u201d<\/p>\n<p>#domain<\/p>\n<p>:local domain \u201c<strong>myxzy.com\u66f4\u6539\u6210\u81ea\u5df1\u7684\u57df\u540d<\/strong>\u201d<\/p>\n<p>:local record \u201c<strong>www\u6309\u9700\u586b\u5199\u4e5f\u53ef\u5168\u5220\u9664<\/strong>\u201d<\/p>\n<p>#PPPoE-out<\/p>\n<p>:local pppoe \u201c<strong>pppoe-out1\u3000\u4e00\u5b9a\u662f\u4f60\u53ef\u4ee5\u83b7\u5f97\u5916\u7f51\uff29\uff30\u7684\u90a3\u4e2a\u62e8\u53f7\u7ebf\u8def<\/strong>\u201d<\/p>\n<p>:local ipaddr [\/ip address get [\/ip address find interface=$pppoe] address]<\/p>\n<p>:set ipaddr [:pick $ipaddr 0 ([len $ipaddr] -3)]<\/p>\n<p>:global aliip<\/p>\n<p>:if ($ipaddr != $aliip) do={<\/p>\n<p>:local result [\/tool fetch url=\u201dhttp:\/\/u.myxzy.com\/alidns\/\\?id=$id&amp;secret=$secret&amp;domain=$domain&amp;record=$record&amp;ip=$ipaddr\u201d as-value output=user];<\/p>\n<p>:if ($result-&gt;\u201dstatus\u201d = \u201cfinished\u201d) do={<\/p>\n<p>:if ($result-&gt;\u201ddata\u201d = \u201c0\u201d) do={<\/p>\n<p>:set aliip $ipaddr<\/p>\n<p>:log info \u201calidns update ok\u201d;<\/p>\n<p>} else={<\/p>\n<p>:log info \u201calidns update error\u201d;<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>}<\/p><\/blockquote>\n<\/li>\n<\/ol>\n<p><strong>alidns-api-php\u811a\u672c\u6e90\u7801<\/strong><\/p>\n<p>Github\uff1a<a href=\"https:\/\/github.com\/myxzy\/alidns-api-php\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/myxzy\/alidns-api-php<\/a><\/p>\n<div class=\"entry-copyright\"><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u6587\u5730\u5740 &nbsp; bi4jgm\u2022\u00a0<\/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":[],"tags":[125],"class_list":["post-5577","post","type-post","status-publish","format-standard","hentry","tag-09-"],"_links":{"self":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/5577","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=5577"}],"version-history":[{"count":0,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/5577\/revisions"}],"wp:attachment":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/media?parent=5577"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/categories?post=5577"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/tags?post=5577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}