Solved

Configuring DNS on CentOS 5.2 server

Posted on 2008-10-16
10
8,764 Views
Last Modified: 2012-06-27
I just installed a server running CentOS 5.2 and plan on using it as a web server.  I need to enable DNS and have app.testcomp.com point to //10.10.10.158//var/www/html.  Clients will get their IP from DHCP running on this server.  The server IP is 10.10.10.158.  Will someone please lead me through this?
0
Comment
Question by:shannon_adams
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
10 Comments
 
LVL 29

Expert Comment

by:Michael Worsham
ID: 22737674
Do you want the server to act as a DNS server plus a web server or just have the Apache instance be able to handle DNS lookup names and point them to the correct directory structure (i.e. virtual hosts)?

0
 
LVL 29

Expert Comment

by:Michael Worsham
ID: 22737730
For expandibility and ease of support, I recommend not using the /var/www/html directory and create a directory like /web (base directory) and /var/web (log files) and using it for all of the domains you wish to house/support.

Under your /etc/httpd/conf, modify the httpd.conf and add the following line at the end:

Include /etc/httpd/conf/virthosts.conf

Then under the same /etc/httpd/conf directory, create a file called virthosts.conf and fill in the information provided below.

NameVirtualHost *:80
 
<VirtualHost *:80>
 ServerName app.testcomp.com 
 ServerAlias www.app.testcomp.com
 DocumentRoot /web/app.testcomp.com/htdocs
 ErrorLog /var/web/app.testcomp.com/error_log
 CustomLog /var/web/app.testcomp.com/access_log common
 ScriptAlias /cgi-bin/ "/web/app.testcomp.com/htdocs/"
 <Directory /web/app.testcomp.com>
     Options Indexes FollowSymLinks Multiviews +Includes
     AllowOverride All
 </Directory>
</VirtualHost>

Open in new window

0
 
LVL 29

Expert Comment

by:fosiul01
ID: 22740532
HI
you asked , how to configure dns server, but after reading your question , its seems like you want to configure as webserver,

which one you want to configure ??

for dns server, you need to install bind
and have to configure named.conf

you can follow wnat  mwecomputers said to configure apache,
or you can follow this tutorial about configureing binds and apache
http://www.howtoforge.com/creating-your-own-webserver-with-bind-and-apache-centos5
let me know if you need any help
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:shannon_adams
ID: 22744984
Under the /etc/httpd/conf, I modified the httpd.conf and add the following line at the end:
Include /etc/httpd/conf/virthosts.conf
Then under the same /etc/httpd/conf directory, created virthosts.conf

Basically, this is a web server that needs to provide dhcp.  I need a virtual host so that when a client connects to the server, it can browse to app.testcomp.com.

Here is my /etc/dhcpd.conf

ddns-update-style interim;
ignore client-updates;

subnet 10.10.10.0 netmask 255.255.255.0 {

# --- default gateway
        option routers                  10.10.10.1;
        option subnet-mask              255.255.255.0;

        option nis-domain               "testcomp.com";
        option domain-name              "testcomp.com";
        option domain-name-servers      10.10.10.158;

        option time-offset              -18000; # Eastern Standard Time
#       option ntp-servers              10.10.10.158;
#       option netbios-name-servers     10.10.10.158;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
#       option netbios-node-type 2;

        range dynamic-bootp 10.10.10.10 10.10.10.150;
        default-lease-time 21600;
        max-lease-time 43200;

        # we want the nameserver to appear at a fixed address
        host ns {
                next-server marvin.redhat.com;
                hardware ethernet 12:34:56:78:AB:CD;
                fixed-address 207.175.42.254;
        }

DHCP is working fine.

The virtual host is the problem.  I changed /etc/httpd/conf/httpd.conf and added the following line at the end:
Include /etc/httpd/conf/virthosts.conf

Here is virthosts.conf:
NameVirtualHost *:80

<VirtualHost *:80>
 ServerName app.testcomp.com
 ServerAlias www.app.testcomp.com
 DocumentRoot /var/www/html
 ErrorLog logs/error_log
 CustomLog logs/access_log common
 ScriptAlias /cgi-bin/ "/var/www/html/"
 <Directory /var/www/html>
     Options Indexes FollowSymLinks Multiviews +Includes
     AllowOverride All
 </Directory>
</VirtualHost>

The named service starts fine, but the client cannot ping app.testcomp.com or browse to it.  ipconfig shows:
Connection-specific DNS Suffix: testcomp.com
IP Address:  10.10.10.150
Subnet Mask:  255.255.255.0
Default Gateway:  10.10.10.1

I appreciate any help getting me through this.
0
 
LVL 29

Expert Comment

by:Michael Worsham
ID: 22745046
Do you have a DNS CNAME entry for 'app' that points to the same IP address as the server?
0
 
LVL 29

Expert Comment

by:Michael Worsham
ID: 22745073
Oops. A DNS 'A record' entry for app that points to 10.10.10.150?
0
 

Author Comment

by:shannon_adams
ID: 22745079
No, I don't.  Where would I put that?
0
 
LVL 29

Expert Comment

by:Michael Worsham
ID: 22745101
First of all, are you going to have the DNS located on the same server as the web host or a seperate server or external host?
0
 

Author Comment

by:shannon_adams
ID: 22745119
This server is standalone and will not be hooked to the Internet or any other network.
0
 
LVL 29

Accepted Solution

by:
Michael Worsham earned 500 total points
ID: 22745175
You will need to configure/setup named.conf for youe environment, then create a zone file (commonly referred to as a 'DNS stub file' for your domain name. Inside the zone file, this is where you would have your main A record, MX records, subdomain records, etc.

Setting up a local DNS (BIND/Named) is not as easy as it looks, so it will take a bit of trial and error.
http://www.brennan.id.au/08-Domain_Name_System_BIND.html
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
wamp versus xampp 4 77
Create link to folder for use with apache. 7 124
IIS Authentication Error 401 16 72
unix shell script 4 39
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question