Solved

Configuring DNS on CentOS 5.2 server

Posted on 2008-10-16
10
8,765 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

617 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