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

    Dynamic DNS auto update issue

    Scheduled Pinned Locked Moved DHCP and DNS
    7 Posts 2 Posters 1.7k Views
    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.
    • I
      ikedoz
      last edited by

      I have set up two dynamic DNS clients some time ago on my pfsense router (2.4.5-RELEASE-p1). One is disabled and greyed out in "Services / Dynamic DNS / Dynamic DNS Clients", the other one is enabled and the cached IP address is green.

      I tried editing the IP at my registrar, then clicking the "Save & Force Update" button reverted the change.

      Then I wanted to see if I could do it over SSH. I noticed this line in /etc/crontab:

      1 1 * * * root /usr/bin/nice -n20 /etc/rc.dyndns.update

      I executed it over SSH but it didn't seem to do anything.

      /etc/rc.dyndns.update seems to basically call services_dyndns_configure() then services_dnsupdate_process(). The relevant part seems to be services_dnsupdate_process().

      In my /cf/conf/config.xml, I have <dnsupdates></dnsupdates>. Therefore the following code is executed, so services_dnsupdate_process() returns 0 and doesn't do anything.

      /* Dynamic DNS updating active? */
      if (!is_array($config['dnsupdates']['dnsupdate'])) {
      	return 0;
      }
      

      I waited overnight after editing the IP at my registrar to see if that cron job worked but it didn't seem to change anything.

      So the only thing I could do is "Save & Force Update", which works but the cron job doesn't seem to work. Would you know why my dynamic DNS auto update feature doesn't work? Is <dnsupdates></dnsupdates> in my config.xml wrong? Did I miss a setting?

      Thanks for your help :).

      1 Reply Last reply Reply Quote 0
      • S
        serbus
        last edited by

        Hello!

        Any clues in the logs?

        clog /var/log/system.log | grep "rc.dyndns.update"

        John

        Lex parsimoniae

        1 Reply Last reply Reply Quote 0
        • I
          ikedoz
          last edited by ikedoz

          Hello John,

          Here is what I get when I force update while the IP at the registrar is correct:

          Jul 30 16:29:14 routeur php-cgi: rc.dyndns.update: phpDynDNS: updating cache file /conf/dyndns_wannamecheap'[my_hostname]'0.cache: [my_IP]
          Jul 30 16:29:14 routeur php-cgi: rc.dyndns.update: phpDynDNS ([my_subdomain]): (Success) IP Address Updated Successfully!
          

          Here is what I get when I do /usr/bin/nice -n20 /etc/rc.dyndns.update when the IP at the registrar is correct:

          Jul 30 16:30:39 routeur php-cgi: rc.dyndns.update: phpDynDNS ([my_hostname]): No change in my IP address and/or 25 days has not passed. Not updating dynamic DNS entry.
          

          Here is what I get when I do /usr/bin/nice -n20 /etc/rc.dyndns.update after the IP has been changed at the registrar:

          Jul 30 16:31:59 routeur php-cgi: rc.dyndns.update: phpDynDNS ([my_hostname]): No change in my IP address and/or 25 days has not passed. Not updating dynamic DNS entry.
          

          Here is what I get when I force update after the IP has been changed at the registrar:

          Jul 30 16:32:39 routeur php-cgi: rc.dyndns.update: phpDynDNS: updating cache file /conf/dyndns_wannamecheap'[my_hostname]'0.cache: [my_IP]
          Jul 30 16:32:39 routeur php-cgi: rc.dyndns.update: phpDynDNS ([my_subdomain]): (Success) IP Address Updated Successfully!
          

          It looks like the IP is always correct, even after being changed...

          Thanks for your help :).

          Edit: I enabled verbose logging. Here is what I get after running `` and after I changed the IP at my registrar:

          Jul 30 16:54:42 routeur php-cgi: rc.dyndns.update: Dynamic DNS: updatedns() starting
          Jul 30 16:54:42 routeur php-cgi: rc.dyndns.update: Dynamic DNS namecheap ([my_hostname]): [my_IP] extracted from Check IP Service
          Jul 30 16:54:42 routeur php-cgi: rc.dyndns.update: Dynamic DNS ([my_hostname]): running get_failover_interface for wan. found igb0
          Jul 30 16:54:43 routeur php-cgi: rc.dyndns.update: Dynamic DNS namecheap ([my_hostname]): [my_IP] extracted from Check IP Service
          Jul 30 16:54:43 routeur php-cgi: rc.dyndns.update: Dynamic Dns ([my_hostname]): Current WAN IP: [my_IP] Cached IP: [my_IP]
          Jul 30 16:54:43 routeur php-cgi: rc.dyndns.update: phpDynDNS ([my_hostname]): No change in my IP address and/or 25 days has not passed. Not updating dynamic DNS entry.
          

          In what is above, [my_IP] is always the same.
          (I wrote my_hostname but it's actually my fully qualified domain name, sorry..)

          So the check IP service returns the correct IP but then it seems to check again a cached IP that is no longer the IP at my registrar.

          1 Reply Last reply Reply Quote 0
          • S
            serbus
            last edited by

            Hello!

            Some of the dyndns heavy lifting is done in the dyndns.class file. Before pushing an update it will try to _detectChange by comparing the current interface ip to the last update it pushed, which is cached in a /cf/conf/dyndns_xxxxxxxxxx.cache file.

            I dont think it pulls the current ip stored at the ddns provider when determining whether or not to push an update.

            The "force" will override this change detection.

            John

            Lex parsimoniae

            1 Reply Last reply Reply Quote 1
            • I
              ikedoz
              last edited by

              Thanks for explaining. So maybe I misunderstood what this functionality does.

              I thought it would react to a change at the registrar's end, but if I understood you correctly, it only reacts to a change on the interface IP. Is that correct?

              Then I wonder, how can I force an update via ssh?

              1 Reply Last reply Reply Quote 0
              • S
                serbus
                last edited by

                @ikedoz said in Dynamic DNS auto update issue:

                I thought it would react to a change at the registrar's end, but if I understood you correctly, it only reacts to a change on the interface IP. Is that correct?

                Hello!

                That is correct, based on my understanding of the code.

                The best thing I have come up with to script a forced ddns update is to "reset" the dyndns cache file and then call for an update. Something like :

                awk '{print "0.0.0.0|0" > FILENAME}' /cf/conf/dyndns_*
                /etc/rc.dyndns.update
                

                John

                Lex parsimoniae

                1 Reply Last reply Reply Quote 1
                • I
                  ikedoz
                  last edited by

                  This works great, thanks :)

                  1 Reply Last reply Reply Quote 0
                  • S serbus referenced this topic on
                  • S SteveITS referenced this topic on
                  • w0wW w0w referenced this topic on
                  • GertjanG Gertjan referenced this topic on
                  • First post
                    Last post
                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.