dynamic update to SOA records

Phil Mayers p.mayers at imperial.ac.uk
Tue May 1 10:53:38 UTC 2012


On 01/05/12 11:20, cloud cache wrote:
>
> But, how will I know the current serial number of the zone, if the zone
> has been changing frequently?

In the past, I've used a script that queries the SOA just before doing 
the update (which is safe, because in a race condition you'll be "too 
low" and fail)

e.g.

#!/bin/sh

ZONE="example.com"
SERVER="192.0.2.1"
TTL=3600
SOA_SERIAL=`dig @$SERVER +short $ZONE SOA | awk '{ print $3 }'

BUF=`mktemp`
trap "rm -f $BUF" EXIT

cat <<EOF >$BUF
server $SERVER
zone $ZONE
update add $ZONE $TTL SOA your.values. go.here. $(( SOA_SERIAL+1 )) ...
show
send
answer
EOF



More information about the bind-users mailing list