Dynamic DNS updates from another box?

Discussion in 'Cisco/Linksys Wireless Routers' started by msherman, Jul 18, 2004.

  1. msherman

    msherman Network Guru Member

    I posted this message yesterday on the Sveasoft forum, but it went subscriber-only today, so I can't read the replies... and I need this question answered to decide if I want to subscribe. :)

    Anyway, I've got a WRT54g, a linux box which acts as a web/mail server, and a few other PCs. I connect to my ISP over PPPOE. I have 3 domain names which I control using ez-ipupdate on the linux box, which is currently acting as the router. I'd like to switch my setup around so that the WRT54g is the router/connection to the ADSL modem, and foward only the necessary ports through to the linux box behind it.

    However, the WRT54g only supports a single dynamic DNS hostname, and it looks like none of the firmwares out there support my DNS provider (easydns.com) in the ez-ipupdate configuration (though ez-ipupdate itself does support it).

    So what I'd like to do is continue running ez-ipupdate on the linux box, and have it determine when the ip address changes on the wrt54g. Is it possible to configure the wrt54g to either somehow notify another box on the internal network when the public IP changes, or to run a cronjob on the linux box to poll the wrt54g for ip changes? What firmware is needed to get this working?

    Thanks in advance for any advice...
  2. littlewhoo

    littlewhoo Network Guru Member

    I don't know about this ez-ipupdate stuff, but to notify your PC of an IP change you can run a script similar to this on your router in the backgroud:

    oldip=$(ifconfig ppp0|grep 'inet addr:'|cut -d : -f2|cut -d ' ' -f1)
    while sleep 15; do
      newip=$(ifconfig ppp0|grep 'inet addr:'|cut -d : -f2|cut -d ' ' -f1)
      if [ "$oldip" -ne "$newip" ]; then
        --->send the IP to your PC<---
        oldip=$(ifconfig ppp0|grep 'inet addr:'|cut -d : -f2|cut -d ' ' -f1)
    This is checking every 15 seconds if the IP has changed. In case of an IP change it executes, whatever you replace for "--->send the IP to your PC<---"
    There are different ways to actually send the new IP to your PC.

    You could use wget to call a php page on a webserver running on your PC and pass the IP as a parameter.

    res=$(wget -q -O '-' "http://webserveronyoupc?ip=$newip" 2>/tmp/wgeterr)
    this shoud be working with almost every Sveasoft firmware version.

    Or you could upload a file with the new IP to your PC via ftpput (to be able to use ftpput you'll first have to download the busybox build of batbox http://www.batbox.org/wrt54g-linux.html to your router and symlink ftpput)

    Instead of running the script shown above continously in the background you could also try to run a cronjob on your Linux PC that is extracting the IP from the page at regular intervals. Or to make this easier you can create an asp page showing only the current IP and serve this page via a second httpd instance. To get the current IP address in a asp page you'll just have to add
    <% nvram_status_get("wan_ipaddr"); %>

    So there are quite a few possibilities to notify your PC of an IP change. Of couse I don't know, if any of these possibilities is suitable for this ez-ipupdate thing.

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice