Sunday, October 11, 2009

How to setup DNS server using Bind9 under Debian and Ubuntu Linux

A tutorial on how to install and configure DNS server for your LAN using bind9. The DNS server will provide caching and name resolution as well as reverse name resolution for your local network. This set-up I use the domain jesson.net and its private ip address is 192.168.2.248.

Now install the bind9 package and dns utilities from Debian repository.
apt-get install bind9 dnsutils
Configure your Linux system

Add this information to your /etc/hostname
vim /etc/hosts


Edit your /etc/resolv.conf
vim /etc/resolv.conf
and add this information.

search jesson.net
nameserver 192.168.2.248

Lets create a zone

The zone files (or database files) are the heart of your BIND system.

This is where all the information is stored on what hostname goes with what ip address.
Before we create a zone file, lets edit first the local configuration file /etc/bind/named.conf.local.

vim /etc/bind/named.conf.local
and the zone file data.



Create a zone file in /var/cache/bind/ directory. Create a file called db.jesson.net
vim /var/cache/bind/db.jesson.net
And add the following



Now create the reverse DNS zone file db.192.168.2
vim /var/cache/bind/db.192.168.2
and the following



Now edit the file /etc/bind/named.conf.options
vim /etc/bind/named.conf.options



Uncomment the line forwarders and add your ISP's DNS server.
Lets restart our DNS server, and test using the tool dig.
/etc/init.d/bind9 restart
dig jesson.net
You should see the following message



nslookup jesson.net
nslookup 192.168.2.248
host jesson.net
host 192.168.2.248
All computers in the LAN are going to use 192.168.2.248 as a nameserver, this can be set manually by setting statically:
vim /etc/resolv.conf on Linux

then put this information.
nameserver 192.168.2.248

On windows configure the following like this:



Have Fun!!!

No comments:

Post a Comment