Solved

Configuring DNS on CentOS 5.2 server

Posted on 2008-10-16
10
8,752 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

920 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

17 Experts available now in Live!

Get 1:1 Help Now