Skip to content

klayf96/routeros-cloudflare-ddns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

routeros-cloudflare-ddns

Cloudflare DDNS script for MikroTik RouterOS v7


Guide for DHCP Client version

🚀  Features

  • Efficient as it runs on DHCP Client level.
  • Cloudflare DNS ID is automatically retrieved, and TTL and Proxied values are preserved as existing settings.
  • Supports IPv4 addresses. (IPv6/SLAAC prefix delegated addresses are not supported yet)
  • It consists of simple code, so it runs smoothly even on low-end devices. (Tested on hAP ac lite)
  • Written for RouterOS v7, no external parsing script is required.

🛠️  Set required Variables

cfDomainName

  • Domain(DNS Record name) to which DDNS will be applied (e.g. nas.example.com)
  • The target domain or subdomain must already be created in Cloudflare DNS Record.

cfDNSZoneId

  • DNS Zone ID of Cloudflare account (Displayed at the bottom right of your Cloudflare Dashboard)

cfAPIToken

  • API token of Cloudflare account (It can be created from the bottom right of the Cloudflare Dashboard)
  • Please see the following link: https://developers.cloudflare.com/fundamentals/api/get-started/create-token/
  • Global API key is the previous authentication method, and Cloudflare recommends using API Token. Therefore, the public version of this script has removed the logic related to Global API key.

verifyAddr (default: false)

  • If this value is set to true, it verifies whether the leased address is a Public Address.
  • If the router leased a Private Address, it queries AWS checkip to register the actual address. (This can be helpful in CGNAT environments)
  • This logic is not helpful in a double NAT environment, because the current router is not the actual leaser, so it cannot detect the address change. (In a double NAT environment, use a scheduler script for periodic updates.)

🔑  Applying Cloudflare DDNS via WinBox

1. Copy the contents of cloudflare-ddns-dhcp-client.rsc using [Copy raw file].

2. Open the DHCP Client List

  • IPv4 Address : Click [IP] - [DHCP Client]
  • IPv6 Address : Click [IPv6] - [DHCP Client] (Not supported yet)

3. Open the properties of the currently active DHCP Client, click the [Advance] tab and paste the script into the [Script] entry.

4. Enter the required variables in the script, then click Apply and Release.

5. If the test update is completed successfully, the following entry will appear in the log.

6. Now, no further configuration is required. If your router leases a different address from your ISP, it will update automatically.

Releases

No releases published

Packages

 
 
 

Contributors