How to test a port connectivity in Linux on multiple hosts ?

In this short article, we will look how to test a port on Linux on multiple hosts.

This tip is very useful to test the port connectivity on a large number of hosts.

$ for i in `cat temp2.txt`; do nc -vz $i-host.ngelinux.com 22; done

Connection to host390-host-ngelinux.com 22 port [tcp/ssh] succeeded!

Connection to host448-host-ngelinux.com 22 port [tcp/ssh] succeeded!

Connection to host493-host-ngelinux.com 22 port [tcp/ssh] succeeded!

Connection to host499-host-ngelinux.com 22 port [tcp/ssh] succeeded!

Connection to host531-host-ngelinux.com 22 port [tcp/ssh] succeeded!

Connection to host532-host-ngelinux.com 22 port [tcp/ssh] succeeded!

Connection to host534-host-ngelinux.com 22 port [tcp/ssh] succeeded!

Connection to host557-host-ngelinux.com 22 port [tcp/ssh] succeeded!

Connection to host572-host-ngelinux.com 22 port [tcp/ssh] succeeded!

Connection to host573-host-ngelinux.com 22 port [tcp/ssh] succeeded!

Connection to host576-host-ngelinux.com 22 port [tcp/ssh] succeeded!

Connection to host577-host-ngelinux.com 22 port [tcp/ssh] succeeded!

Connection to host579-host-ngelinux.com 22 port [tcp/ssh] succeeded!

Connection to host581-host-ngelinux.com 22 port [tcp/ssh] succeeded!

Connection to host609-host-ngelinux.com 22 port [tcp/ssh] succeeded!

Connection to host610-host-ngelinux.com 22 port [tcp/ssh] succeeded!

Connection to host637-host-ngelinux.com 22 port [tcp/ssh] succeeded!

Connection to host638-host-ngelinux.com 22 port [tcp/ssh] succeeded!

Connection to host639-host-ngelinux.com 22 port [tcp/ssh] succeeded!

Connection to host644-host-ngelinux.com 22 port [tcp/ssh] succeeded!
0 0 votes
Article Rating
Subscribe
Notify of
guest

1 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments