Network Daemons  «Prev  Next»

Lesson 9 Inetd: the super server
Objective Describe how server processes start and stop under the control of inetd.

Server Processes start and stop under the Control of inetd

As we discussed earlier, a system that offers many network services needs many server processes listening on many ports. This need creates a substantial load on the system. The internet daemon [1], inetd, provides a mechanism for reducing the number of different listening servers and a central location for controlling network services.
To accomplish these goals, the inetd process listens on many ports simultaneously for incoming connections. When a connection arrives at one of the ports under its control, the inetd process uses the fork() and exec() system calls to start specific server process needed to handle a connection at that well-known port. For example, suppose that inetd is listening to TCP port 23. When a new connection for port 23 arrives, inetd starts a telnet server process and passes the incoming connection to this new server process.
The inetd process is controlled by its configuration file /etc/inetd.conf. This file tells inetd how to respond to incoming connections on a given port. A typical line in the /etc/inetd.conf file looks like this:

service type protocol wait-status uid server arguments

Here are some sample lines from /etc/inetd.conf, taken from a Linux machine:
Below is an example from /etc/inetd.conf
Mouseover the tooltip below to receive additional information.
  1. The name of the service that this line controls. This must be mentioned in /etc/services.
  2. The socket type. The most common possibilities are stream or dgram. The stream type is used with tcp in the next field, the dgram type with UDP.
  3. Specifies whether this is a TCP or UDP service.
  4. Wait status. Wait means run this service as an iterative server (wait for one server to finish before starting another). Nowait means run it as a concurrent server (fork a server process, then go right back to listening on the port).
  5. The user ID that will own the server process started by inetd.
  6. The path name of the server process inetd will start.
  7. Arguments. Any arguments to the server process started by inetd.
The name of the service that this line controls. This must be mentioned in /etc/services.

typical line etcInetdConf
The first line of this file means that if an incoming connection arrives on the FTP port, then inetd should run the command:

/usr/sbin/tcpd in.ftpd -l –a

This line will handle a TCP connection (stream TCP) and root will own the resulting process. Furthermore, inetd will not wait for this process to finish before listening again on the FTP port, so FTP is treated concurrently. The program /usr/sbin/tcpd is a front end for network services. It provides additional levels of access control and logging. It will start the in.ftpd daemon process, which is the real FTP server process. We will not discuss tcpd in this course; it could be eliminated (at some cost in security) by modifying the inetd.conf line to read:
ftp stream tcp nowait 
root /usr/sbin/in.ftpd –l –a

Using inetd

inetd Daemon Vital Component unix System
Server Processes inetd using Solaris
In these simulations, you will explore how server processes start and stop under the control of inetd. Choose which UNIX version you would like to simulate by clicking either the Linux or the Solaris button.

iterative Concurrent Servers - Quiz

Click the Quiz link below to take a short multiple-choice quiz on server processes and iterative/concurrent servers.
iterative Concurrent Servers - Quiz

[1]Daemon: On UNIX systems, a process which runs independently of any login session and performs system maintenance or functions as a server.