How to Install and Configure Bind 9 as a Caching Server on Ubuntu 11.10

BIND, standing for “Berkeley Internet Name Domain”, is the most widely used Domain Name System software on the web, providing DNS services. It enables users to locate and access websites using human-friendly domain names instead of complex IP addresses.

This tutorial will guide you through the process of installing and configuring BIND 9 on an Ubuntu 11.10 Linux server to function as a caching server. A caching server is a type of server that stores web pages and other content locally, improving response times for future requests of the same content. By configuring BIND 9 as a caching server, you can enhance the efficiency of your network and provide faster response times for your users.

For those who are interested in a deeper understanding of web servers, we recommend our comprehensive guide on the best web servers. This guide provides a detailed overview of various web servers and their features, helping you make an informed decision when choosing a web server for your needs.

Installation of BIND 9

The first step in configuring BIND 9 as a caching server on Ubuntu 11.10 is to install the software. This can be done by executing the following command:

root@ehowstuff:~# apt-get install bind9 -y

This command will install BIND 9 and its dependencies. The output will show the packages that will be upgraded, newly installed, and those that will not be upgraded.

Example:

root@ehowstuff:~# apt-get install bind9 -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  bind9-host bind9utils dnsutils libbind9-60 libcap2 libdns69 libisc62 libisccc60 libisccfg62
  liblwres60
Suggested packages:
  bind9-doc resolvconf rblcheck
The following NEW packages will be installed:
  bind9 bind9utils libcap2
The following packages will be upgraded:
  bind9-host dnsutils libbind9-60 libdns69 libisc62 libisccc60 libisccfg62 liblwres60
