Configure bind (named server) to listen on localhost on Debian
By default on a Debian distro, named daemon listens on all available interfaces. In order to change it to listen on a specific IP address or localhost, edit the
named.conf.optionsCode:
# vim /etc/bind/named.conf.options
options {
directory "/var/cache/bind";
// If there is a firewall between you and nameservers you want
// to talk to, you may need to fix the firewall to allow multiple
// ports to talk. See http://www.kb.cert.org/vuls/id/800113
// forwarders {
// 0.0.0.0;
// };
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
listen-on { 127.0.0.1; };
};
The following line instructs bind to listen on localhost:
Code:
listen-on { 127.0.0.1; };
It needs to be added inside the
options directive.
Restart bind and use lsof to check the IP it listens on:
Code:
# lsof -Pni :53
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
named 21998 bind 20u IPv4 107435 0t0 TCP 127.0.0.1:53 (LISTEN)
named 21998 bind 512u IPv4 107434 0t0 UDP 127.0.0.1:53