Open, closed and filtered
The checker tries a TCP connection to the host and port from our server:
- Open: something accepted the connection. The service is reachable from the internet.
- Closed: the server answered but refused the connection: the machine is up, but nothing listens on that port (or it listens only on localhost).
- Filtered: no answer at all within five seconds. A firewall, security group or router is dropping the packets.
It only checks that a connection can be made; it does not log in or send data.
When a port should be open but is not
Work outward from the service:
- Is the service running and listening on all interfaces (
0.0.0.0), not only127.0.0.1? Check withss -tlnpornetstat -an. - Does the server's own firewall (ufw, firewalld, Windows Firewall) allow the port?
- Does the cloud security group or network ACL allow it from the internet?
- At home, is the port forwarded on the router, and is your ISP not using CGNAT?
A refused connection from inside the server's own network points at the service; a timeout points at a firewall. The ECONNREFUSED guide and connection timed out go deeper.
Ports that should stay closed
Databases (MySQL 3306, PostgreSQL 5432, Redis 6379, MongoDB 27017, Elasticsearch 9200) and remote desktop (3389) should almost never be reachable from the whole internet: automated scanners find them within minutes. Keep them on a private network or behind a VPN, and allow only the addresses that need them.
To be alerted when a port that should be open stops answering, server monitoring runs TCP checks every minute.