8 upgraded, 3 newly installed, 0 to remove and 56 not upgraded.
Need to get 1,592 kB of archives.
After this operation, 1,479 kB of additional disk space will be used.
Get:1 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main dnsutils i386 1:9.7.3.dfsg-1ubuntu4.1 [142 kB]
Get:2 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main bind9-host i386 1:9.7.3.dfsg-1ubuntu4.1 [53.9 kB]
Get:3 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main libisc62 i386 1:9.7.3.dfsg-1ubuntu4.1 [160 kB]
Get:4 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main libdns69 i386 1:9.7.3.dfsg-1ubuntu4.1 [676 kB]
Get:5 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main libisccc60 i386 1:9.7.3.dfsg-1ubuntu4.1 [18.0 kB]
Get:6 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main libisccfg62 i386 1:9.7.3.dfsg-1ubuntu4.1 [38.8 kB]
Get:7 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main liblwres60 i386 1:9.7.3.dfsg-1ubuntu4.1 [38.6 kB]
Get:8 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main libbind9-60 i386 1:9.7.3.dfsg-1ubuntu4.1 [23.0 kB]
Get:9 http://sg.archive.ubuntu.com/ubuntu/ oneiric/main libcap2 i386 1:2.21-2 [12.5 kB]
Get:10 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main bind9utils i386 1:9.7.3.dfsg-1ubuntu4.1 [102 kB]
Get:11 http://sg.archive.ubuntu.com/ubuntu/ oneiric-updates/main bind9 i386 1:9.7.3.dfsg-1ubuntu4.1 [327 kB]
Fetched 1,592 kB in 18s (88.4 kB/s)
Preconfiguring packages ...
(Reading database ... 50749 files and directories currently installed.)
Preparing to replace dnsutils 1:9.7.3.dfsg-1ubuntu4 (using .../dnsutils_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Unpacking replacement dnsutils ...
Preparing to replace bind9-host 1:9.7.3.dfsg-1ubuntu4 (using .../bind9-host_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Unpacking replacement bind9-host ...
Preparing to replace libisc62 1:9.7.3.dfsg-1ubuntu4 (using .../libisc62_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Unpacking replacement libisc62 ...
Preparing to replace libdns69 1:9.7.3.dfsg-1ubuntu4 (using .../libdns69_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Unpacking replacement libdns69 ...
Preparing to replace libisccc60 1:9.7.3.dfsg-1ubuntu4 (using .../libisccc60_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Unpacking replacement libisccc60 ...
Preparing to replace libisccfg62 1:9.7.3.dfsg-1ubuntu4 (using .../libisccfg62_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Unpacking replacement libisccfg62 ...
Preparing to replace liblwres60 1:9.7.3.dfsg-1ubuntu4 (using .../liblwres60_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Unpacking replacement liblwres60 ...
Preparing to replace libbind9-60 1:9.7.3.dfsg-1ubuntu4 (using .../libbind9-60_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Unpacking replacement libbind9-60 ...
Selecting previously deselected package libcap2.
Unpacking libcap2 (from .../libcap2_1%3a2.21-2_i386.deb) ...
Selecting previously deselected package bind9utils.
Unpacking bind9utils (from .../bind9utils_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Selecting previously deselected package bind9.
Unpacking bind9 (from .../bind9_1%3a9.7.3.dfsg-1ubuntu4.1_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for ufw ...
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
Setting up libisc62 (1:9.7.3.dfsg-1ubuntu4.1) ...
Setting up libdns69 (1:9.7.3.dfsg-1ubuntu4.1) ...
Setting up libisccc60 (1:9.7.3.dfsg-1ubuntu4.1) ...
Setting up libisccfg62 (1:9.7.3.dfsg-1ubuntu4.1) ...
Setting up libbind9-60 (1:9.7.3.dfsg-1ubuntu4.1) ...
Setting up liblwres60 (1:9.7.3.dfsg-1ubuntu4.1) ...
Setting up bind9-host (1:9.7.3.dfsg-1ubuntu4.1) ...
Setting up dnsutils (1:9.7.3.dfsg-1ubuntu4.1) ...
Setting up libcap2 (1:2.21-2) ...
Setting up bind9utils (1:9.7.3.dfsg-1ubuntu4.1) ...
Setting up bind9 (1:9.7.3.dfsg-1ubuntu4.1) ...
Adding group `bind' (GID 113) ...
Done.
Adding system user `bind' (UID 105) ...
Adding new user `bind' (UID 105) with group `bind' ...
Not creating home directory `/var/cache/bind'.
wrote key file "/etc/bind/rndc.key"
#
 * Starting domain name service... bind9                                                     [ OK ]
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

Configuration of BIND 9

The main configuration of BIND 9 is stored in the following files:

root@ehowstuff:~# ls /etc/bind | grep named
named.conf
named.conf.default-zones
named.conf.local
named.conf.options

To configure BIND 9 to act as a caching server, you need to add the IP numbers of your ISP’s DNS servers or alternatively, you can use free Google DNS server. This can be done by editing the following file:

root@ehowstuff:~# vim /etc/bind/named.conf.options

In the /etc/bind/named.conf.options file, uncomment and edit the following section:

forwarders {
 8.8.8.8;
};

This configuration sets Google’s DNS server (8.8.8.8) as the forwarder.

See also  How to Install and Configure Joomla 2.5.4 on CentOS 5.8

Starting the BIND 9 Service

After the configuration, you need to start or restart the caching named service. This can be done as a root user or as a normal user.

As a root user, execute the following command:

root@ehowstuff:~# /etc/init.d/bind9 restart
 * Stopping domain name service... bind9                                                     [ OK ]
 * Starting domain name service... bind9   

As a normal user, execute the following command:

ehowstuff@ehowstuff:~$ sudo /etc/init.d/bind9 restart
[sudo] password for ehowstuff:
 * Stopping domain name service... bind9                                                     [ OK ]
 * Starting domain name service... bind9   

Verification of the Caching DNS Server

To verify that the caching DNS server is working correctly, you can use the dig command to query a domain, for example, google.com:

root@ehowstuff:~# dig www.google.com

The output will provide information about the query, including the status, flags, sections, query time, server, and message size.

See also  How to Move a Directory in Ubuntu

Example:

root@ehowstuff:~# dig www.google.com

; <<>> DiG 9.7.3 <<>> www.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40642
;; flags: qr rd ra; QUERY: 1, ANSWER: 7, AUTHORITY: 13, ADDITIONAL: 0

;; QUESTION SECTION:
;www.google.com.                        IN      A

;; ANSWER SECTION:
www.google.com.         86322   IN      CNAME   www.l.google.com.
www.l.google.com.       223     IN      A       209.85.175.99
www.l.google.com.       223     IN      A       209.85.175.103
www.l.google.com.       223     IN      A       209.85.175.104
www.l.google.com.       223     IN      A       209.85.175.105
www.l.google.com.       223     IN      A       209.85.175.106
www.l.google.com.       223     IN      A       209.85.175.147

;; AUTHORITY SECTION:
.                       14355   IN      NS      m.root-servers.net.
.                       14355   IN      NS      l.root-servers.net.
.                       14355   IN      NS      f.root-servers.net.
.                       14355   IN      NS      d.root-servers.net.
.                       14355   IN      NS      k.root-servers.net.
.                       14355   IN      NS      j.root-servers.net.
.                       14355   IN      NS      g.root-servers.net.
.                       14355   IN      NS      h.root-servers.net.
.                       14355   IN      NS      i.root-servers.net.
.                       14355   IN      NS      a.root-servers.net.
.                       14355   IN      NS      e.root-servers.net.
.                       14355   IN      NS      b.root-servers.net.
.                       14355   IN      NS      c.root-servers.net.

;; Query time: 14 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sun Apr  8 16:21:07 2012
;; MSG SIZE  rcvd: 359

Commands Mentioned

  • apt-get install bind9 -y – Installs BIND 9 and its dependencies
  • ls /etc/bind | grep named – Lists the main configuration files for BIND 9
  • vim /etc/bind/named.conf.options – Opens the named.conf.options file for editing
  • /etc/init.d/bind9 restart – Restarts the BIND 9 service
  • dig www.google.com – Queries the domain www.google.com to verify the caching DNS server

Conclusion

BIND 9 is a powerful tool for managing DNS services, and configuring it as a caching server can significantly improve response times for DNS queries. This tutorial has guided you through the process of installing and configuring BIND 9 on an Ubuntu 11.10 server, and verifying its operation.

See also  How to Uninstall ModSecurity on Ubuntu

For more information on various types of web servers like Apache, Nginx, and LiteSpeed, you can refer to our detailed guides. If you're interested in different types of hosting, we also have comprehensive articles on dedicated server, VPS server, cloud hosting, and shared hosting.

Remember, the key to successful server management is understanding the tools at your disposal and how to use them effectively. By following the steps outlined in this tutorial, you can set up a caching server that improves your network's efficiency and response times.

Frequently Asked Questions

  1. What is BIND 9?

    BIND 9, standing for "Berkeley Internet Name Domain", is the most widely used Domain Name System (DNS) software on the Internet. It provides DNS services, allowing users to connect to websites using domain names instead of IP addresses.

  2. What is a caching server?

    A caching server is a server that saves web pages and other content locally. By storing this information in the cache, the server can improve response times for future requests of the same content.

  3. How do I install BIND 9 on Ubuntu 11.10?

    You can install BIND 9 on Ubuntu 11.10 by executing the command 'apt-get install bind9 -y' as a root user. This command will install BIND 9 and its dependencies.

  4. How do I configure BIND 9 as a caching server?

    To configure BIND 9 as a caching server, you need to edit the /etc/bind/named.conf.options file and add the IP numbers of your ISP’s DNS servers or use a free DNS server like Google's (8.8.8.8) in the 'forwarders' section.

  5. How do I verify that the caching DNS server is working?

    You can verify that the caching DNS server is working correctly by using the 'dig' command to query a domain. For example, 'dig www.google.com' will provide information about the query, including the status, flags, sections, query time, server, and message size.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *