RouterOS Cloudflare DDNS Script 脚本Cloudflare DDNS插件Script脚本
RouterOS Cloudflare DDNS Script 脚本
################# CloudFlare variables #################
:local CFDebug "true"
:global WANInterface "pppoe4plex"
:local CFdomain "*****.lingbo.me"
:local CFzone "lingbo.me"
:local CFrecordType "A"
:local CFemail "****************@gmail.com"
:local CFtkn "bc24e143b3840****************9e13a5"
:local CFzoneid "a926a****************accb8"
:local CFid "661c43a****************95994087"
#########################################################################
######################## DO NOT EDIT BELOW ############################
#########################################################################
################# Internal variables #################
:local resolvedIP ""
:global WANip ""
################# Resolve and set IP-variables #################
:local currentIP [/ip address get [/ip address find interface=$WANInterface ] address];
:set WANip [:pick $currentIP 0 [:find $currentIP "/"]];
:set resolvedIP [:resolve $CFdomain];
################# Build CF API Url (v4) #################
:local CFurl "https://api.CloudFlare.com/client/v4/zones/"
:set CFurl ($CFurl . "$CFzoneid/dns_records/$CFid");
######## Write debug info to log #################
:if ($CFDebug = "true") do={
:log info ("CF: hostname = $CFdomain")
:log info ("CF: resolvedIP = $resolvedIP")
:log info ("CF: currentIP = $currentIP")
:log info ("CF: WANip = $WANip")
:log info ("CF: CFurl = $CFurl&content=$WANip")
};
######## Compare and update CF if necessary #####
:if ($resolvedIP != $WANip) do={
:log info ("CF: Updating CF, setting $CFDomain = $WANip")
/tool fetch http-method=put mode=https url="$CFurl" http-header-field="X-Auth-Email:$CFemail,X-Auth-Key:$CFtkn,content-type:application/json" output=none http-data="{"type":"$CFrecordType","name":"$CFdomain","content":"$WANip"}"
/ip dns cache flush
} else={
:log info "CF: No Update Needed!"
}
点击链接加入群聊三群:751529538
点击链接加入群聊二群:376877156
点击链接加入群聊【路由器交流群:622891808已满】
本站附件分享,如果附件失效,可以去找找看
饿了么红包