12 July 2009

Using Netcat to test ports

Yesterday I needed to quickly test if two machines could communicate over tcp/ip across a firewall. You can use netcat to quickly open a service that is listening on a port.

To listen on port 8888 on host server1:

server1$ nc -l 8888

On the other end (host server2), connect to server1 with the following:

server2$ nc server1 8888

Anything you type on server1 or server2 is now transferred to the other host and you have successfully tested connectivity.

http://www.linuxjournal.com/content/sending-email-netcat