After our vendors have setup a certain test environment, we need to go in to perform connectivity testing between PC to servers and also between servers.

The problem is that we run a range of tests to telnet between 2 nodes on several ports and this is a manual and rather tedious process.

Does anyone know of a small tool or script that I can take input on the range of ports to be test and will run an automated range of testing against those ports? All I need to do is to validate whether a TCP connection can be established from the source PC / server to the target server IP address / port.

Thanks, Wong

3 Answers 3


You can use a portscanner like nmap

You can use -P to specify individual ports, or ranges: -P 25,80,110,1024-2048,3306

  • Strictly speaking, nmap is the best fit for my use case, with one major problem: it's completely banned. I just spent the past couple of weeks trying to get an exception to the rule but failed. My client's IT security team is adamant that anybody using nmap is a threat to the network and refuses to compromise on this.
    – feicipet
    Dec 3, 2013 at 16:29

The netcat/nc and possibly expect tools are good for this. With nc for example you can set a timeout and then interrogate the exit status of the command

nc -w 1 example.com  80

would return an exit status of 0 after 1 second if a connection can be established and 1 if a connection cannot.


For a long term monitoring you should use nagios. You could also configure notifications and escalations when something fails.


  • I'm more looking for a basic shakedown tool that will be removed as soon as the work is done. Nagios is more of a long term solution which doesn't fit this scenario as well.
    – feicipet
    Nov 8, 2013 at 5:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.