Dynamic DNS support in Fit123 package



  • My pfSense box has a router between it and the internet. The WAN interface on my pfsense box has IP address 192.168.x.y. The dynamic DNS support in the Fit123 package doesn't work with this configuration because it uses the IP address of the WAN interface which doesn't necessarily change in synchronisation with the IP address of the the internet connection.

    I've made some changes to the Fit123 ddns files to get the IP address from web server http://myip.dnsomatic.com

    I've changed /usr/local/pkg/Fit123/ddns/DDNS.sh as follows:

    
    # diff DDNS.sh.orig DDNS.sh
    19c19,21
    <         current_ip=`ifconfig ${ext_if} | awk '/inet / { print $2 }'`
    ---
    > #        current_ip=`ifconfig ${ext_if} | awk '/inet / { print $2 }'`
    > #Get current IP address from internet since its not set on any of our interfaces
    >       current_ip=`/usr/local/bin/php /usr/local/pkg/Fit123/ddns/getip.php | grep '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}`
    26c28
    <                 echo "Your DDNS records have been updated" | logger
    ---
    >                 echo "Your DDNS records have been updated to " $current_ip | logger
    #
    
    ```and created file /usr/local/pkg/Fit123/ddns/getip.php
    

    more /usr/local/pkg/Fit123/ddns/getip.php

    $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "http://myip.dnsomatic.com");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_MUTE, true);
        $html = curl_exec($ch);
        curl_close($ch);
        echo $html;
    ?>

    
    I'd prefer to have it as a configurable option to get the IP address from either the WAN interface or a specified web host but that probably requires a bit more familiarity with php and pfSense internals than I have at the moment.
    
    These changes should allow me to kill off a patched version of ddclient I've been running on a Linux box downstream of pfSense.


  • Assuming you use DNS-O-Matic, did you by chance use it to update a Dyndns.org account as well?

    Tried that and my OpenDNS account was updated with the right IP but updating dyndns.org failed with a "waiting for …" error.
    Have you been able to solve this? Other than this hiccup I really love this duo dns-o-matic/OpenDNS. The kids are a bit pissed, though  ;-)



  • I have DNS-O-Matic configured to update a dyndns.org account as well as the opendns account. Since I posted the original message I have had only one error notification from the DNS-O-matic service (16-Jul-2009) and it said

    DynDNS response for '***.dyndns.org':
    –------------------

    <title>502 Proxy Error</title>

    Proxy Error

    The proxy server received an invalid
    response from an upstream server.

    The proxy server could not handle the request GET /nic/update.

    Reason: Error reading from remote server

    which I didn't understand but since I've seen it only the once in more than a month I've assumed it was a temporary error. The history entries at dnsomatic seem to cover about a week and the only error entry was that one on 16-Jul.


Log in to reply