How do I determine if a port is open on a Windows server?

Jason picture Jason · Nov 7, 2008 · Viewed 1.9M times · Source

I'm trying to install a site under an alternative port on a server, but the port may be closed by a firewall. Is there a way to ping out or in, on a specific port, to see if it is open?

Answer

Alnitak picture Alnitak · Nov 7, 2008

Assuming that it's a TCP (rather than UDP) port that you're trying to use:

  1. On the server itself, use netstat -an to check to see which ports are listening.

  2. From outside, just use telnet host port (or telnet host:port on Unix systems) to see if the connection is refused, accepted, or timeouts.

On that latter test, then in general:

  • connection refused means that nothing is running on that port
  • accepted means that something is running on that port
  • timeout means that a firewall is blocking access

On Windows 7 or Windows Vista the default option 'telnet' is not recognized as an internal or external command, operable program or batch file. To solve this, just enable it: Click *Start** → Control PanelProgramsTurn Windows Features on or off. In the list, scroll down and select Telnet Client and click OK.