Dynamic DNS auto update issue



  • 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 :).



  • Hello!

    Any clues in the logs?

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

    John



  • 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.



  • 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



  • 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?



  • @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



  • This works great, thanks :)


Log in to reply