Wednesday, December 15, 2010

Debian simple DNS server setup

We are going setup a simple Debian DNS server for local purpose using bind9.
apt-get install -y rsyslog bind9 bind9-doc dnsutils
Once the server installed let our system know which dns server to use (a one we just installed), ensure that is the first nameserver in the list (file /etc/resolv.conf):
In case you do no need the server to listen on ipv6 set the following option (file /etc/bind/named.conf.options):
listen-on-v6 { none; };
Restart bind9 daemon:
/etc/init.d/bind9 restart
and verify with:
root@ns1:~# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0*               LISTEN      816/named       
tcp        0      0  *               LISTEN      816/named       
tcp        0      0 *               LISTEN      816/named       
udp        0      0*                           816/named       
udp        0      0  *                           816/named       
That pretty it, let ensure its working. First we need install dnsutils package that comes with dig command, so here we go:
root@ns1:~# dig
; <<>> DiG 9.7.2-P3 <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64434
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 3, ADDITIONAL: 3

;   IN A

;; ANSWER SECTION:  3600 IN A  3600 IN A

;; AUTHORITY SECTION:  28606 IN NS  28606 IN NS  28606 IN NS

;; ADDITIONAL SECTION:  28606 IN AAAA 2607:f8f0:610:4000:214:38ff:feee:b65a  28606 IN A  28606 IN AAAA 2001:648:2ffc:deb::10:10

;; Query time: 96 msec
;; WHEN: Wed Dec 15 21:47:12 2010
;; MSG SIZE  rcvd: 196
Notice the server responded to our request was Read more here and here. Consider chroot your dns server, details here.

No comments :

Post a Comment