Tuesday, February 17, 2009

Setting up a Master DNS Server

These are my notes on setting up a master DNS server. DNS is short for Domain Name System. The DNS is responsible for translating computer addresses in the form of numbers into human understandable convention like "www.google.com".

First, my system. The operating system that I am installing to is a CentOS 5.0 Linux box. If you are not familiar with the CentOS Linux distribution, CentOS is generally a "Red Hat Enterprise Product" distribution intended for production deployments without the branding and support of Red Hat. It is in many ways the same as the Red Hat Enterprise Linux product and is related to the Fedora distribution.

Setting up the master DNS server requires the following steps:

Step 1:
Download and install the BIND software. BIND is short for Berkeley Internet Name Domain. I am assuming that you are connected to the Internet. The command to do that is:


# yum install bind
# yum install bind-utils



Step 2:
Create the configuration file "named.conf" in the directory "/etc". The file "named.conf" should read as follows:



zone "0.0.127.in-addr.arpa" {
type master;
file "mylocalhost";
};

zone "bse.deped.gov.ph" {
type master;
notify no;
file "bse.deped.gov.ph";
};

zone "126.126.222.in-addr.arpa" {
type master;
notify no;
file "222.126.126";
};



Step 3:
Create the file "mylocalhost" in the directory "/var/named". The "mylocalhost" file should read as follows:



$TTL 3D
@ IN SOA ns.bse.deped.gov.ph. hostmaster.bse.deped.gov.ph. (
1 ; serial
8H ; Refresh
2H ; Retry
4W ; Expire
1D) ; Minimum TTL

NS ns.bse.deped.gov.ph.

1 PTR localhost.




Step 4:
Create the zone file for the domain like "bse.deped.gov.ph" in the directory "/var/named". The file "bse.deped.gov.ph" should read as follows:




$TTL 3D
@ IN SOA ns.bse.deped.gov.ph. hostmaster.bse.deped.gov.ph. (
19980214 ; serial
8H ; refresh
2H ; retry
4W ; expire
1D) ; minimum TTL

NS ns
MX 10 mail01.bse.deped.gov.ph.
20 mail02.bse deped.gov.ph.

localhost A 127.0.0.1
www A 222.126.126.211

ns A 222.126.126.211
mail01 A 222.126.126.211
mail02 A 222.126.126.212



Step 5:
Create the reverse domain file such as "222.126.126" in the directory "/var/named". The file "222.126.126" should read as follows:



$TTL 3D
@ IN SOA ns.bse.deped.gov.ph. hostmaster.bse.deped.gov.ph. (
19980214 ; serial
8H ; Refresh
2H ; Retry
4W ; Expire
1D ) ; Minimum TTL

NS ns.bse.deped.gov.ph.

211 PTR www.bse.deped.gov.ph.



Step 6:
Start the server as follows:



# /etc/rc.d/init.d/named start
Starting named: [ OK ]


If there are no errors proceed to the next step. If there are errors, double check on the contents of the setup files.

Step 7:
Check the name resolution functionality of your server by using the "nslookup" utility that comes with the "bind-utils" package as follows:



# nslookup www.bse.deped.gov.ph
Server: 127.0.0.1
Address: 127.0.0.1#53

Name: www.bse.deped.gov.ph
Address: 222.126.126.211

# nslookup 222.126.126.211
Server: 127.0.0.1
Address: 127.0.0.1#53

211.126.126.222.in-addr.arpa name = www.bse.deped.gov.ph.

No comments: