Date: Wed, 11 Jun 1997 01:43:50 +0100 From: Brian Somers <brian@awfulhak.org> To: mnewton <mnewton@newland.com> Cc: hackers <hackers@FreeBSD.ORG> Subject: Re: any one tried this Message-ID: <199706110043.BAA18839@awfulhak.demon.co.uk> In-Reply-To: Your message of "Tue, 10 Jun 1997 10:31:03 EDT." <339D6527.7411@newland.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> I have one host that has a dynamic ip address assigned each time its > logs in. I would like to refer to that host by a domain name i.e > xyz.zzz via a dns on another machine. > What i need to do is update the dns on the dns server with the > new ip address every time that pc logs in. > Any body got any code to do this ? It should be trivial. You can pass the pseudo MYADDR variable to a script in linkup: MYADDR: delete all add 0 0 hisaddr ! /usr/local/bin/dnsupdate myhost MYADDR And in /usr/local/bin/dnsupdate: #! /bin/sh host=$1 shift read a b c d <<eof `IFS=.; for f; do echo $f; done` eof cd /etc/namedb/ bak=`date +%y%m%d%H%M` mv mynet.zone mynet.zone.$bak sed "s/^$host[ ].*/$host IN A $a.$b.$c.$d/" mynet.zone.$bak >mynet.zone mv mynet.rev mynet.rev.$bak sed "s/.*[ ]$host$/$d.$c.$b.$a. IN PTR $host/" mynet.rev.$bak >mynet.rev You'll need a small awk/perl script to up your serial number and HUP named too. -- Brian <brian@awfulhak.org>, <brian@freebsd.org> <http://www.awfulhak.org> Don't _EVER_ lose your sense of humour....
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199706110043.BAA18839>