XINETD - Extended Internet Daemon

I was recently looking into ways to provide ssh access inside linux network namespaces and
came across xinetd. So I decided to dig more into it. Noting it down here so that I can
refer it back.

XINETD

It’s basically a daemon that listens for network requests and services them by spawning more processes.

The master configuration for xinetd lives in /etc/xinetd.conf. Each service managed
by xinetd has a configuration file in /etc/xinetd.d/.

Each network service is listed in /etc/services that xinetd could potentially manage.

Let’s look at an example from one of the services in /etc/xinetd.d/ to see how it works:

An echo service

This was a default service that was present on my RHEL6 box. There were lots of
settings in this file which were basically commented out. Most of them are self
explanatory, so I have omitted them for brevity.

$ sudo cat /etc/xinetd.d/echo-stream
# This is the configuration for the tcp/stream echo service.
service echo{# This is for quick on or off of the service
disable = yes
# The next attributes are mandatory for all services
id = echo-stream
type= INTERNAL
wait= no
socket_type = stream
# protocol = socket type is usually enough}

echo service simply provides an echo service (duh). But what port does it listen to?
The port can be checked in /etc/services file, search for echo in file, and on my machine
it had an entry that looked like this:

$ sudo cat /etc/services | grep echo
echo 7/tcp

If you try to connect to this port; the connection will fail since the disabled flag
is set to yes in the above configuration file.