Create a Port Listener to verify connectivity

How to test an open port without having the application installed.  Suppose you have a situation where you just created a new Linux server (CentOS 6) and you will eventually have an application run on Tomcat port 8080/tcp. You will want this application to use some sort of a Reverse Proxy and this all goes through a firewall that sits in-between both of those boxes.  This article is not going into the detail of setting up the Reverse Proxy or the firewall rules or anything of that nature.  The assumption is that all the rules are in place and we want to know if the Reverse Proxy can access the future port 8080 on the other server.

Using telnet from the Reverse Proxy, I can see if the firewall rules are correct and that the application server is listening on port 8080/tcp.

telnet 8080

Since, nothing is running on the application server, telnet will error out.

To resolve this, on the application server, install nc and run it to listen on port 8080.  Then test it with nestat -anlp.

yum install nc -y
nc -l 8080 &
netstat -anlp | grep 8080

Run telnet again from the Reverse Proxy and you should get the desired result.

Alternately, if you want to test a web page with port for a temporary connection.  I created a test file to read like this.

echo "Demo with nc." > some.file

Then ran the following command.

{ echo -ne "HTTP/1.0 200 OK\r\n\r\n"; cat some.file; } | nc -l 8080



How to Create Port Listener in Windows or Linux– Handy for Connectivity Test