Mysql – Dns server which is better bind or thedns

binddomain-name-systemMySQL

I am going to start a new website which is going to require DNS servers. It might have over 10,000 zones and will get more zone files as we get bigger. The problem is, which dns server software do you think is more efficent: mydns which uses mysql to store the data or bind which uses flat files? How do these DNS servers handle load balancing so we can balance the load between several servers so any one doesn't overload?

Best Answer

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.

  1. It is assumed that MySQL-server already installed and configured.
  2. Download mysql-bind project from off. the site http://mysql-bind.sourceforge.net/ (there, we need two files: mysqldb.c and mysqldb.h).
  3. Jump to the folder with the downloaded file to extract:

    cd ~ / downloads / tar -xzf mysql-bind.tar.gz

  4. 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

  5. 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/

  6. 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().
  7. Install Bind:

    cd /usr/ports/dns/bind make make install

  8. 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;

  9. 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');

  10. 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"; };

  11. 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.
  12. I apologize for my English. Hope this helps.
  13. the instruction is written for freebsd, for Linux should be similar
Related Topic