[System|Toolbox] Tools
for the Art
of System
Administration
HOME STAFF FAQ ADVERTISE LEGAL
Using a Home Server to Learn an Operating System: Red Hat Part 5 - System Services:
Alex Cray
Tuesday May 15, 2012 01:00 AM
In this article in the Home Server series, we continue our look at common system services with DHCP DNS and HTTP for Red Hat / CentOS

 

            There are a number of services that are key for most organizations.    Of these, the most commonly employed ones are probably DHCPD, DNS and Web.   Dynamic Host Configuration Protocol Daemon provides network clients with IP address information, as well as information for client configurations for DNS, time servers or even WINS.   DNS, or Domain Name Services resolves human readable names to their IP addresses.  Web Services are provided by the Apache server.  These services sound quite complex, but in truth, basic setup and configuration couldn't be easier;  this will be a short article.

 

DHCPD

 

            One of the less common functions for a home server is to provide network configuration; most home routers now provide this functionality.  However, this service is commonly used in commercial organizations and it is important to be familiar with how this service works. 

 

Installation:

 

To install DHCPD on Red Hat, simply use the Package Manager to Search.  This tool can be found by going from Applications > Add / Remove Software.

 

Go to Search and then type dhcp and select the dhcp package.

 

If dhcpd is not already installed, Red Hat will attempt to install the required packages at this time.  However, if you selected the packages correctly during the setup article, these packages should already be installed.

 

Red Hat does not include an administration tool for DHCPD, but luckily it's a very easy to manage package.  Once installed, you need to update the DHCPD configuration file, /etc/dhcpd.conf.  Add in base location for your subnet:

 

