User Tools

Site Tools


computers:dns_server_configuration

This is an old revision of the document!


DNS server configuration

Installation

Download and install the packages

sudo apt-get install bind9
sudo apt-get install dnsutils

Configuration

To setup a caching nameserver, add the IP addresses of the ISP's (e.g., Academia Sinica) DNS servers. Uncomment and edit the following in /etc/bind/named.conf.options:

forwarders {
		// Google
		8.8.8.8;
		8.8.4.4;
		// Academia Sinica
		140.109.13.10;
		140.109.1.10;
           };

Activation

To start/stop/restart the service:

sudo /etc/init.d/bind9 start
sudo /etc/init.d/bind9 stop
sudo /etc/init.d/bind9 restart

Test

Use “dig” against the loopback interface to make sure it is listening on port 53:

$ dig -x 127.0.0.1
 
; <<>> DiG 9.7.0-P1 <<>> -x 127.0.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18580
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
 
;; QUESTION SECTION:
;1.0.0.127.in-addr.arpa.		IN	PTR
 
;; ANSWER SECTION:
1.0.0.127.in-addr.arpa.	655360	IN	PTR	localhost.
 
;; Query time: 1 msec
;; SERVER: 140.109.13.10#53(140.109.13.10)
;; WHEN: Fri Aug 26 10:51:34 2011
;; MSG SIZE  rcvd: 63

Use “dig” against an outside domain to check the query time:

$ dig ubuntu.com
 
; <<>> DiG 9.7.0-P1 <<>> ubuntu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46633
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
 
;; QUESTION SECTION:
;ubuntu.com.			IN	A
 
;; ANSWER SECTION:
ubuntu.com.		600	IN	A	91.189.94.156
 
;; Query time: 275 msec
;; SERVER: 140.109.13.10#53(140.109.13.10)
;; WHEN: Fri Aug 26 10:54:43 2011
;; MSG SIZE  rcvd: 44

Note the query time toward the end of the command output is 275 msec. Rerun the command to see if the query time is improved (because the result is now cached).

References

computers/dns_server_configuration.1339560981.txt.gz · Last modified: 2012/06/13 12:16 by chkuo