To my maind, BIND is better. It is easy to configure, you don't need to restart BIND except when you upgrade the software. What you should look into for BIND is the rndc command. Rndc allows you to reload an individual zone, while leaving BIND running. If you've edited the zonefile, rndc will publish the changes immediately.
It absolutely is possible for BIND to run off a database. You need to specify some steps in the ./configure step.
I have some good instructions but they are in russian. I'll try to write a little plan of action.
- It is assumed that MySQL-server already installed and configured.
- Download mysql-bind project from off. the site http://mysql-bind.sourceforge.net/ (there, we need two files: mysqldb.c and mysqldb.h).
Jump to the folder with the downloaded file to extract:
cd ~ / downloads /
tar -xzf mysql-bind.tar.gz
Jump to the port and download the source bind9 (your version of mysql-bind is designed for this service). While not compile!
cd /usr/ports/dns/bind9
make fetch extract
Copy the downloaded files mysql-bind to bind's sources:
cp ~/downloads/mysqldb.c /usr/ports/dns/bind9/work/bind-x.x.x/bin/named/
cp ~/downloads/mysqldb.h /usr/ports/dns/bind9/work/bind-x.x.x/bin/named/include/named/
Jump to the folder with the source (work / bind-xxx) and make the following changes:
a) The file bin/named/Makefile.in read:
DBDRIVER_OBJS = mysqldb.@O@
DBDRIVER_SRCS = mysqldb.c
Run the command mysql_config -cflags and write the output to a variable DBDRIVER_INCLUDES (example: DBDRIVER_INCLUDES = -I/usr/local/include/mysql -fno-strict-aliasing -pipe)
Run the command mysql_config -libs and write the output to a variable DBDRIVER_LIBS
(example: DBDRIVER_LIBS = -L/usr/local/lib/mysql-lmysqlclient-lz-lcrypt-lm)
b) In the file bin/named/main.c:
- Adding a header file #include
<named/mysqldb.h>
- Inside the function
setup(), add a call mysqldb_init() before the line ns_server_create().
- Inside the function
cleanup(), add mysqldb_clear(); after ns_server_destroy().
Install Bind:
cd /usr/ports/dns/bind
make
make install
Create for each zone, its table mysql:
CREATE TABLE table_name (
name varchar(255) default NULL,
ttl int(11) default NULL,
rdtype varchar(255) default NULL,
rdata varchar(255) default NULL
) TYPE=MyISAM;
Create the necessary records for the zone:
INSERT INTO table_name VALUES ('mydomain.com', 259200, 'SOA', 'mydomain.com. webmaster.mydomain.com. 2008092901 28800 7200 86400 28800');
INSERT INTO table_name VALUES ('mydomain.com', 259200, 'NS', 'ns0.mydomain.com.');
INSERT INTO table_name VALUES ('mydomain.com', 259200, 'NS', 'ns1.mydomain.com.');
INSERT INTO table_name VALUES ('mydomain.com', 259200, 'MX', '10 mail.mydomain.com.');
INSERT INTO table_name VALUES ('w0.mydomain.com', 259200, 'A', '192.168.1.1');
INSERT INTO table_name VALUES ('w1.mydomain.com', 259200, 'A', '192.168.1.2');
In the named.conf file prescribe the correct zone:
zone "smol.website.ru" {
type master;
notify no;
database "mysqldb database_name table_name mysql_ip_address login password";
};
- Pay special attention, in the last line should specify the username and password. Information is stored in an unencrypted form, which of course is dangerous! So there are two ways: as something tricky to keep the code in the encoded code or in the database to create a user login-"bind" and pass-"bind" and put it privilege select.
- I apologize for my English. Hope this helps.
- the instruction is written for freebsd, for Linux should be similar