Ubuntu Linux Setup and Configure a Domain Name Server Using BIND

Recently i had to setup a LAMP server for one of client. As usual I chose Ubuntu. I setup the The LAMP. You can view the Setup LAMP With Ubuntu In 10 Minutes. Then my client wanted to setup domain on that server. So start searching for easy to setup domain name on Ubuntu server.So i found out about BIND. Its pretty sweet DNS software. As I am using Ubuntu then setting it up will be one line code :).








Step # 1: Install BIND
First you need to install BIND server.
Code:

$ sudo apt-get install bind9

Step # 2: Define foo.com domain
You need to add foo.com domain to bind configuration file /etc/bind/named.conf.local

Open this file and append following text (zone and reverse zone for foo.com):
Code:

$ sudo nano /etc/bind/named.conf.local

Add foo.com zone:
Code:

zone "foo.com" {
        type master;
        file "/etc/bind/zones/foo.com.zone";
        };

zone "1.55.202.in-addr.arpa" {
     type master;
     file "/etc/bind/zones/rev.1.55.202.in-addr.arpa";
};

Save the file.

Step # 3: Create a /etc/bind/zones/ directory
Code:

$ sudo mkdir /etc/bind/zones

Step # 4: Create a zone file for foo.com domain
Now create a zone file /etc/bind/zones/foo.com.zone
Code:

$ sudo nano /etc/bind/zones/foo.com.zone

Append following text:
Code:

foo.com. IN      SOA     ns1.foo.com. admin.foo.com. (
          2006071801 
          28800       
          3600        
          604800    
          38400 )    
foo.com. IN      NS      ns1.foo.com.
foo.com. IN      MX     10 mta.foo.com.

www           IN      A       202.55.1.2
mta              IN      A       202.55.1.2
ns1               IN       A        202.55.1.2

Create the reverse zone file:
Code:

$ sudo nano /etc/bind/zones/rev.1.55.202.in-addr.arpa

Append following text
Code:

@ IN SOA ns1.foo.com. admin.foo.com. (
                        2006071801; serial
                        28800; refresh, seconds
                        604800; retry, seconds
                        604800; expire, seconds
                        86400 ); minimum, seconds

                     IN  NS ns1.foot.com.

2                  IN      PTR    foo.com

Save the file and restart the BIND server:
Code:

$ sudo /etc/init.d/bind9 restart

Test it:
Code:

$ nslookup foo.com

Server: 202.55.1.2
Address: 202.55.1.2#53

Name: foo.com
Address: 202.55.1.2

About Zakir Hyder

This entry was written by .

18. December 2011 by Zakir Hyder
Categories: Linux, Server Management | Tags: , , | Comments

Comments

  1. […] Ubuntu Linux Setup and Configure a Domain Name Server Using BIND December 18, 2011 2:42 PM Recently i had to setup a LAMP server for one of client. As usual I chose Ubuntu. I setup the The LAMP. You can view the Setup LAMP With Ubuntu In 10 Minutes. Then my client wanted to setup domain on that server. So start searching for easy to setup domain name on Ubuntu server.So […] […]