OpenWRT 18.06.4 – DDNS for CloudFlare

Install packages

  1. Login to you router
  2. Go to [System] -> [Software]
  3. In {Actions} tab, click the <Update lists> button
  4. Install the following packages
    • luci-app-ddns
      1. Will auto install
        • ddns-scripts
    • ddns-scripts_cloudflare.com-v4
      1. Will auto install
        • ca-bundle
        • libcurl
        • curl

Settings for CloudFlare

For example, I have a domain called ‘myabc.com’ and would like to have a DDNS ‘myRouter.myabc.com’ to point to my router.

Setup a zone in CloudFlare

  1. Login to your CloudFlare account
  2. Go to your domain, in my example it will be ‘myabc.com’
  3. Go to [DNS]
  4. Click <+Add record>
  5. In {Type} field select:
    • A
  6. In {Name} field input:
    • myRouter
  7. In {IPv4 address} field input a random IP first
  8. Click <Save> button
  9. Go to [My Profile]
  10. Go to {API Tokens} tab
  11. Go to {API Keys} section
  12. Click the <View> button at {Global API Key}
  13. Copy that API key and it will in used in the next section

Add DDNS entry in OpenWRT

  1. Go to [Services] -> [Dynamic DNS]
  2. In section {Overview} -> {Basic} tab
  3. In drop down menu {DDNS Service provider [IPv4]}:
    • cloudflare.com-v4
  4. Go to input field and input
    • myRouter_myabc_com
  5. Click <Add> button and it will go into the details page
  6. Ensure {Enabled} field:
    • Marked with tick
  7. In {Lookup Hostname} input field:
    • myRouter.myabc.com
  8. In {IP address version} select:
    • IPv4-Address
  9. In {Domain} field in put your domain with a @ character:
    • myRouter@myabc.com
  10. In {Username} field:
    • your username for login CloudFlare, ie: myEmail@gmail.com
  11. In {Password} field:
    • The Global API Key from CloudFlare
  12. In section {Overview} -> {Advanced Settings} tab
  13. In {URL to detect [IPv4]} field
    • http://checkip.dyndns.com
  14. In {Event Network [IPv4]} field
    • wan
  15. Click <Save & Apply> button