How do I know if a TCP port is open or closed?

https://www.synology.com/en-global/knowledgebase/DSM/tutorial/Network/Whether_TCP_port_is_open_or_closed

How do I know if a TCP port is open or closed?

Purpose

This article explains how to check if a TCP port is open or closed on different operating systems when you suspect that any of the following issues resulted in a closed port:

  • The port forwarding rule is incorrectly configured.

  • The external IP address is set to a private IP address.

  • The network connection is blocked by firewall rules.

  • The service is not working properly.

Contents

Resolution

On a Windows computer

  1. Press the Windows key and type "Windows features" in the search bar. Then, select Turn Windows features on or off.

  2. Tick the Telnet Client checkbox and click OK.

  3. Press the Windows key + R, then type "cmd.exe" and click OK.

  4. Enter "telnet + IP address or hostname + port number" (e.g., telnet www.example.com 1723 or telnet 10.17.xxx.xxx 5000) to run the telnet command in Command Prompt and test the TCP port status.

  5. If the port is open, only a cursor will show. If the port is closed, a message will say Connect failed.

On a Mac computer (before macOS 11 Big Sur)

  1. Click the Spotlight icon in the upper-right hand corner or press Command + Space bar.

  2. Type "Network Utility" in the search field and select Network Utility.

  3. Select Port Scan, enter an IP address or hostname in the text field, and specify a port range. Click Scan to begin the test. If a TCP port is open, it will be displayed here.

On a Linux computer

  1. Open Terminal on your Linux computer.

  2. Enter "telnet + IP address or hostname + port number" (e.g., telnet www.synology.com 1723 or telnet 10.17.xxx.xxx 5000) to run the telnet command and test the port status.

  3. If the port is open, a message will say Connected to 10.17.xxx.xxx. If the port is closed, a message will say Connection refused.

Via a third-party website

  1. Fill in the IP address or hostname into the Remote Address field and the port number into the Port Number field.

  2. Click Check to test the port status.

  3. If the port is open, a message will say Port XXX is open on XXX.XXX.XXX.

Last updated

Was this helpful?