On Sat, Oct 23, 2010 at 9:23 PM, Ed D. <[email protected]> wrote:
> Hi Eveybody,
> I have an AMD64 based OpenBSD 4.6 system in another town that's
> on a DSL account with a dynamically allocated IP address.
>
> The DSL provider uses standard DHCP to allocate the address, and
> I just use a dumb modem,
> so the DHCP session is done by my OpenBSD box.
>
> Back home at my base location I have a static IP and an
> OpenBSD based network with web and mail server.
>
> QUESTION: is there a way for my remote OpenBSD box
> in the other town, to send me it's new IP address when it updates
> it's IP address during a DHCP session?
>
> Or any other way that i can know when it's IP address changes and
> what the new one is?
You should register a dyndns account! There's lots of providers that
will give you this, with simple interfaces. I use zoneedit and I just
use this script run from cron to update my address:
$ cat bin/zoneclient.sh
#!/bin/sh
#dynamically update our zoneedit nameservers
#this script is meant to be able to run any number of times in a row:
#it will only actually talk to zoneedit if our IP changes
#(well, it talks to zoneedit to find out our IP)
USER=NNg6
PASS="xxxxxx"
#make this a comma-delimited list of domains to update
ZONES="kousu.ca zilliah.ca pulsebitten.ca"
update_zone(){
zone=$1;
echo $zone;
echo `lynx -source -auth=$USER:$PASS
"http://dynamic.zoneedit.com/auth/dynamic.html?host=$zone"`;
logger -p daemon.info -t zoneedit "Updating $zone";
}
update(){
echo "Updating zones";
for zone in $ZONES; do
#it would be nice if we could use SSL here, but lynx is a
retard and has no way of, in -source mode, letting you tell it to
accept certificates
RESP=`update_zone $zone`
logger -p daemon.info -t zoneedit "IP update-attempt for $zone: $RESP";
done;
}
update;
<<<<<<<<<<<<<<<<
Alternately, secretly mail(1) is awesome! You could just do something like this:
IP=`ifconfig | grep "inet " | cut -f 2 -d " " | grep -v "127"`' #this
extracts, flakily, our external address from ifconfig
OLD=`cat current_ip.txt`
#
#alternately, if you're behind a router, this is a bit more flakey but will work
#ftp -o ip.txt http://www.showmyip.com/simple/
#IP=`cat ip.txt`; rm ip.txt
if [ x"$OLD" != x"$IP" ]; then
echo $IP > current_ip.txt;
mail -s "New IP: $IP" [email protected]
fi
and put that script in cron.
Hope that helps!
-Nick
_______________________________________________
Openbsd-newbies mailing list
[email protected]
http://mailman.theapt.org/listinfo/openbsd-newbies