0% found this document useful (0 votes)
72 views

Manual For BIND DNS Server On CentOS

This document provides instructions for setting up BIND and Apache servers on CentOS. It describes: 1) Installing and configuring BIND to listen on port 53 and allow queries and transfers. 2) Creating zone and zone files for the domain "123.com" and configuring recursion. 3) Installing and enabling Apache virtual hosts to serve the directory "/var/www/html/abc" on the domain "abc.com". 4) Restarting the services for the changes to take effect.

Uploaded by

zainab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views

Manual For BIND DNS Server On CentOS

This document provides instructions for setting up BIND and Apache servers on CentOS. It describes: 1) Installing and configuring BIND to listen on port 53 and allow queries and transfers. 2) Creating zone and zone files for the domain "123.com" and configuring recursion. 3) Installing and enabling Apache virtual hosts to serve the directory "/var/www/html/abc" on the domain "abc.com". 4) Restarting the services for the changes to take effect.

Uploaded by

zainab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

1

Manual For BIND DNS Server on CentOS

1. Install BIND DNS server.

root@test [~]# yum update –y

root@test [~]# yum install bind –y

2. We'll open the BIND (named) configuration file and make several modifications.

root@test [~]# vi /etc/named.conf

3. Add the private IP address of ns1 to listen to port 53. (Local Machine IP 192.168.12.128)

listen-on port 53 { 192.168.12.128; };

4. Add the following lines under the options tab in “named.conf” file. (Local/Caching DNS)

recursion yes;

allow-transfer { localhost; };

allow-query { any; };

5. Under the [ view "localhost_resolver" ] add following lines (For Authoritative DNS)

match-clients { any; };

match-destinations { any; };
recursion no;

zone "." IN {
type hint;

file "/var/named/named.ca";

Provide the Path , where the Zone file is present.


"vi /var/named.rfc1912.zones"; or
“vi /etc/named.conf";

Prepared By : Syed Zeeshan Ali


2

6. Now make the named.conf file and add the following lines.

root@test [~]# vi /etc/named/named.conf

zone "123.com" {

type master;

file “db.123.com” ;

};

7. Now make the directory for zone files.

Let's create the directory where our zone files will reside. According to our named.conf configuration,
that location should be /etc/named/zones:

root@test [~]# chmod 755 /var/named

root@test [~]# cd /var/named

[root@test named] # mkdir db.123.com

Afterwards go to vi /etc/resolv.conf

Add name server : 192.168.19.128

8. Create the Zone file as follows.


;
; Zone file for 123.com
;
$TTL 3D
@ IN SOA ns.dsl.net.pk. root.dsl.net.pk. (
2017052501 ; serial
6H ; refresh, seconds
2H ; retry, seconds
4W ; expire, seconds
1D ) ; minimum, seconds
;
NS ns.dsl.net.pk.
NS ns1.dsl.net.pk.
;
MX 0 mail.nayatel.com.
MX 5 smtp4.nayatel.com.
;
A 203.82.48.116

Prepared By : Syed Zeeshan Ali


3

www A 203.83.48.116

9. Now restart the DNS BIND.

root@test [8~]# service named restart

Stopping named: . [ OK ]

Starting named: [ OK ]

10. Now check the zone file by following command.

root@test [~]# dig 123.com @192.168.12.128 (For Local/Caching DNS)

For Authoritative DNS :

Prepared By : Syed Zeeshan Ali


4

Similarly

12. The last step. Check it by nslookup.

Prepared By : Syed Zeeshan Ali


5

Manual For Apache Server on CentOS (How to Virtually Host a


Website)

1) Install APACHE

yum install httpd

2) Create a Directory

The first step in creating a virtual host is to create a directory where we will keep the new website’s
information.

[root @test html] mkdir -p /var/www/html/abc

3) Create/Edit the Page

We need to create a new file called index.html within our configurations directory.

[root @test abc] vim /index.html

We can add some text to the file so we will have something to look at when the IP redirects to the
virtual host.

“This is my First Website “

4) Turn on Virtual Hosts

[root @test abc] Vim /etc/httpd/conf/httpd.conf

#Listen 12.34.56.78:80

Prepared By : Syed Zeeshan Ali


6

Listen 80

Scroll down to the very bottom of the document to the section called Virtual Hosts.

NameVirtualHost *:80

# NOTE: NameVirtualHost cannot be used without a port specifier

# (e.g. :80) if mod_ssl is being used, due to the nature of the

# SSL protocol.

# VirtualHost example:

# Almost any Apache directive may go into a VirtualHost container.

# The first VirtualHost section is used for requests without a known

# server name.

<VirtualHost *:80>

ServerAdmin [email protected]

DocumentRoot /var/www/html/abc.com

ServerName www.abc.com

Prepared By : Syed Zeeshan Ali


7

ServerAlias abc.com

#ErrorLog /var/www/abc.com/error.log

#CustomLog /var/www/abc.com/requests.log

</VirtualHost>

Prepared By : Syed Zeeshan Ali


8

5) Setting Up the Local Hosts

If want to try out your new virtual hosts without having to connect to an actual domain name (our case)
Vim /etc/hosts

6) Restart Apache

We’ve made a lot of the changes to the configuration. However, they will not take effect until Apache is
restarted.

Service httpd restart

7) Results

Prepared By : Syed Zeeshan Ali


9

Prepared By : Syed Zeeshan Ali

You might also like