2019年4月8日 星期一

[RouterOS] 更新 Google Domains DDNS script

RouterOS version: 6.39.2
Google Domains 有支援 DDNS, 這個 script 就是用來在 MikroTik RouterOS 中更新 Google Domains DDNS 位址的。
# script name: update_google_ddns
# Google domains automatic Dynamic DNS update

#--------------- Change Values in this section to match your setup ------------------

# 設定 Google domains DDNS 提供用來更新憑證的帳號密碼, 不是一般的 Google 帳號密碼
:local GoogleDNSUsername "使用者名稱"
:local GoogleDNSPassword "密碼"

# Set the hostname or label of network to be updated. ex: "ladsai.com"
:local hostName "要更新的domain name"

# Change to the name of interface that gets the dynamic IP address. ex: "pppoe-out1"
:local inetinterface "你的pppoe連線名稱"

#------------------------------------------------------------------------------------
# No more changes need
:global previousIP
:local setResults ""

:if ([/interface get $inetinterface value-name=running]) do={
# Get the current IP on the interface
 :local currentIP [/ip address get [find interface="$inetinterface" disabled=no] address]

# Strip the net mask off the IP address
 :for i from=( [:len $currentIP] - 1) to=0 do={
 :if ( [:pick $currentIP $i] = "/") do={ 
 :set currentIP [:pick $currentIP 0 $i]
 } 
 }

:do {
 :if ($currentIP != $previousIP) do={
 /tool fetch url="https://$GoogleDNSUsername:$GoogleDNSPassword@domains.google.com/nic/update?hostname=$hostName&myip=$currentIP" mode=https dst-path=GoogleDNS.txt
 :set setResults [/file get GoogleDNS.txt contents];
 :set previousIP $currentIP
 :log info ("GoogleDNS said this: $setResults")
 } 
 } on-error={
 :set previousIP ""
 }
} else={
 :log info "$inetinterface is not currently running, so therefore will not update."
}
再將 script 加入排程 (/system scheduler) 讓系統定時執行,如此當 PPPOE 重新連線時,即可自動更新 Google Domains DDNS。
Interval: 排程間隔執行時間,例如: 00:01:00 表示間隔1分鐘執行一次。
On Event: 要執行的 script 名稱。


Google Domains 中選 “查看憑證” 可顯示用來更新 DDNS 的 “使用者名稱” 與 “密碼”。


WinBox 中顥示的 PPPoE 連線名稱。

5 則留言:

  1. Harrah's Reno, NV Hotel - Mapyro
    Search by real traveler 부산광역 출장안마 reviews, 충주 출장샵 reviews and information about Harrah's Reno, NV Hotel in Reno, 밀양 출장샵 USA 의왕 출장샵 on Mapyro. Find reviews 당진 출장샵 and discounts for AAA/AARP members,

    回覆刪除
  2. Casino & Hotel Review | Tricktactoe
    All 사설 토토 초범 유니 88 you need to know about Casino 사나이 토토 넷마블 & Hotel. Casino & 파워볼사이트 Hotel 먹튀검증 업체 샤오미 reviews are conducted 바셀티비 by a team of professional players who are knowledgeable in the field of casino

    回覆刪除
  3. The acquired cash can now be transferred to the wallet. Prize wheels provide PA gamblers a fun and creative approach to earn much more bonus cash by way of free spins or prize wheels. So, in case you are wagering $10, solely $0.05 additionally be} deducted from your wagering requirement with a 5% weighted sport. The $1500 welcome bonus 1xbet certainly one of the|is amongst the|is doubtless considered one of the} most spectacular we could discover.

    回覆刪除
  4. Unlike plenty of on-line casinos, you will 카지노사이트 not find a single sport with old, grainy graphics and tacky sound effects. There is so much to get enthusiastic about at Cafe Casino from their superb choice of lot video games on supply to their unimaginable bonuses and rewards. They have a new new} sport referred to as Genesis Island which depicts the conflict of titans between King Kong and the indomitable T-Rex.

    回覆刪除
  5. We perceive that playing dependancy may be an embarrassing factor to confront. While we are happy assist you|that will assist you|that can assist 카지노사이트 you} we don't have to know who you might be}. BetBlocker does not advertise any products or services what-so-ever. We have worked exhausting to make BetBlocker as easy and intuitive to set-up as attainable.

    回覆刪除