Example named.conf and Zone for BIND 9
Put all of them in /opt/mydns
named.conf
###########################################
# BIND 9 name server configuration file
###########################################
controls {
inet 127.0.0.1 allow { localhost; } keys { "rndc-key"; };
};
key "rndc-key" {
algorithm "hmac-md5";
secret "key+obscured+on+a+local+push";
};
options {
pid-file "/opt/mydns/named.pid";
directory "/opt/mydns";
minimal-responses no;
};
acl "trusted" {
127.0.0.1;
192.168.0.0/16; // range 192.160.0.1 - 192.160.255.254
};
statistics-channels {
inet * port 8080 allow { trusted; };
};
zone "example.com" in {
type master;
file "db.example.com";
allow-update { any; };
#masters {192.168.89.56;};
allow-query { any; };
allow-transfer { any; };
notify no;
};
logging {
channel "logfile" {
file "/opt/mydns/named.log" versions 5 size 5m;
severity dynamic;
print-time yes;
print-severity yes;
print-category yes;
};
category "default" { "logfile"; };
category "general" { "logfile"; };
category "update" { "logfile"; };
category "queries" { "logfile"; };
};
rndc.conf
# ==============================================
# rndc.conf file
# ==============================================
options {
default-server 127.0.0.1;
default-key "rndc-key";
};
key "rndc-key" {
algorithm hmac-md5;
secret "key+obscured+on+a+local+push";
};
db.example.com
$ORIGIN .
$TTL 86400 ; 1 day
example.com IN SOA DnsSer.example.com. MailTest.example.com. (
15061 ; serial
21600 ; refresh (6 hours)
3600 ; retry (1 hour)
604800 ; expire (1 week)
600 ; minimum (10 minutes)
)
NS DnsSer.example.com.
NS NS1.example.com.
$ORIGIN example.com.
DnsSer A 127.0.0.1
NS1 A 127.0.0.1
Example for bind 9.10.1-P1
Start BIND 9.10 DNS
cd /opt/mydns/bind910/bind-9.10.1-P1/linux/bind9101p1/sbin
./named -c /opt/mydns/named.conf -g
Dig the zone
cd /opt/mydns/bind910/bind-9.10.1-P1/linux/bind9101p1/bin
./dig example.com @127.0.0.1
By configured the option statistics-channels, we can open the Web browser at http://127.0.0.1:8080 to show BIND's statistics server of zones and AXFR
Loading