scrounge.org

IPWatch User Feedback

Here are some messages received from IPWatch users that deal with various configuration issues.

Dyndns.org fix

Hello.  I have checked ipwatch with dyndns.org and there should be an update
in ipwatch because in this state it isn't working.
You have to replace the block dyndns_org with the textblock down here.
+++++++++++++++++++++++++
	    dyndns_org)
                URL2="-auth=$USER_ID:$PASSWORD \
                http://members.dyndns.org/nic/update?hostname=$DYNHOSTNAME&myip=$IPADDR&wildcard=OFF&backmx=NO"
		dynupdate
		;;
+++++++++++++++++++++++++++++++
              
I have tried to get dhs.org to work but this one doesn't work either it
doesn't accept my hostname.  I have everything double checked but the script
is not right.

Harry Leever
hleever@casema.net

Top of page. Back to the IPWatch page.


Fix for Slackware users. #1

Hello IPwatch developers,

I am running Slackware Linux 7.0, and got IPwatch to work by making the
following changes:

1) netinit() function: the 'ifup' and 'ifdown' commands do not exist on
this system, and I could not find any functions with these names in the
shell script.  I simply commented out this line and replaced it with an
appropriate pair of dhcpcd command lines.

2) isnetup() function: the original version of the script directed only
stdout from nslookup to /dev/null; I changed this to redirect stderr as
well (would otherwise cause cron to generate a lot of email!)

Thanks for writing this tool, and I'll send other changes I make to get
it to run better.

Neel

Top of page. Back to the IPWatch page.


Fix for Slackware users #2.

Just stumbled across your ipwatch script today, as I was looking for a
solution to my newly acquired DHCP connection (my last cable modem
connection was static, and thus not near as big of a problem).  I was
hoping someone took the time to go through and figure out some of the
nasty details of accomplishing such a feat.  Thank you!  You've been a
big time saver!

Anyway, one thing that did *not* work for me was your isnetup()
function.  For some reason, it always returned a "0", which obviously
caused problems.  Below is what I did to solve the problem, and IMHO,
is much easier to use.  There may be a hole in it somewhere, but it
seems to work so far...

