Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Auto Refresh DDNS on WAN Fail-over

    Scheduled Pinned Locked Moved DHCP and DNS
    1 Posts 1 Posters 235 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      skull1-2004
      last edited by skull1-2004

      Hi,
      I am using 22.05. I have dual wan setup and i want the DDNS to capture the new IP in a fail-over situation. Right now i need to force the update to refresh the cached IP. I am using google domains for DDNS.

      I have found the code below to create a cron job to force refresh every 30 min.

      I want my version to check every 10 min so I changed the line to this:

      CRON: */10 * * * * root /usr/bin/nice -n20 /etc/rc.force.dyndns.update

      It's not working though. I assume i need to change this line:
      myIP=dig +short myip.opendns.com @resolver1.opendns.com

      Can anyone give me some advice on this? Thanks!

      edit:
      saw this bug but cannot be replicated by "Jim"
      https://redmine.pfsense.org/issues/12485

      https://serverfault.com/questions/1092678/how-to-automatically-save-and-force-update-of-a-dynamic-dns-on-pfsense
      
      CRON: */30 * * * * root /usr/bin/nice -n20 /etc/rc.force.dyndns.update
      
      #!/bin/sh
      dynamicHost=""
      myIP=`dig +short myip.opendns.com @resolver1.opendns.com`
      myIP_error=$?
      noIP=`dig $dynamicHost | grep -A1 ANSWER | grep IN | cut -f 6`
      
      if [ "$myIP" == "$noIP" ] ; then
          exit
      else
      
          if [ "$myIP_error" -eq 0 ]
              then
                  /etc/rc.dyndns.update
              else
                  exit
          fi
      fi
      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.