Setting up a DNS name server for a mass virtual host with Bind9
- by Dez
I am trying to set up a chrooted DNS name server in a local LAN like this everyone connected in the LAN can have access to the mass virtual hosts defined for a development ambience without having to edit manually their local /etc/hosts one by one. The mass virtual host is named example.user.dev (VirtualDocumentRoot /home/user/example ) and example.test (DocumentRoot /var/www/example).
I set up everything and the /var/log/syslog doesn't show any error, but when checking the DNS with:
host -v example.test
Doesn't find the host. Also using the dig command I don't receive answer.
dig -x example.test
; << DiG 9.5.1-P3 << -x imprimere
;; global options: printcmd
;; Got answer:
;; -HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 47844
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;imprimere.in-addr.arpa. IN PTR
;; AUTHORITY SECTION:
in-addr.arpa. 600 IN SOA a.root-servers.net. dns-ops.arin.net. 2010042604 1800 900 691200 10800
;; Query time: 108 msec
;; SERVER: 80.58.0.33#53(80.58.0.33)
;; WHEN: Mon Apr 26 11:15:53 2010
;; MSG SIZE rcvd: 107
My configuration is the following:
/etc/bind/named.conf.local
zone "example.test" {
type master;
allow-query { any; };
file "/etc/bind/zones/master_example.test";
notify yes;
};
zone "1.168.192.in-addr.arpa" {
type master;
allow-query { any; };
file "/etc/bind/zones/master_1.168.192.in-addr.arpa";
notify yes;
};
/etc/bind/named.conf.options
Note: We have an static IP address so I forward the querys to DNS server to said IP address.
options{
directory "/var/cache/bind";
forwarders { 80.34.100.160; };
auth-nxdomain no;
listen-on-v6 { any; };
};
/etc/bind/zones/master_example.test
$ORIGIN example.test.
$TTL 86400
@ IN SOA example.test. root.example.test. (
201004227 ; serial
28800 ; refresh
14400 ; retry
3600000 ; expire
86400 ) ; min
;
TXT "example.test, DNS service"
@ IN NS example.test.
localhost A 127.0.0.1
example.test. A 192.168.1.52
example A 192.168.1.52
www CNAME example.test.
/etc/hosts
127.0.0.1 localhost example
192.168.1.52 localhost example example.test
/etc/resolv.conf
Note: For Bind I just added the 3 last lines.
nameserver 80.58.0.33
nameserver 80.58.61.250
nameserver 80.58.61.254
search example.test
search example
nameserver 192.168.1.52