PoiNtEr->: Setup name server for a domain in ubuntu(linux)

                             Difference between a dream and an aim. A dream requires soundless sleep, whereas an aim requires sleepless efforts.

Search This Blog

Wednesday, July 13, 2011

Setup name server for a domain in ubuntu(linux)


Goal setup name server for domain called foo.com.

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 gedit /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 gedit /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 gedit /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.
                     IN      PTR    foo.com

Save the file and restart the BIND server:
Code:

$ sudo /etc/init.d/bind9 restart

Test it:

$ nslookup foo.com

Server: 202.55.1.2
Address: 202.55.1.2#53

Name: foo.com
Address: 202.55.1.2

No comments:

Post a Comment