|
jvdias |
2093a5 |
PGSQL BIND SDB driver
|
|
jvdias |
2093a5 |
|
|
jvdias |
2093a5 |
The postgresql BIND SDB driver is of experimental status and should not be
|
|
jvdias |
2093a5 |
used for production systems.
|
|
jvdias |
2093a5 |
|
|
jvdias |
2093a5 |
Usage:
|
|
jvdias |
2093a5 |
|
|
jvdias |
2093a5 |
o Use the named_sdb process ( put ENABLE_SDB=yes in /etc/sysconfig/named )
|
|
jvdias |
2093a5 |
|
|
jvdias |
2093a5 |
o Edit your named.conf to contain a database zone, eg. :
|
|
jvdias |
2093a5 |
|
|
jvdias |
2093a5 |
zone "pgdb.net." IN {
|
|
jvdias |
2093a5 |
type master;
|
|
jvdias |
2093a5 |
database "pgsql bind pgdb localhost pguser pgpasswd";
|
|
jvdias |
2093a5 |
# ^- DB name ^-Table ^-host ^-user ^-password
|
|
jvdias |
2093a5 |
};
|
|
jvdias |
2093a5 |
|
|
jvdias |
2093a5 |
o Create the database zone table
|
|
jvdias |
2093a5 |
The table must contain the columns "name", "rdtype", and "rdata", and
|
|
jvdias |
2093a5 |
is expected to contain a properly constructed zone. The program "zonetodb"
|
|
jvdias |
2093a5 |
creates such a table.
|
|
jvdias |
2093a5 |
|
|
jvdias |
2093a5 |
zonetodb usage:
|
|
jvdias |
2093a5 |
|
|
jvdias |
2093a5 |
zonetodb origin file dbname dbtable
|
|
jvdias |
2093a5 |
|
|
jvdias |
2093a5 |
where
|
|
jvdias |
2093a5 |
origin : zone origin, eg "pgdb.net."
|
|
jvdias |
2093a5 |
file : master zone database file, eg. pgdb.net.db
|
|
jvdias |
2093a5 |
dbname : name of postgresql database
|
|
jvdias |
2093a5 |
dbtable: name of table in database
|
|
jvdias |
2093a5 |
|
|
jvdias |
2093a5 |
Eg. to import this zone in the file 'pgdb.net.db' into the 'bind' database
|
|
jvdias |
2093a5 |
'pgdb' table:
|
|
jvdias |
2093a5 |
|
|
jvdias |
2093a5 |
---
|
|
jvdias |
2093a5 |
#pgdb.net.db:
|
|
jvdias |
2093a5 |
$TTL 1H
|
|
jvdias |
2093a5 |
@ SOA localhost. root.localhost. ( 1
|
|
jvdias |
2093a5 |
3H
|
|
jvdias |
2093a5 |
1H
|
|
jvdias |
2093a5 |
1W
|
|
jvdias |
2093a5 |
1H )
|
|
jvdias |
2093a5 |
NS localhost.
|
|
jvdias |
2093a5 |
host1 A 192.168.2.1
|
|
jvdias |
2093a5 |
host2 A 192.168.2.2
|
|
jvdias |
2093a5 |
host3 A 192.168.2.3
|
|
jvdias |
2093a5 |
host4 A 192.168.2.4
|
|
jvdias |
2093a5 |
host5 A 192.168.2.5
|
|
jvdias |
2093a5 |
host6 A 192.168.2.6
|
|
jvdias |
2093a5 |
host7 A 192.168.2.7
|
|
jvdias |
2093a5 |
---
|
|
jvdias |
2093a5 |
|
|
jvdias |
2093a5 |
Issue this command as the pgsql user authorized to update the bind database:
|
|
jvdias |
2093a5 |
|
|
jvdias |
2093a5 |
# zonetodb pgdb.net. pgdb.net.db bind pgdb
|
|
jvdias |
2093a5 |
|
|
jvdias |
2093a5 |
will create / update the pgdb table in the 'bind' db:
|
|
jvdias |
2093a5 |
|
|
jvdias |
2093a5 |
$ psql -dbind -c 'select * from pgdb;'
|
|
jvdias |
2093a5 |
name | ttl | rdtype | rdata
|
|
jvdias |
2093a5 |
----------------+------+--------+-----------------------------------------------------
|
|
jvdias |
2093a5 |
pgdb.net | 3600 | SOA | localhost. root.localhost. 1 10800 3600 604800 3600
|
|
jvdias |
2093a5 |
pgdb.net | 3600 | NS | localhost.
|
|
jvdias |
2093a5 |
host1.pgdb.net | 3600 | A | 192.168.2.1
|
|
jvdias |
2093a5 |
host2.pgdb.net | 3600 | A | 192.168.2.2
|
|
jvdias |
2093a5 |
host3.pgdb.net | 3600 | A | 192.168.2.3
|
|
jvdias |
2093a5 |
host4.pgdb.net | 3600 | A | 192.168.2.4
|
|
jvdias |
2093a5 |
host5.pgdb.net | 3600 | A | 192.168.2.5
|
|
jvdias |
2093a5 |
host6.pgdb.net | 3600 | A | 192.168.2.6
|
|
jvdias |
2093a5 |
host7.pgdb.net | 3600 | A | 192.168.2.7
|
|
jvdias |
2093a5 |
(9 rows)
|
|
jvdias |
2093a5 |
|
|
jvdias |
2093a5 |
I've tested exactly the above configuration with bind-sdb-9.3.1+ and it works OK.
|
|
jvdias |
2093a5 |
|
|
jvdias |
2093a5 |
NOTE: If you use pgsqldb SDB, ensure the postgresql service is started before the named
|
|
jvdias |
2093a5 |
service .
|
|
jvdias |
2093a5 |
|
|
jvdias |
2093a5 |
USE AT YOUR OWN RISK!
|