Solved Bind can't read custom configuration file

Hi everyone
I have install dns/bind99 recently , I using following steps to setup ,but the bind can't listen IP address in addition to 127.0.0.1.
Step1. (Install bind99 and create rndc.key)
cd /usr/ports/dns/bind99
make install clean
rehash
rndc-confgen -a -c /usr/local/etc/rndc.key
cd /usr/local/etc/
chown bind:wheel rndc.key
cd /usr/local/etc/namedb/
ln -sf /usr/local/etc/rndc.key

Step2.(Creating own bind99 working directory ,not system default)
mkdir /etc/bind/
chown bind:wheel /etc/bind

Step3.(Editing /etc/rc.conf)
Code:
named_enable="YES"
named_program="/usr/local/sbin/named"
named_flags="-c /etc/bind/named.conf"
named_chrootdir=""

Starting bind9:
/usr/local/sbin/named -c /etc/bind/named.conf -u bind

Checking listening port:
sockstat -4l | grep 53
Code:
bind     named      2395  20 tcp4   127.0.0.1:53          *:*
bind     named      2395  21 tcp4   127.0.0.1:953         *:*
bind     named      2395  512 udp4  127.0.0.1:53          *:*
bind     named      2395  513 udp4  127.0.0.1:53          *:*

Below in listen configuration:
Code:
options {
        directory "/etc/bind";
        listen-on       { 127.0.0.1;10.1.2.26;};
};

named-checkconf shows no error.


Why it is only listen on 127.0.0.1 , if I adding my IP address in /usr/local/etc/namedb/named.conf with listen-on ,it will be work.
sockstat -4l | grep 53
Code:
bind     named      2527  20 tcp4   10.1.2.26:53          *:*
bind     named      2527  21 tcp4   127.0.0.1:53          *:*
bind     named      2527  22 tcp4   127.0.0.1:953         *:*
bind     named      2527  512 udp4  10.1.2.26:53          *:*
bind     named      2527  513 udp4  10.1.2.26:53          *:*
bind     named      2527  514 udp4  127.0.0.1:53          *:*
bind     named      2527  515 udp4  127.0.0.1:53          *:*
 
Last edited by a moderator:
It's not loading the correct configuration file. Have a look at /usr/local/etc/rc.d/named and you'll notice a named_conf you need to set, not the named_flags you have now.
 
It's not loading the correct configuration file. Have a look at /usr/local/etc/rc.d/named and you'll notice a named_conf you need to set, not the named_flags you have now.
Thanks , I decide to using default setting , it is working good.
 
Back
Top