6

I need an echo server on my Linux/Debian for debugging purposes , I realized that there is an assigned port shown in '/etc/services' to do that already and it's port 7 TCP/UDP.

Is it possible to open this port on Linux (Debian)? if not, what are alternatives?

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
Brian Salehi
  • 412
  • 2
  • 6
  • 16

1 Answers1

5

For setting up a echo service in Debian, you can install xinetd with:

apt-get install xinetd

Than you have to change the disable directive to no in /etc/xinetd.d/echo; or if the file does not exist, create it as shown here:

# default: off
# description: An xinetd internal service which echo's characters back to
# clients.
# This is the tcp version.
service echo
{
    disable     = no
    type        = INTERNAL
    id      = echo-stream
    socket_type = stream
    protocol    = tcp
    user        = root
    wait        = no
}

# This is the udp version.
service echo
{
    disable     = yes
    type        = INTERNAL
    id      = echo-dgram
    socket_type = dgram
    protocol    = udp
    user        = root
    wait        = yes
}

After setting disable = no, or creating the file, your restart xinetd with:

sudo service xinetd restart

To test the echo TCP service:

$nc localhost echo
testing...
testing...
xxxx
xxxx
^C
Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227