root@ns1:~# cat /etc/bind/named.conf.local
//
// Do any local configuration here
//
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
zone "exemplo.org" {
type master;
file "db.exemplo";
};
zone "2.0.192.in-addr.arpa" {
type master;
file "db.2.0.192";
};
root@ns1:~# named-checkconf
root@ns1:~# named-checkconf -p
options {
directory "/var/cache/bind";
listen-on-v6 {
"any";
};
auth-nxdomain no;
dnssec-validation auto;
};
zone "exemplo.org" {
type master;
file "db.exemplo";
};
zone "2.0.192.in-addr.arpa" {
type master;
file "db.2.0.192";
};
zone "." {
type hint;
file "/etc/bind/db.root";
};
zone "localhost" {
type master;
file "/etc/bind/db.local";
};
zone "127.in-addr.arpa" {
type master;
file "/etc/bind/db.127";
};
zone "0.in-addr.arpa" {
type master;
file "/etc/bind/db.0";
};
zone "255.in-addr.arpa" {
type master;
file "/etc/bind/db.255";
};
root@ns1:~# cat /var/cache/bind/db.exemplo
$TTL 86400
@ IN SOA ns1.exemplo.org. root.exemplo.org. (
2016060101; serial
8h ; refresh
1h ; retry
3d ; expire
3h ) ; negative caching ttl
;
@ IN A 192.0.2.100
@ IN NS ns1.exemplo.org.
@ IN MX 10 mail.exemplo.org.
;
ns1 IN A 192.0.2.200
intranet IN A 192.0.2.100
webmail IN CNAME intranet
ftp IN CNAME intranet
mail IN A 192.0.2.240
smtp IN CNAME mail
pop IN CNAME mail
imap IN CNAME mail
root@ns1:~# cat /var/cache/bind/db.2.0.192
$TTL 86400
@ IN SOA ns1.exemplo.org. root.exemplo.org. (
2016060101; serial
8h ; refresh
1h ; retry
3d ; expire
3h ); negative caching ttl
;
@ IN NS ns1.exemplo.org.
;
200 IN PTR ns1.exemplo.org
240 IN PTR mail.exemplo.org
root@ns1:~# named-checkzone 2.0.192.in-addr.arpa /var/cache/bind/db.2.0.192
zone 2.0.192.in-addr.arpa/IN: loaded serial 2016060101
OK
root@ns1:~# named-checkzone exemplo.org /var/cache/bind/db.exemplo
zone exemplo.org/IN: loaded serial 2016060101
OK
root@ns1:~# echo "nameserver 127.0.0.1" > /etc/resolv.conf
root@ns1:~# chattr +i /etc/resolv.conf
root@ns1:~# service bind9 restart
[ ok ] Stopping domain name service...: bind9.
[ ok ] Starting domain name service...: bind9.
root@ns1:~# dig -t SOA exemplo.org
; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> -t SOA exemplo.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56312
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;exemplo.org. IN SOA
;; ANSWER SECTION:
exemplo.org. 86400 IN SOA ns1.exemplo.org. root.exemplo.org. 2016060101 28800 3600 259200 10800
;; AUTHORITY SECTION:
exemplo.org. 86400 IN NS ns1.exemplo.org.
;; ADDITIONAL SECTION:
ns1.exemplo.org. 86400 IN A 192.0.2.200
;; Query time: 30 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Thu Jul 7 15:10:06 2016
;; MSG SIZE rcvd: 104
root@ns1:~# host exemplo.org
exemplo.org has address 192.0.2.100
exemplo.org mail is handled by 10 mail.exemplo.org.
root@ns1:~# host intranet.exemplo.org
intranet.exemplo.org has address 192.0.2.100
root@ns1:~# host 192.0.2.200
200.2.0.192.in-addr.arpa domain name pointer ns1.exemplo.org.2.0.192.in-addr.arpa.