subnet 192.168.1.0 netmask 255.255.255.0 {

        ddns-updates on;

        option routers 192.168.1.1;

        option subnet-mask 255.255.255.0;

        option domain-name "home.int";

        option domain-name-servers 192.168.1.10;

        option netbios-name-servers 192.168.1.10;

        option time-offset -18000;

        default-lease-time 21600;

        max-lease-time 43200;

        pool {

                range 192.168.1.230 192.168.1.235;

                }

 

Here, we've configured the default clinet information.  Our router address and subnet are defined, as are the domain, DNS and WINS Servers.   Finally, a DHCP allocation pool is established.  This allows any device on the network that requests a DHCP address to receive one.

 

A slightly more secure way would be to comment out the pool stanza above and to add entries for each device on the network.

 

host Laptop {

        allow client-updates;

        deny unknown-clients;

        hardware ethernet 00:22:69:01:02:03;

        fixed-address 192.168.1. 102;

        }

 

With this configuration, only the device with the listed MAC (hardware) address will receive that IP address.

 

Once you've added in entries for all of your network devices, edit /etc/sysconfig/dhcpd.

 

Update:

 

DHCPD_INTERFACE="eth0"

 

(Assuming eth0 is your NIC.)

 

Configure the service to start at boot by typing:

 

Chkconfig dhcpd on

 

Start the service by typing:

 

Service dhcpd restart

 

Finally, be sure to allow the required services to have access via the firewall.

 

Finally, we need to manually update the firewall configuration.  Red Hat is uncommonly good about firewalls.  For the default server install, the firewall is active and whenever a service (remote access VNC, email, etc.) is configured it simply  needs to be added in.  To do this, go to "System" > "Administration" > "Security Level and Firewall":

 

By default, DHCPD uses port 67.  There is no pre-configured template for DHCPD, so select "Other Ports" for the menu on the bottom.  Select Add and then add in the details. For your source network, put in your network (ex. 192.168.1.0) and for both port fields type "67" and then select "Add".

 

Select "Apply" and "OK" to apply the configuration. If you need to confirm the configuration, you can type "iptables -L" from the root account's command line.

 

And believe it or not, but that's it.  You're up and going with DHCPD.

 

 

DNS:

 

            One of the most critical functions on the internet is domain name resolution.  Many ISP's provide these services, but especially in larger organizations, these are administrated locally and few services are as important - or as disruptive when the service is down.

 

Installation:

 

To install the Berkely Internet Naming Daemon (BIND) on Red Hat, simply use the Package Manager to Search.  This tool can be found by going from Applications > Add / Remove Software.

 

Go to Search and then type bind and select the binds package (including chroot, system-config-bind and utils).

 

If bind is not already installed, Red Hat will attempt to install the required packages at this time.  However, if you selected the packages correctly during the setup article, these packages should already be installed.

 

Red Hat does include an administration tool for BIND which is accessible by going to "System" > "Administration" > "Server Settings" > "Domain Name System":

 

 

 

Check out the interface.  Add a test entry go to "New" and then name server.  Create a name server entry for  domain.com.  and "Save"

 

 

 

This is a great tool, but for a start-up configuration, it can be a bit much.  So, to get us going, let's start with a default configuration in  the BIND configuration file, /var/named/chroot/etc/named.conf.  The default DNS installed by the tool above is caching only.  Let's start to update it by adding a reference to your master zone:

 

zone "domain.com" {

        type master;

        file " /var/named/chroot/var/named/domain.com.hosts";

        };

 

Next, create the file mentioned above and add the appropriate records in to the file:

 

$ttl 38400

domain.com. IN    SOA   NS.domain.com. admin.domain.com. (

                  1281242822

                  10800

                  3600

                  604800

                  38400 )

domain.com. IN    NS    NS.domain.com.

mail.domain.com.  IN    MX    5 192.168.1.10

corporate.domain.com.   IN    CNAME mail.domain.com.

 

 

Here, we've configured some example DNS records:

 

  • NS.domain.com has been configured as a name server (NS) for the domain.
  • Mail.domain.com has been configured as a mail server (MX) for the domain.
  • Corporated.domain.com has been configured as an alias (CNAME) for mail.domain.com

 

You could also easily add a direct resolution (A record) with the following line:

 

gateway.domain.com.     IN    A     192.168.1.1

 

From here, simply configure your domain name (replace domain.com) and  add any additional records that you need.

 

Configure the service to start at boot by typing:

 

Chkconfig named on

 

Start the service by typing:

 

Service named restart

 

 

Finally, we need to manually update the firewall configuration.  Red Hat is uncommonly good about firewalls.  For the default server install, the firewall is active and whenever a service (remote access VNC, email, etc.) is configured it simply  needs to be added in.  To do this, go to "System" > "Administration" > "Security Level and Firewall":

 

By default, BIND uses port 53.  There is no pre-configured template for BIND, so select "Other Ports" for the menu on the bottom.  Select Add and then add in the details. For your source network, put in your network (ex. 192.168.1.0) and for both port fields type "53" and then select "Add".

 

Select "Apply" and "OK" to apply the configuration. If you need to confirm the configuration, you can type "iptables -L" from the root account's command line.

 

Assuming you have no syntax errors - BIND is very particular about syntax - you should have a functioning BIND server at this point.

 

Web(Http) via Apache:

 

            Apache is the most popular web server on the internet due to its stability and extremely small footprint.  Having an extremely easy set-up probably doesn't hurt either.

 

Installation:

 

To install HTTPD on Red Hat, simply use the Package Manager to Search.  This tool can be found by going from Applications > Add / Remove Software.

 

Go to Search and then type httpd and select the httpd and system-config-httpd packages.

 

If httpd is not already installed, Red Hat will attempt to install the required packages at this time.  However, if you selected the packages correctly during the setup article, these packages should already be installed.

 

 

Red Hat does include an administration tool for HTTPD which is accessible by going to "System" > "Administration" > "Server Settings" > "HTTPD":

 

 

Red Hat's tool is great, but luckily it's installed with  a fully functional default configuration.  There is nothing that you need to add in the apache configuration file, /etc/httpd/conf/httpd.conf.  You can simply start by adding a test page in the web root, /var/www/html or by uploading a pre-existing page that you  already have composed.

 

linux:~ # cd /var/www/html/

linux:/var/www/html # vi index.html

 

This is a test.

 

Configure the service to start at boot by typing:

 

Chkconfig httpd on

 

Start the service by typing:

 

Service httpd restart

 

Red Hat is uncommonly good about firewalls.  For the default server install, the firewall is active and whenever a service (remote access VNC, email, etc.) is configured it simply  needs to be added in.  To do this, go to "System" > "Administration" > "Security Level and Firewall":

 

 

 

Select the checkbox for "HTTP" and "HTTPS" and then "Apply" and "Ok".

 

If you need to confirm the configuration, you can type "iptables -L" from the root account's command line.

 

At this  point you should be able to navigate to your server in a web browser and see the test page (or the original content, if that's what you placed there.)

 

Hopefully this article has shown how quick and easy it can be to get these extremely powerful services up and functional.

 

Sections
   Comments
   History

Toolboxes
Windows
Unix
Novell
Linux
OSX
Networking
General
Virtualization
Operations Management

Submit
   Comment
   Article
   Tool
   Link

Comment? - Or do you think this article blows chunks and you could write a better one in your sleep? Then do it!
View Comment Page

Copyright © 2004, The Binary Freedom Project, LLC.