Using the Echo Service on Raspberry Pi for Network Testing

If you’ve not seen the echo service before, it is a very simple Linux service that simply echos back whatever it is sent. Here I use telnet to connect to the service (port 7) and type ABC:

echo-fig1

Once I press enter, the ABC is sent back to me.

This can be a handy tool in the early stages of developing a networked program.

At the moment, I’m testing ideas for a program on an Arduino that will make a network connection to a Raspberry Pi. By running the echo service and WireShark on the Raspberry Pi, I can simply monitor the network traffic to see if packets are being created and sent like I want without writing any code on the Raspberry Pi.

This allows me to test ideas on the Arduino to verify that the concept works without having to also write code for the Raspberry Pi. Once I know the proof of concept works, then I can proceed to working on code for the Raspberry Pi.

echo is NOT enabled by default. Which is fine. I have never allowed it to run on a production system. I’m sure some hacker could take advantage of it in some way. But it is useful on a development system.

echo is part of the openbsd-inetd package which can be installed with:

sudo apt-get update
sudo apt-get install openbsd-inetd

Once installed, you will need to edit /etc/inetd.conf and add a few lines using the editor of your choice (the commented lines were already present, I just added the echo lines):

#:INTERNAL: Internal services
#discard                stream  tcp     nowait  root    internal
#discard                dgram   udp     wait    root    internal
#daytime                stream  tcp     nowait  root    internal
#time           stream  tcp     nowait  root    internal
echo            stream  tcp     nowait  root    internal
echo            dgram   udp     wait    root    internal

To restart inetd:

sudo service openbsd-inetd restart

Finally, verify that echo service is connected properly:

netstat -a | less
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 *:echo                  *:*                     LISTEN
tcp        0      0 *:5900                  *:*                     LISTEN
tcp        0      0 *:x11                   *:*                     LISTEN
tcp        0      0 *:http                  *:*                     LISTEN
tcp        0      0 *:ftp                   *:*                     LISTEN
tcp        0      0 *:ssh                   *:*                     LISTEN
tcp        0      0 *:telnet                *:*                     LISTEN
tcp        0      0 localhost:gpsd          *:*                     LISTEN
udp        0      0 *:echo                  *:*
udp        0      0 localhost:ntp           *:*
udp        0      0 *:ntp                   *:*

 

This entry was posted in c-rpi and tagged . Bookmark the permalink.

4 Responses to Using the Echo Service on Raspberry Pi for Network Testing

  1. Pingback: Arduino, GPS, GSM/GPRS: Transmitting GPS Coordinates via UDP to Google Maps | Big Dan the Blogging Man

  2. Pingback: Basic ESP8266 Setup and Operation | Big Dan the Blogging Man

  3. Pingback: ESP8266 Reading/Writing GPIO and Transmitting/Receiving UDP Packets | Big Dan the Blogging Man

  4. Pingback: ESP8266/Arduino IDE: Communicating with TCP | Big Dan the Blogging Man

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s