If you are network admin, you faced the situation where the server is not accessible, however server IP is pingable. There can be various possibility including server crash and in this case, port will not be accessible. However, server may be overloaded. We need to find what is the actual reason. This document try to explain how to check if port is accessible or not.
There are few tools which try to connect with the port and check if it is open or not. In below approaches, It is assumed that there is no firewall rules to block access to the port.
Example if port is open
In this example, admin is testing if port 5001 is open in 192.0.0.1 IP
root@linux:/# telnet 192.0.0.1 5001
Trying 192.0.0.1...
Connected to 192.0.0.1.
Escape character is '^]'.
Example if port is not open
In this example, admin is testing if port 5001 is open in 192.0.0.1 IP
root@ubuntu:/# telnet 192.0.0.1 5001
Trying 192.0.0.1...
^C
root@ubuntu:/#
This command should be executed in the linux machine hosting server in test. Note that if network namespace is configured in the box, then you need to execute nc command in the namespace context.
Example for running nc command in network namespace
Find your network namespace
root@ubuntu:/# ip netns
mynamespace
Execute nc command within namespace
root@ubuntu:/# ip netns exec mynamespace nc -v -z -w2 192.0.0.1 5001
Connection to 192.0.0.1 5001 port [tcp/*] succeeded!
Example output If port is open
In this example, admin is testing if port 5001 is open in 192.0.0.1 IP
root@18ebd69ccb09:/# nc -v -z -w2 192.0.0.1 5001
Connection to 192.0.0.1 5001 port [tcp/*] succeeded!
Example output If port is not open
In this example, admin is testing if port 5001 is open in 192.0.0.1 IP
root@ubuntu:/# nc -v -z -w2 192.0.0.1 5001
nc: connect to 192.0.0.1 port 5001 (tcp) timed out: Operation now in progress
http://superuser.com/questions/621870/test-if-a-port-on-a-remote-system-is-reachable-without-telnet
https://kb.acronis.com/content/7503