Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 02 Apr 2002 18:59:29 +0200
From:      Paul Everlund <tdv94ped@cs.umu.se>
To:        Kathy Quinlan <katinka@magestower.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: ddclient and Dynamic DNS servers
Message-ID:  <3CA9E371.8ACA287F@cs.umu.se>
References:  <EGEAIMMIBHIBOPAMFLLBAEDOCHAA.katinka@magestower.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Kathy Quinlan wrote:
>
> I am trying to get ddclient to work.
> 
> the client works when run from the command line.
> 
> I use PPPoE for my ADSL link. What I would like to do is to get the client
> to run when PPPoE gets a link up (as my IP would have changed). It has a
> sample up.ip file, it is called I assume from ppp.linkup after it
> establishes a link ?
> 
> Any Ideas ?? as I am at a loss, MAN PPPoE is not to helpful :o(

Might not be exactly what you want but I'll give an explanation of how
I've setup my own ddup. Maybe you can use the info, maybe not.

The directory /usr/local/etc/rc.d contains startup/stop-scripts for your
local services.

I wrote the following text file (see below), which I did name ddup.sh,
and put it in that directory. As it's not very advanced you should be
able to change it to meet your own needs. :-)

/usr/local/etc/rc.d/ddup.sh
---
#!/bin/sh

case "$1" in
  start)
    echo -n ' ddup'
    /usr/local/sbin/ddup --host your.domain.net --wildcard > /dev/null
    ;;
  stop)
    ;;
     *)
    echo ""
    echo "Usage: `basename $0` { start | stop }"
    echo ""
    exit 64
    ;;
esac
---

This script, as the others in the directory, is called after my PPPoE
connection has been established after a startup, and my dynamic dns
is updated. I haven't done anything exceptional in my ppp.conf for
this to happen. My ppp.conf just establish the connection in the
easiest possible way.

My dynamic dns is quite static after my connection it is established,
so I don't check for updates of tun0. But if yours not, and you have
to update your dyn dns from time to time, there's a script called
ddupcron.sh in the directory /usr/local/sbin.

The ddupcron.sh creates a file containing your IP, and then compares
this to the tun0 at given intervals. The intervals for this check is
entered in the crontab.

If I make a crontab -e (as root) I get the following:
0,10,20,30,40,50 * * * * /usr/local/sbin/ddupcron.sh \
                         your.domain.net tun0 > /dev/null

This says it checks the file created by ddupcron.sh every tenth minute,
and updates it if necessary. I've myself commented it out as I made some-
thing wrong that got me banned a week from my dyn dns service, so be
careful. :-)

My ddupcron.sh looks like this, as I made some changes, so it doesn't send
an email every time it don't do an update, and I did also add the wildcard.
This file you don't have to copy from this mail, as you should have it, but
I've included it here as an example:

/usr/local/sbin/dupcron.sh
---
#!/bin/sh

# Define the host to be updated as 1st arguement to script
if [ -z $1 ]; then
        echo "Usage: ddupcron.sh hostname [interface]"
        exit
else
        HOST=$1
fi
# Define interface to grep address from
if [ -z $2 ]; then
        IFACE=fxp0
else
        IFACE=$2
fi
IFCHECK=$(/sbin/ifconfig $IFACE|grep ask|awk '{print $2}'|cut -d ':' -f2)
# Define where we should store last IP
IPFILE="/var/tmp/ddupip"
IPCHECK=$(cat $IPFILE)
# Define path to ddup and ddup arguments (except --host)
DDUP_PATH="/usr/local/sbin/ddup"
#DDUP_ARGS="--debug"
DDUP_ARGS="--wildcard"

if [ "$IFCHECK" != "$IPCHECK" ]; then     <--- changed from == to !=
#       echo "looks like we are still the same ip"
#else
        $DDUP_PATH --host $HOST $DDUP_ARGS
        echo "$IFCHECK" > $IPFILE
fi
---

I hope this helped you in some way.

> Regards,
> 
> Kat.

Best regards,
Paul

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3CA9E371.8ACA287F>