Results 1 to 10 of 10

Thread: Maintainin multiple dyndns accounts from wl500g.

  1. #1

    Maintainin multiple dyndns accounts from wl500g.

    This tutorial is based on wl500g hardware with Oleg's 1.9.2.7-7b firmware.

    I have three different dyndns accounts and I'm using wget with cron-jobs like (macsat's cron solution) to update these accounts.
    As I'm totally new to Linux, I might have made some choices that could be done differently (meaning more elegantly) and maybe also the chosen location of the files and directories does not fully comply to common Linux-practices, but hey.. it works for me!

    Here we go.

    Assume you have to maintain following account: wl500g.homelinux.com (this is a dyndns domain). I have decided to make my scripts reflect my chosen name in this domain, so they will show 'wl500g' in this tutorial. Please apply your own name for each domain you need to maintain.

    I have made a script (/opt/etc/cron.5mins/dnsupd_wl500g.sh) to check if the current ip-address has changed. This script will run every 5 minutes (cron) and it will update the ip-address in dyndns if it finds that the ip-address has changed.
    Code:
    #!/bin/sh
     #Get the current ip and put it into /opt/etc/dyndns/dyndns/tmp_ip_wl500g.ip
     wget -q http://checkip.dyndns.org/index.html --output-document=/opt/etc/dyndns/tmp_ip_wl500g.ip
     #Parse the answer to get only the ip and put it into /opt/etc/dyndns/new_ip_wl500g.ip
     sed -e 's/^.*Address: //' -e 's/<.*$//' /opt/etc/dyndns/tmp_ip_wl500g.ip > /opt/etc/dyndns/new_ip_wl500g.ip
     #Check if ip has changed.
     if [ "`cat /opt/etc/dyndns/new_ip_wl500g.ip`" = "`cat /opt/etc/dyndns/old_ip_wl500g.ip`" ]
     then echo "No new IP";
     else wget -q http://dyndnsusername:dyndnspwd@members.dyndns.org/nic/update?hostname=wl500g.homelinux.com\&wildcard=ON --output-document=/opt/etc/dyndns/upd_ip_wl500g.ip
     echo "New IP";
     cat /opt/etc/dyndns/upd_ip_wl500g.ip;
     rm /opt/etc/dyndns/upd_ip_wl500g.ip;
     fi
     rm -f /opt/etc/dyndns/old_ip_wl500g.ip
     rm /opt/etc/dyndns/tmp_ip_wl500g.ip
     mv /opt/etc/dyndns/new_ip_wl500g.ip /opt/etc/dyndns/old_ip_wl500g.ip
    To make this script work, you have to:
    a) Make the script executable (chmod 755 /opt/etc/cron.5mins/dnsupd_wl500g.sh)
    b) Create directory: mkdir /opt/etc/dyndns/

    If all goes well, this script will run the check every 5 minutes. If it finds the ip address unchanged, it will do nothing. If it finds the ip changed, then the wget command will be executed to updated the registered ip at dyndns. (for more information on the syntax, see: http://www.dyndns.org/developers/specs/syntax.html)

    But dyndns accounts need a forced update so they don't expire. you may update 24-35 days after your previous update with the same IP address to "touch" the record and prevent it from expiring. I want to update before the notification email from dyndns gets sent to my registration email-address, so approx. day 25 or 26 or so..

    I have made another script (/opt/etc/cron.daily/dnsupd_force_wl500g.sh]) to run daily to keep a counter and run a forced ip-updated when the counter reaches 25.
    Code:
    #!/bin/sh
    daycount="`cat /opt/etc/dyndns/dyndns_counter_wl500g`";
     if [ "`cat /opt/etc/dyndns/dyndns_counter_wl500g`" -le "24" ]
     then daycount=`expr $daycount + 1`
          echo $daycount > /opt/etc/dyndns/dyndns_counter_wl500g
     else rm /opt/etc/dyndns/old_ip_wl500g.ip
          echo 1 > /opt/etc/dyndns/dyndns_counter_wl500g
     fi
    To make this script work, you have to:
    a) Make the script executable (chmod 755 /opt/etc/cron.daily/dnsupd_force_wl500g.sh)
    b) Create the file with the counter /opt/etc/dyndns/dyndns_counter_wl500g (echo 1 > /opt/etc/dyndns/dyndns_counter_wl500g)

    Explanation: On day 25, the script will remove file /opt/etc/dyndns/old_ip_wl500g.ip and reset the counter. By removing the file /opt/etc/dyndns/old_ip_wl500g.ip, the 5mins cronjob will actually jump to the wget instruction to update the ip-address registration at dyndns.
    Exceptions: When the router was powered down more than a day (no cron jobs running), the counter will not be in line with actual expiration period at dyndns. Also: The daily script should not actually run at the same time when the 5mins script is updating the file /opt/etc/dyndns/old_ip_wl500g.ip otherwise, the forced update might not work.

    I have setup 3 scripts for every of my personal dyndns registrations. I've kept the script files for each account separate, so I can drop them easily when I remove the account at dyndns.

    (Oh, by the way: I have disabled the dyndns upfdate in the web-admin pages of the wl500g which didn't work on mine anyway.)

  2. #2
    I don't know if you will find my solution more elegant, but it's simple

    I created /etc/ddns.conf:

    Code:
    daemon
    period=300
    retrys=2016
    resolv-period=300
    max-interval=2073600 #24 days in sec
    interface=ppp0
    service-type=dyndns
    user=<<username>>:<<password>>
    host=<<host1>>,<<host2>>...
    wildcard
    then I put the folloving line into /usr/local/sbin/post-mount (has to be executable):

    Code:
    #!/bin/sh
    ...
    ez-ipupdate -c /etc/ddns.conf
    there will be checked every 5min if the IP address changed, if yes, it will be updated at dyndns

    on the web interface dyndns client is set to no

  3. #3
    Slightly deviating from the post,

    I have noticed that my wl-500 doesnt auto update the dyndns settins i have entered. I have checked though the logs and cant see any record of it doing this.

    I will attempt to fall back on don tunante's solution as I only have a single domain to update. Just would like to comment on a few things as im new to the *nix game.

    daemon Not sure what this line does
    period=300 is this the 5 min timer, i assume that due to my high lease time I could set this to 2/3 days at a time?
    retrys=2016 Not sure what this line does
    resolv-period=300 Not sure what this line does
    max-interval=2073600 #24 days in sec Not sure what this line does
    interface=ppp0 this is the wan port
    service-type=dyndns Is this just a lable for the service?
    user=<<username>>:<<password>> Username and password for dyndns
    host=<<host1>>,<<host2>>... Multiple dyndns accounts
    wildcard Domain wild card

    Now would this file be called ddns.conf and that configs made executable?

    Then a line is added to /usr/local/sbin/post-mount to run the script, Correct?
    and I thanks to your post, I understand I have to disable the gui dyndns update (which does not work atm for myself)

    I have cron already running, and would like to get the dyndns problem sorted.

    Thanks for the post, if you could answer my comments this would be great.

    Thanks

    Imp

  4. #4
    daemon ez-ipupdate will run as a daemon, stays running
    period=300 period between update attempts, checks every 5 min. if public IP address has changed
    retrys=2016 if the update process fails it will try 2016 times
    resolv-period=300 time between failed resolve attempts
    max-interval=2073600 max. time between updates see why
    interface=ppp0 ip of this interface will be monitored
    service-type=dyndns service, like in the drop-down list in the GUI
    user=<<username>>:<<password>> Username and password for dyndns
    host=<<host1>>,<<host2>>... host names registered at dynDNS
    wildcard enable wildcard

    I gave the name for this configuration file /etc/ddns.conf, and it hasn't to be executable

    /usr/local/sbin/post-mount has to be executable and include the line
    Code:
    ez-ipupdate -c /etc/ddns.conf
    yes, you have to disable the DynDNS feature in the GUI

    using this configuration file you don't need cron, as ez-ipupdate will run as a daemon and check every 5 min. if the IP address of the ppp0 interface has changed (you can't be sure, when exactly it will change, even in case of a longer lease time), if yes, then updates it at DynDNS, and if there is no connection to DynDNS, it will keep trying 2016 times, every 5 min. (1 week)

    More about ez-ipupdate

  5. #5
    Thanks for the great reply,

    One more question....

    do I have to keep the << >>'s around my ursername and password/host?

    Edit, you dont need the << >>'s and I had to change my interface=ppp0 to interface=vlan1


    Imp
    Last edited by impossible; 20-04-2006 at 23:47.

  6. #6
    Hi guyz

    I've configured ez-ipupdate to maintain one dynamic domain, and it works perfectly.

    Now, I'ld like to maintain multiples domains, which are not hosted by the same service (dyndns and zoneedit, by the way).
    Does anyone know how to do this ? I've tried 2 differents configuration files, but it seems to be impossible tu run multiple instances of ez-ipupdate.

    Thanks in advance

  7. #7
    Helooooo
    @don tunante: Thanks for the tut. It work great.

  8. #8
    Join Date
    Nov 2004
    Location
    Sweden
    Posts
    259

    wildcard in .conf file

    I have detected that the "wildcard" parameter in the .conf file for ez-ipupdate does not properly applies with dyndns.org. I can see in dyndns.org the IP gets updated but the wildcard checkbox.

    One thing that seems somehow strange in the .conf file is that the "wildcard" parameter stands alone and not belonging to any specific domain. Does it mean that all multiple domains defined in the .conf file will be affected by this parameter? In dyndns.org every domain has its own wildcard checkbox.

    I have not found how to get this to work yet.
    Last edited by Tamadite; 29-05-2007 at 22:38.

  9. #9
    Hi there, I have a question in regards of this line:

    interface=ppp0 ip of this interface will be monitored
    Should it be the same for both DSL and Cable modem connections?

    Thanks.
    Last edited by sonice; 24-12-2007 at 19:39.

  10. #10
    Quote Originally Posted by sonice View Post
    Hi there, I have a question in regards of this line:



    Should it be the same for both DSL and Cable modem connections?

    Thanks.

    ppp0 is suitable for PPPOE connections, for DHCP connections it's

    Code:
    interface=vlan1

Similar Threads

  1. Router doesn't see USB disk anymore
    By Styno in forum WL-500g Q&A
    Replies: 7
    Last Post: 15-08-2006, 08:37
  2. Firmware v1.7.5.6 CR5 [Oleg]
    By Oleg in forum WL-500g Firmware Releases
    Replies: 43
    Last Post: 14-07-2004, 21:54
  3. Total crash every day
    By Djuri in forum WL-500g Q&A
    Replies: 8
    Last Post: 09-06-2004, 09:05

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •