[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dirty simple how-to - dynamic dns with bind 9 on openbsd



just a note to put 'on record' - i got dynamic dns working today.  so far, so good, at any rate.

i followed the instructions somewhat at: 
	
	http://www.shakabuku.org/writing/dyndns.html

then i wanted to make a way to update it every hour or so, or at boot time.
i put it in rc.local and it spawns out of cron.  it'd be better to check if the IP address has changed since the last time - but i didn't bother.  someone wants to make it better?  go right ahead and share the result with me!

so i wrote a little script based on the example given on that page:

	notes:
	------
	fxp0 is my outside facing interface that plugs into a cox-supplied
	toshiba cable modem

	<file>.private is the K.blah.private key file created earlier.

	hostname.i.use is my hostname that resolves to my dynamic IP.
	i setup a zone for that hostname with simply an A record.

---START
#!/bin/sh
TTL=86400
KEYFILE=/dns/<file>.private
MYIP=`ifconfig fxp0 | grep broadcast | awk '{print $2}'`
NSUPDATE=/usr/local/bin/nsupdate

HOSTNAME=hostname.i.use
delete="update delete $HOSTNAME A\n"
update="update add $HOSTNAME $TTL A $MYIP\n\n"
update=${delete}${update}

echo -e $update | $NSUPDATE -k $KEYFILE

echo "updated"
---STOP

............................................................................



Visit your host, monkey.org