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