Chapter 4. Networking services

Table of Contents
4.1. The internet super server
4.2. Caching nameserver
4.3. The Apache webserver

4.1. The internet super server

There are two ways to offer TCP/IP services: by running server applications standalone as a daemon or by using the internet super server, inetd(8). inetd is a daemon which monitors a range of ports. If a client attempts to connect to a port inetd handles the connection and forwards the connection to the server software which handles that kind of connection. The advantage of this approach is that it adds an extra layer of security and it makes it easier to log incoming connections. The disadvantage is that it is somewhat slower than using a standalone daemon. It is thus a good idea to run a standalone daemon on, for example, a heavily loaded FTP server.

inetd can be configured using the /etc/inetd.conf file. Let's have a look at an example line from inetd.conf:


# File Transfer Protocol (FTP) server:
ftp     stream  tcp     nowait  root    /usr/sbin/tcpd  proftpd

This line specifies that inetd should accept FTP connections and pass them to tcpd. This may seem a bit odd, because proftpd normally handles FTP connections. You can also specify to use proftpd directly in inetd.conf, but Slackware normally passes the connection to tcpd. This program passes the connection to proftpd in turn, as specified. tcpd is used to monitor services and to provide host based access control.

Services can be disabled by adding the comment character (#) at the beginning of the line. It is a good idea to disable all services and enable services you need one at a time. After changing /etc/inetd.conf inetd needs to be restarted to activate the changes. This can be done by sending the HUP signal to the inetd process:


# ps ax | grep 'inetd'
   64 ?        S      0:00 /usr/sbin/inetd
# kill -HUP 64

4.2. Caching nameserver

A caching nameserver provides DNS services for a machine or a network, but does not provide DNS for a domain. That means it can only be used to convert hostnames to IP addresses. Setting up a nameserver with Slackware Linux is fairly easy, because BIND is configured as a caching nameserver by default. Enabling the caching nameserver takes just two steps: you have to install BIND and alter the initialization scripts. BIND can be installed by adding the bind package from the "n" diskset. After that bind can be started by executing the named(8) command. If want to start BIND by default, make the /etc/rc.d/rc.bind file executable. This can be done by executing the following command as root:


# chmod a+x /etc/rc.d/rc.bind

If you want to use the nameserver on the machine that runs BIND, you also have to alter /etc/resolv.conf.

4.3. The Apache webserver

Apache is the most widely userd webserver on the internet, and is, of course, part of Slackware Linux. Apache can be installed by adding the apache pacakge from the "n" diskset. If you also want to use PHP, the php ("n" diskset) and mysql ("ap" diskset) are also required. MySQL is required, because the precompiled PHP depends on MySQL shared libraries. You do not have to run MySQL itself. After installing Apache it can be started automatically while booting the system by making the /etc/rc.d/rc.httpd file executable. You can do this by executing:


# chmod a+x /etc/rc.d/rc.httpd

The Apache configuration can be altered in the /etc/apache/httpd.conf file. Apache can be stopped/started/restarted every moment with the apachectl command, and the "stop", "start" and "restart" parameters. For example, execute the following command to restart Apache:


# apachectl restart
/usr/sbin/apachectl restart: httpd restarted