a short command to check if the ports are firewalled?
No
Not reliably or conclusively from either only the host offering a service or the client. Please not that in addition to host based firewalls there may also be firewalls and access controls in the network path between a client and server.
From the client you can try and set up a connection to the correct port on the host offering a service. (Typically a telnet host port
, nc -vz host port
or openssl s_client -connect host:port
etc. for TCP services.)
If you can successfully establish a connection: either there is indeed no firewall, or the connection is white-listed in the firewall(s). The latter is a big distinction, as there may be other controls in the firewall that may impact your performance at a later time such as for instance rate limiting, intrusion detection etc.
If no connection can be established, with a bit of luck you get a connection refused
error message. Our canonical connection refused Q&A
explains in detail on how to proceed from there to determine if the problem is that the host offering the service is not configured correctly or if indeed a firewall is blocking the connection (or both).
If no connection can be established and you get a connection time-out
, that may be firewall that is blocking the connection by dropping the connection attempt rather than rejecting it politely, but it could also be a routing problem, a hostname resolving to an incorrect IP-address or something else.