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:

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.

    https://kb.synology.com/_images/autogen/Whether_TCP_port_is_open_or_closed/1.png

  2. Tick the Telnet Client checkbox and click OK.

    https://kb.synology.com/_images/autogen/Whether_TCP_port_is_open_or_closed/2.png

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

    https://kb.synology.com/_images/autogen/Whether_TCP_port_is_open_or_closed/3.png

  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.

    https://kb.synology.com/_images/autogen/Whether_TCP_port_is_open_or_closed/4.png

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

    https://kb.synology.com/_images/autogen/Whether_TCP_port_is_open_or_closed/5.png

    https://kb.synology.com/_images/autogen/Whether_TCP_port_is_open_or_closed/6.png

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.

    https://kb.synology.com/_images/autogen/Whether_TCP_port_is_open_or_closed/8.png

  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.

    https://kb.synology.com/_images/autogen/Whether_TCP_port_is_open_or_closed/9.png

On a Linux computer