-----------------
# Is Network up?  0 if up, non-zero if down
isnetup() {
    local VAR
    VAR=`/sbin/ifconfig | grep $EXTIF > /dev/null; echo $?`
    return $VAR
------------------

Anyway, the script will be extremely helpful to me in my new
environment.  Thanks a million!

Regards,
Jason

Top of page. Back to the IPWatch page.


Dynamic DNS problem with cron + Lynx.

The problem happens when doing a dynamic DNS update when running IPWatch in a cron job. The syptoms include this error message

Your terminal lacks the ability to clear the screen or position the cursor.

This seems to affect Red Hat 6.2 and Slackware users. The fix is....

Hi guys.

I am sorry to bother you with something that is not the fault of ipwatch,
and obviously had to do with the environment.

In any case, I did some digging and found some similar problems on the
lynx-dev list
(http://www.flora.org/lynx-dev/html/month042000/msg00441.html).

What I did to resolve this was to add a TERM line to the crontab
(TERM=vt100). I believe that fix solved it, because it is updating the
host now. I had also thought that the '&' in the URL variables was
backgrounding the job, as it did so when I ran the lynx command from the
shell.

So aside from asking your users to recompile lynx or something else, you
can suggest the TERM environment for the cron job.

Hope this helps you and others.
Jay

-------------------------------------------
   Jason Brown            jason@nunatak.com
nunatak informatics  http://www.nunatak.com
  Ottawa, Ontario     phone: 613-282-6860
    web applications & Linux consulting
-------------------------------------------

You can also set the TERM variable in ipwatch.sh by making the following modification:

# Set some environment variables
export PATH="/sbin:/bin:/usr/bin"
export BOOTUP="nocolor"
export TERM="vt100"
Add the line in red. IPWatch v. 1.1a (and newer) contain this.

-Wayne

Top of page. Back to the IPWatch page.


Improved Dynamic DNS error handling.

Hey Wayne,

I did a change to the script myself which is useful as I think.

Problem now:
Even if ipwatch.sh wasn't successful on updating DNS Info(by not reaching host,
like dynip or yi.org) , /tmp/currentIP is created anyway. So a cronjob comes
again. compares ifconfig with currentIP and wont try to do the update.

My Change:
Only if DNSupdate as successful, /tmp/currentIP is written. The the Script will
try to contact the DNS provider again by executing the script again.

I just moved the lines:
332  firewallinit
333  hostnameset
334  echo $IPADDR > $IPFILE

to:
(Current line 168 is    if [ $DYN_STATUS -eq 0 ]; then)
169  firewallinit
170  hostnameset
171  echo $IPADDR > $IPFILE

This is a hack but works for me...
So if this is of any help to you...

and thanks again Wayne

cheers.

Roman Gerteis [roman.gerteis@gmx.de]

We know that there is a problem because IPWatch's test for a successful dynamic DNS is too simple. It only tests to see if Lynx was able to complete its access to the site defined in the URL variables. But it doesn't examine any of the output that Lynx returns to see if the DynDNS site actually liked what Lynx sent to it and did the update. In this case, IPWatch registers a (possibly) false success and does no further processing, just like you say.

Because we knew that IPWatch's DynDNS processing wasn't 100% accurate (in terms of detecting success/failure), we chose to not keep repeating failed DynDNs updates, and left that to the user to determine from reading the status email.

Feel free to implement Roman's changes if you are confident that your copy of IPWatch reliably does the Dynamic DNS update. Otherwise, stay with the default behavior and make sure to examine the status email that IPWatch sends to determine if the Dynamic DNS change worked. Dynamic DNS updating is intrinsically problematic, because we are at the mercy of another computer (the DynDNS service) responding consistantly and not changing the way it responds. Be careful.

Also note that the line number references refer to version 1.1 of IPWatch. We just added one line to version 1.1a of IPWatch.

-Wayne

Linksys Router

Wayne Larmon wrote:
> 
> I forgot to follow up on this.  You said that you made your own script
> that works behind your Linksys firewall.  Could you send it to us?

Hi Wayne,

Sure. Here it is. It's written in Perl and only understands the
JustLinux (penguinpowered.com) dynamic DNS.

Several features are different from your environment. First off, the
actual IP address of the local boxes never changes. We're all
192.168.1.* behind the firewall. All we need to do is query the LinkSys
box for the current IP assigned to it by Road Runner, see if it differs
from before, and pass it on to JustLinux. No ifconfig's or anything
here.

The LinkSys box (and the RoadRunner cable modem for that matter) both
serve up web pages. This web page shows the current LinkSys status:

   http://192.168.1.1/Status.htm

I just pick through the HTML and extract the right IP address ("WAN IP
address"). Then a second call to 'lynx' passes the data on.

You could probably avoid the 'lynx' calls with some Perl modules, but I
really hate that approach. Lynx works and it's obvious how it works!

I tried integrating this approach into your shell scripts, but I wound
up with a Perl script to do the pattern matching anyhow. So doing it all
in Perl made more sense at the time.

Feel free to contact me with more questions, or code you'd like me to
test.

Charles Hall

Download the script from here. When you have it downloaded, rename it to ip-update.pl.

You might need to add user and password information to access your router. If so, then try modifying the script like:

#
#      Get current IP address
#
 
  $LINK_LOGIN="admin";    # It needs some user name
  $LINK_PASSWORD="admin"; # Put the password you configured your router
  $LINK_IP="192.168.1.1"; # The IP address of the router

  $_ = `lynx -dump -auth=$LINK_LOGIN:LINK_PASSWORD http://$LINK_IP/Status.htm`;

In between the original IPWatch and Charles's script, you should have enough information to get going with the router.


Cisco Router and dhs.org/y2.org

First of all, I'd like to thank you for the scripts, I would still be
hacking without them.  :)
I tried all of the other scripts and patches that I could find to no
avail, so I think this will be useful.
As I am still somewhat new at this, any feedback would be appreciated.

After several hours of fiddling (i'm still fairly new at this), the
following changes to ipwatch.sh have enabled it to work in my
circumstances.

Hacks listed for use behind a cisco 675 ADSL router, and for use of
dhs.org/y2.org.  These are the only modifications I needed.

This is to enable the script behind a cisco router in routing mode with
full NAT.
1.  I replaced each occurance of "IPADDR=..." with "setnewip" (in both
scripts...)
2.  I defined setnewip as:
    getnewip() {
        expect -nN /root/bin/ip.exp > /tmp/adsldata
        IPADDR=`awk 'BEGIN {RS = "\r"} $3 == "Address" {print $6}'
/tmp/adsldata`
        rm -f /tmp/adsldata
        # add new ip to static hosts file, using template, there's
probably a better way/place for this...
        cat /root/bin/hosts.template|sed -e s/--IP--/$IPADDR/g >
/etc/hosts
    }
3.  ip.exp is an expect script generated by autoexpect and then hacked
to smitherines... this is what it looks like:
    #!/usr/bin/expect -f
    set env(SHELL) /bin/bash
    set env(HOME) ~/
    set timeout 5
    spawn $env(SHELL)
    match_max 20
    set send_human {.1 .4 1 .1 2}
    set send_slow {1 1}
    # use internal address of router on next line
    send -- "telnet ___.___.___.___"
    expect {
        -exact "word:" {
            sleep .1
            send -h -- "routerpassword"
            expect -exact "cbos>"
            send -- "show nat\r"
            expect -exact "cbos>"
            send -- "exit\r"
            break
        } timeout {
            send_tty "\rConnection to router timed out.\n"
            break
        } eof {
            send_tty "\rConnection to host failed.\n"
            break
        }
    }
    send -- "exit\r"
    expect eof

This is to update the dhs server.  The code in the your script was not
working.
4. Added DYNDOMAIN="2y.net"  # vs. "dhs.org" that was hardcoded

5. Modified string used in dhs) case.  This all belongs on one line (no
spaces) and is broken up here for clarity.  Don't forget the tailing
quotation mark, as this string was begun on the previous line.
    http://members.dhs.org/nic/hosts?hostscmd=edit&hostscmdstage=2
        &type=4&updatetype=Online&ip=$IPADDR&mx=&offline_url=
        &cloak_title=&domain=$DYNDOMAIN&hostname=$DYNHOSTNAME"

- the SwaJime  http://swajime.2y.net/


Top of page. Back to the IPWatch page.