Link to home
Start Free TrialLog in
Avatar of richardsimnett
richardsimnett

asked on

Cant get BIND + MYSQL DLZ to work

Hello,
I recently built BIND9 with the DLZ driver, and then installed the packages. No problem.

So after configuring the mysql database in hte named.conf.local, created a dns_records table. I tried to start bind. It failed.

Jul 17 00:29:21 mpd1 named[20793]: starting BIND 9.4.2-P2 -u bind
Jul 17 00:29:21 mpd1 named[20793]: found 4 CPUs, using 4 worker threads
Jul 17 00:29:21 mpd1 named[20793]: loading configuration from '/etc/bind/named.conf'
Jul 17 00:29:21 mpd1 named[20793]: listening on IPv6 interfaces, port 53
Jul 17 00:29:21 mpd1 named[20793]: listening on IPv4 interface lo, 127.0.0.1#53
Jul 17 00:29:21 mpd1 named[20793]: listening on IPv4 interface eth1, 192.168.1.103#53
Jul 17 00:29:21 mpd1 named[20793]: Loading 'Mysql zone' using driver mysql
Jul 17 00:29:21 mpd1 named[20793]: mysql driver failed to create database connection after 4 attempts
Jul 17 00:29:21 mpd1 named[20793]: SDLZ driver failed to load.
Jul 17 00:29:21 mpd1 named[20793]: DLZ driver failed to load.
Jul 17 00:29:21 mpd1 named[20793]: loading configuration: failure
Jul 17 00:29:21 mpd1 named[20793]: exiting (due to fatal error)

I have verified I can connect to mysql via the command line using the information I gave to the mysql zone in the named.conf.local. I've checked for typos, and nada.

Heres the config:

//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

dlz "Mysql zone" {
   database "mysql
   {host=127.0.0.1 dbname=webcontrol user=dns pass=dns}
   {select zone from dns_records where zone = '%zone%'}
   {select ttl, type, mx_priority, case when lower(type)='txt' then con$ (cut off from nano) ";
};

A working solution is worth 500 points.

Thanks,
Rick

ASKER CERTIFIED SOLUTION
Avatar of tesmi
tesmi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of richardsimnett
richardsimnett

ASKER

tesmi,
ok that wasnt my problem, but it did uncover the issue (I didnt enable the user to ahve localhost access) :). Anyways, I had one more question, this is bind related. I dont know much about bind, Im just charged with writing an interface so that dns can be modified easily via the db. Here's my issue. I stuck a couple of dns records in for a random domain. I turned off the dns forwarding.

Then did nslookup <cr>

server 127.0.0.1

then mytestdomain.com

I get nxdomain as a result, even though I defined mytestdomain.com in the dns_records table. Any suggestions?

Thanks,
Rick
You need to provide some logfiles from Bind and the contents of the database table, With the description you gave, I cannot say anything specific about why it is not working.
ok... well it seems bind isnt logging any useful information in the syslog, granted Im not sure what your looking for either

Jul 22 12:43:17 mpd1 named[22588]: starting BIND 9.4.2-P2 -u bind
Jul 22 12:43:17 mpd1 named[22588]: found 4 CPUs, using 4 worker threads
Jul 22 12:43:17 mpd1 named[22588]: loading configuration from '/etc/bind/named.conf'
Jul 22 12:43:17 mpd1 named[22588]: listening on IPv6 interfaces, port 53
Jul 22 12:43:17 mpd1 kernel: [42746.040846] audit(1248280997.914:4549): type=1503 operation="capable" name="sys_resource" pid=22591 profile="/usr/sbin/named" namespace="default"
Jul 22 12:43:17 mpd1 named[22588]: listening on IPv4 interface lo, 127.0.0.1#53
Jul 22 12:43:17 mpd1 named[22588]: listening on IPv4 interface eth1, 192.168.1.103#53
Jul 22 12:43:17 mpd1 named[22588]: automatic empty zone: 254.169.IN-ADDR.ARPA
Jul 22 12:43:17 mpd1 named[22588]: automatic empty zone: 2.0.192.IN-ADDR.ARPA
Jul 22 12:43:17 mpd1 named[22588]: automatic empty zone: 255.255.255.255.IN-ADDR.ARPA
Jul 22 12:43:17 mpd1 named[22588]: automatic empty zone: 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA
Jul 22 12:43:17 mpd1 named[22588]: automatic empty zone: 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA
Jul 22 12:43:17 mpd1 named[22588]: automatic empty zone: D.F.IP6.ARPA
Jul 22 12:43:17 mpd1 named[22588]: automatic empty zone: 8.E.F.IP6.ARPA
Jul 22 12:43:17 mpd1 named[22588]: automatic empty zone: 9.E.F.IP6.ARPA
Jul 22 12:43:17 mpd1 named[22588]: automatic empty zone: A.E.F.IP6.ARPA
Jul 22 12:43:17 mpd1 named[22588]: automatic empty zone: B.E.F.IP6.ARPA
Jul 22 12:43:17 mpd1 named[22588]: command channel listening on 127.0.0.1#953
Jul 22 12:43:17 mpd1 named[22588]: command channel listening on ::1#953
Jul 22 12:43:17 mpd1 named[22588]: zone 0.in-addr.arpa/IN: loaded serial 1
Jul 22 12:43:17 mpd1 named[22588]: zone 127.in-addr.arpa/IN: loaded serial 1
Jul 22 12:43:17 mpd1 named[22588]: zone 255.in-addr.arpa/IN: loaded serial 1
Jul 22 12:43:17 mpd1 named[22588]: zone localhost/IN: loaded serial 2
Jul 22 12:43:17 mpd1 named[22588]: running

and the contents of the dns_records table is:

mysql> select * from dns_records;
+----+-------------------+------+-------+-----------------+------+-------------+---------+-------+--------+---------+------------+----------------------------+----------------------------+------------+
| id | zone              | host | type  | data            | ttl  | mx_priority | refresh | retry | expire | minimum | serial     | resp_person                | primary_ns                 | data_count |
+----+-------------------+------+-------+-----------------+------+-------------+---------+-------+--------+---------+------------+----------------------------+----------------------------+------------+
|  1 | rickandsammij.com | www  | A     | 1.2.3.4         | 3600 |        NULL |    3600 |  3600 |  86400 |    3600 | 2009080100 | dns.mediainteractiveco.com | ns1.mediainteractiveco.com |          0 |
|  2 | rickandsammij.com | @    | A     | 1.2.3.4         | 3600 |        NULL |    3600 |  3600 |  86400 |    3600 | 2009080100 | dns.mediainteractiveco.com | ns1.mediainteractiveco.com |          0 |
|  3 | rickandsammij.com | www2 | CNAME | www.domain.com. | 3600 |        NULL |    3600 |  3600 |  86400 |    3600 | 2009080100 | dns.mediainteractiveco.com | ns1.mediainteractiveco.com |          0 |
|  4 | rickandsammij.com | @    | MX    | domain.com.     | 3600 |           0 |    3600 |  3600 |  86400 |    3600 | 2009080100 | dns.mediainteractiveco.com | ns1.mediainteractiveco.com |          0 |
+----+-------------------+------+-------+-----------------+------+-------------+---------+-------+--------+---------+------------+----------------------------+----------------------------+------------+
4 rows in set (0.00 sec)


Thanks.