install bind from yum

From WebHostingNeeds.com
Jump to: navigation, search

Install bind

yum -y install bind bind-devel bind-libs bind-utils

Copy configuration files to etc

cp /usr/share/doc/bind-9.3.6/sample/etc/* /etc
rsync -vrplogDtH /usr/share/doc/bind-9.3.6/sample/var/named/ /var/named/
chown -R named:named /var/named/


Set key

Run

/usr/sbin/dns-keygen

On Newer systems, run

/usr/sbin/ddns-confgen
[[email protected] ~]# /usr/sbin/ddns-confgen
# To activate this key, place the following in named.conf, and
# in a separate keyfile on the system or systems from which nsupdate
# will be run:
key "ddns-key" {
        algorithm hmac-sha256;
        secret "mRTlFXIr0ChnvR4c4Il5ngHkcPlrksLtm54STgkCovw=";
};

# Then, in the "zone" statement for each zone you wish to dynamically
# update, place an "update-policy" statement granting update permission
# to this key.  For example, the following statement grants this key
# permission to update any name within the zone:
update-policy {
        grant ddns-key zonesub ANY;
};

# After the keyfile has been placed, the following command will
# execute nsupdate using this key:
nsupdate -k <keyfile>
[[email protected] ~]#


You will get key

[[email protected] ~]# /usr/sbin/dns-keygen
rqv9DdgZ0lMjzFdCG03W9ZDnch2oX2R4uUIc3hIoufaCsT4sU4fho7qVtzFW
[[email protected] ~]#

Edit /etc/named.conf

vi /etc/named.conf

Find

key ddns_key
{
	algorithm hmac-md5;
	secret "use /usr/sbin/dns-keygen to generate TSIG keys";
};

Replace with

key ddns_key
{
	algorithm hmac-md5;
	secret "rqv9DdgZ0lMjzFdCG03W9ZDnch2oX2R4uUIc3hIoufaCsT4sU4fho7qVtzFW";
};

Set Bind start on Boot

chkconfig named on

Verify it with

chkconfig --list|grep named

Debug Bind

Test start and view bind messages

service named stop
echo > /var/log/messages
service named start
cat /var/log/messages

Start Bind

service named start

To stop

service named stop


Add DNS Zone

To host DNS for domain hostonnet.com edit /etc/named.conf

vi /etc/named.conf

Add in external view

	zone "hostonnet.com" { 
		type master;
		file "hostonnet.com.db";
	};

Create a file /var/named/hostonnet.com.db

vi /var/named/hostonnet.com.db

Add Following content to the file

$TTL 14400
hostonnet.com.	86400	IN	SOA	ns1.hostonnet.com.	hostonnet.gmail.com.	(
						2008091002 ;Serial Number
						86400 ;refresh
						7200 ;retry
						3600000 ;expire
						86400 ;minimum
	)
hostonnet.com.	86400	IN	NS	ns1.hostonnet.com.
hostonnet.com.	86400	IN	NS	ns2.hostonnet.com.
hostonnet.com.	14400	IN	A	173.45.99.75
localhost	14400	IN	A	127.0.0.1
hostonnet.com.	14400	IN	MX	0	hostonnet.com.
mail	14400	IN	CNAME	hostonnet.com.
www	14400	IN	CNAME	hostonnet.com.
ftp	14400	IN	A	173.45.99.75
ns1	14400	IN	A	173.45.99.75
ns2	14400	IN	A	173.45.99.76
server1	14400	IN	A	173.45.99.76

Now restart bind

service named restart

On a remote server, you will be able to run

nslookup hostonnet.com ip-of-dns-server