Dynamic DNS with Cloudflare and Tomato Firmware

How to set up Dynamic DNS with free Cloudflare DNS service using Tomato Firmware

  1. Login to Cloudflare:
    https://www.cloudflare.com/login
  2. Go to DNS Settings under your domain and add an “A” DNS entry for Dynamic DNS (ddns used in this example)
  3. Get your API key from https://www.cloudflare.com/my-account
  4. Example Curl code to test if its working (Optional)

    curl https://www.cloudflare.com/api_json.html \
    -d 'a=rec_edit' \
    -d 'tkn=YOUR_API_KEY_HERE' \
    -d 'id=YOUR_DNS_ENTRY_ID' \
    -d 'email=YOUR_CLOUDFLARE_EMAIL' \
    -d 'z=YOUR_CLOUDFLARE_ROOT_DOMAIN' \
    -d 'type=A' \
    -d 'name=YOUR_CLOUDFLARE_DNS_ENTRY' \
    -d 'content=1.2.3.4' \
    -d 'service_mode=0' \
    -d 'ttl=1'
    
  5. Get DNS entry ID – requires your API key, domain, and email address. Make sure you replace the parameters with your own.

    (Note – Open URL in a different browser, otherwise you’ll get errors):

    https://www.cloudflare.com/api_json.html?a=rec_load_all&tkn=YOUR_API_KEY_HERE&email=YOUR_CLOUDFLARE_EMAIL&z=YOUR_CLOUDFLARE_ROOT_DOMAIN
  6. Search the page for “ddns”, or whatever you named your dns entry. Make sure your copy the {“rec_id”: that is at the top of the block.
  7. Test updating the IP in your browser. Look for success at the bottom.
    https://www.cloudflare.com/api_json.html?a=rec_edit&tkn=YOUR_API_KEY_HERE&id=YOUR_DNS_ENTRY_ID&email=YOUR_CLOUDFLARE_EMAIL&z=YOUR_CLOUDFLARE_ROOT_DOMAIN&type=A&name=YOUR_CLOUDFLARE_DNS_ENTRY&content=1.2.3.4&service_mode=0&ttl=1
  8. Refresh your domain’s DNS entries page to see if the IP became 1.2.3.4.
  9. Copy and paste your modified URL from step 6 into Tomato
    Make sure to replace 1.2.3.4 with @IP in the URL
  10. Refresh your domain’s DNS entries page again to verify that the IP has been set.
  11. That’s it 🙂
  12. Additional Info:
    http://www.cloudflare.com/docs/client-api.html#s5.2