Solved

Configuring DNS on CentOS 5.2 server

Posted on 2008-10-16
10
8,749 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
  • 6
  • 3
10 Comments
 
LVL 29

Expert Comment

by:Michael W
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 W
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
 

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 W
ID: 22745046
Do you have a DNS CNAME entry for 'app' that points to the same IP address as the server?
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 29

Expert Comment

by:Michael W
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 W
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 W 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

757 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now