Multiple DynDns

Home Page Forums Network Management Networking Multiple DynDns

This topic contains 6 replies, has 0 voices, and was last updated by  tialohitc 9 years, 2 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #41919

    tialohitc
    Member

    Hi everyone,

    I want to use my first zeroshell box (Alix 2D13) with three DSL-Connections (all on ETH1). Each one has a dynamic IP that changes at irregular times.

    How can I best set up THREE INDEPENDENT DYNDNS ACCOUNT UPDATES?

    Thank you in advance for any ideas and hints!

    Thomas

    #48751

    ppalias
    Member

    I had the same problem with 2 dynamic adsl connections. Although I would very much like to see in future releases the ability to have multiple dynamic dns clients, I have temporarily tried the following workaround. There are 2 always-on servers which have a dyndns client running. These 2 servers are forwarded to a different gateway with a netbalancer rule. As a result one dyndns client updates the first account and the other client the second account.

    #48752

    tialohitc
    Member

    Hi ppalias,

    Yes, that would work. But unfortunately not with my setup…

    Could it be achieved with a script, cronjob, etc? Doesn’t have to be a gui-solution…

    #48753

    Marcelo
    Member

    Hi,

    This page contains a set of scripts that do the job. I used these scripts for years on the Linksys NSLU2 NAS.

    They are well written and, despite written for running on the NSLU2, they are not platform dependent. I have successfully used them on a regular linux box.

    Hope it helps as a kickstart for you to write one for the purpose you described (managing multiple dyndns domais). Good luck!

    http://www.nslu2-linux.org/wiki/HowTo/DynDNSupdate

    Regards,

    #48754

    Lightyear
    Member

    I currently have two dynamic IP connections, one ADSL and one 3G.
    Ivan Baldo, fine programmer and friend extraordinaire, made a script so ZeroShell updates both dynamic IPs.
    He called it ddns2.nuestro (we are Spanish speakers) and placed it in the /Database directory.
    Then he added the following command to the ZeroShell preboot script:

    cp -v /Database/ddns2.nuestro /root/kerbynet.cgi/scripts/ddns2

    so ddns2.nuestro is what ZeroShell wil run when updating dynamic IPs.
    It has worked without a glitch for more than 3 months now, and I think it is very easy to modify for more than 2 dyndns accounts, or for another DDNS service.
    Here it goes:

    #!/bin/sh

    # Script made by Ivan Baldo to permit multiple dyndns IP updating in ZeroShell

    Usuario=”your_dyndns_user_name”
    Contrasena=”your_dyndns_password”
    Host_PPP0=”http_address_of_dyndns_account_1″
    Host_PPP1=”http_address_of_dyndns_account_2″

    actualiza ()
    {
    Interfaz=”$1″
    Host=”$2″
    IP=$(ifconfig $Interfaz 2>/dev/null | awk ‘NR==2 {print $2}’ | grep ‘.*..*..*..*’ | cut -d: -f2)
    touch /tmp/dyndns.ipviej.$Interfaz
    IPViej=”$(cat /tmp/dyndns.ipviej.$Interfaz)”
    Actualizar=”no”
    if [ “$IP” != “” ]; then
    if [ “$IP” != “$IPViej” ]; then
    Actualizar=”si”
    fi
    fi
    if [ “$Actualizar” = “no” ]; then
    return
    fi
    if [ -e /tmp/dyndns.deshabilitado.$Interfaz ]; then
    return
    fi
    logger -t DDNS “Actualizando $Host a $IP de interfaz $Interfaz.”
    if wget “–bind-address=$IP” -t 3 -w 20 -o /tmp/dyndns.error.$Interfaz -O /tmp/dyndns.resultado.$Interfaz
    “http://$Usuario:$Contrasena@members.dyndns.org/nic/update?system=dyndns&hostname=$Host&mx=$Host&myip=$IP”
    then
    logger -t DDNS “==> $(cat /tmp/dyndns.resultado.$Interfaz)”
    if grep -q “!yours|notfqdn|abuse|nohost|badagent|badauth|badsys|dnserr|numhost|911|!donator”
    /tmp/dyndns.resultado.$Interfaz
    then
    logger -t DDNS “==> Hubo un error reportado por DynDNS, luego de solucionar el problema borre el archivo /tmp/dyndns.deshabilitado.$Interfaz!”
    touch /tmp/dyndns.deshabilitado.$Interfaz
    else
    echo “$IP” >/tmp/dyndns.ipviej.$Interfaz
    fi
    else
    logger -t DDNS “==> Error al conectarse con DynDNS:”
    grep -v ” => ” /tmp/dyndns.error.$Interfaz | logger -t DDNS
    fi
    }

    while true; do
    actualiza ppp0 $Host_PPP0
    actualiza ppp1 $Host_PPP1
    sleep 60
    done

    Unfortunately, the forum editor does not allow script formatting. I hope it is readable all the same.
    I believe also it’s easy to translate the Spanish parts if need be, but in any case I will be following this thread so feel free to ask for translation.

    I hope I didn’t break any forum rule copying the script here, but I feel it really can be of help to someone, and I do not have any place to hang it for downloading 🙁 .
    ZeroShell rules! 😀

    #48755

    ppalias
    Member

    Hi Lightyear!
    This is a very useful script indeed! You can use the

     [ code ] [ / code ] 

    tags to make it appear more clearly.
    My question is if Ivan could alter the script so that it would accept 2 or more totally different accounts, which means that the http_address_1 has username_1 and password_1 and http_address_2 has username_2 and password_2

    #48756

    Lightyear
    Member

    No need to bother Ivan; here follows the modified script 8)

    #!/bin/sh
    # Script made by Ivan Baldo to permit multiple dyndns accounts in ZeroShell

    Host_PPP0="http_address_of_dyndns_account_1"
    Host_PPP1="http_address_of_dyndns_account_2"

    actualiza ()
    {
    Interfaz="$1"
    Host="$2"
    Usuario="$3"
    Contrasena="$4"
    IP=$(ifconfig $Interfaz 2>/dev/null | awk 'NR==2 {print $2}' | grep '.*..*..*..*' | cut -d: -f2)
    touch /tmp/dyndns.ipviej.$Interfaz
    IPViej="$(cat /tmp/dyndns.ipviej.$Interfaz)"
    Actualizar="no"
    if [ "$IP" != "" ]; then
    if [ "$IP" != "$IPViej" ]; then
    Actualizar="si"
    fi
    fi
    if [ "$Actualizar" = "no" ]; then
    return
    fi
    if [ -e /tmp/dyndns.deshabilitado.$Interfaz ]; then
    return
    fi
    logger -t DDNS "Actualizando $Host a $IP de interfaz $Interfaz."
    if wget "--bind-address=$IP" -t 3 -w 20 -o /tmp/dyndns.error.$Interfaz -O /tmp/dyndns.resultado.$Interfaz
    "http://$Usuario:$Contrasena@members.dyndns.org/nic/update?system=dyndns&hostname=$Host&mx=$Host&myip=$IP"
    then
    logger -t DDNS "==> $(cat /tmp/dyndns.resultado.$Interfaz)"
    if grep -q "!yours|notfqdn|abuse|nohost|badagent|badauth|badsys|dnserr|numhost|911|!donator"
    /tmp/dyndns.resultado.$Interfaz
    then
    logger -t DDNS "==> Hubo un error reportado por DynDNS, luego de solucionar el problema borre el archivo /tmp/dyndns.deshabilitado.$Interfaz!"
    touch /tmp/dyndns.deshabilitado.$Interfaz
    else
    echo "$IP" >/tmp/dyndns.ipviej.$Interfaz
    fi
    else
    logger -t DDNS "==> Error al conectarse con DynDNS:"
    grep -v " => " /tmp/dyndns.error.$Interfaz | logger -t DDNS
    fi
    }

    while true; do
    actualiza ppp0 $Host_PPP0 username_1 password_1
    actualiza ppp1 $Host_PPP1 username_2 password_2
    sleep 60
    done

    Of course, to provide for another DDNS service, it would be neccesary to know these other service quirks and tricks.
    And thank you for the tip, ppalias! I do hope you have had a very good 2010 beginning.

    #48757

    ppalias
    Member

    Thanks Lightyear! I’ll try it at home later on and let you know. It looks ok however on a first glance.

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.