How-To: Check if specific ports of a remote host are reachable



How to check if a specific port of a remote host is reachable

sometimes one simply wants to find out if a certain port is reachable and by that a service should be available.

You might use the following command to test

nc -v -z <host|ip> <port>

# example:
root@ucs:~# nc -v -z ucs-master 53
Connection to ucs-master 53 port [tcp/domain] succeeded!

# example - closed port:
root@ucs:~# nc -v -z ucs-master 21
nc: connect to ucs-master port 21 (tcp) failed: Connection refused