[edit]
How to Setup an internal DNS Server with Bind
[edit]
Install Bind9
# apt-get install bind9
[edit]
Setup named.conf
# mv /etc/bind/named.conf.local /etc/bind/named.conf
# vim /etc/bind/named.conf
zone "somedomain.com" {
type master;
file "/etc/bind/somedomain.com.db";
};
zone "2.168.192.in-addr.arpa" {
type master;
file "/etc/bind/rev.2.168.192.in-addr.arpa";
};
[edit]
Setup named.conf.options
Replace XXX.XXX.XXX.XXX with your External DNS.
# vim /etc/bind/named.conf.options
forwarders {
XXX.XXX.XXX.XXX;
};
[edit]
Setup somedomain.com.db zone file
# touch /etc/bind/somedomain.com.db
# vim /etc/bind/somedomain.com.db
@ IN SOA ns1.somedomain.com. admin.somedomain.com. (
2006081401;
28800;
3600;
604800;
38400;
)
IN NS ns1.somedomain.com.
IN A 192.168.2.151
www IN A 192.168.2.151
ns1 CNAME www
[edit]
Setup reverse zone file
Same here 2.168.192 with your local subnet. 151 below refers to your DNS server IP (192.168.2 151 for example)
# touch /etc/bind/rev.2.168.192.in-addr.arpa
# vim /etc/bind/rev.2.168.192.in-addr.arpa
@ IN SOA ns1.somedomain.com. admin.somedomain.com. (
2006081401;
28800;
604800;
604800;
86400;
)
IN NS ns1.somedomain.com.
151 IN PTR somedomain.com
[edit]
Make DNS server reference itself
# vim /etc/resolve.conf
nameserver 127.0.0.1
[edit]
Restart bind9 daemon
# /etc/init.d/bind9 restart
[edit]
Now we Test
# dig somedomain.com
# nslookup somedomain.com