I want to run a service which require to connect with some source using port 20000 but it is not connecting. I want to test my this port is blocked or open.
-
This question is perhaps a bit short on words, but try using `netstat -an` or `netstat -lnptu` to figure out whether port 20000 is in LISTENING or perhaps ESTABLISHED state. I assume you are talking about a TCP connection here - if UDP your problem is something else. Add more details - then maybe better answers (and even a positive score) will come :-) – MrMajestyk Feb 03 '15 at 13:19
2 Answers
Useful utilities :
1.Telnet
2.nc
3.nmap
Scenario: For checking remote system tcp 80 port status
Usage :
telnet myserver.com 80
nc -v myserver.com 80
nmap myserver.com 80
Response Analysis :
if you get a time out or deny : the port is not open
suppose if you get "Connection refused" : then port is open but process is not listerning
If you get a connection successful : Port is open and process is listen
Solution:
start/restart the listening process (if connection refused)
Ask network team to monitor the connection we can confirm whether it is blocked from intermediate network firewall or from server firewall/iptables
Note :
- Suppose firewall configured to Reject packets instead of Drop then u will get "connection refused" error , so here in this case we can't ensure wheteher process is listern or not.
For checking udp port (like ntp) you can use below nc option
nc -uzv yourserver.com 123

- 131
- 2
- 3
You can try NMAP to scan ports that are "open" on you local machine like:
nmap -sS -O -p20000 127.0.0.1
Or to a netstat to check what port is used by a service.
Like so:
netstat -lnptu

- 28
- 2
-
-
-
-
@ADM, for exmaple you can use netstat -plnt | grep ':20000' to look for the port is it`s LISTING to any service. – Andrius Feb 03 '15 at 13:13