Checking IP/Ports are Open for Business

Checking IP/Ports are Open for Business

Checking IP/Ports are open is easy enough. You can use various tools depending on your operating system:

On Windows:

  • Use telnet <IP address> <port> in the Command Prompt.
  • If telnet is not enabled, you can enable it through Windows Features, or use PowerShell:

    Test-NetConnection -ComputerName <IP address> -Port <port>

You can add -InformationLevel “Detailed” to the above command too.

The -InformationLevel parameter allows you to control the level of detail included in the command’s output. When set to "Detailed", it instructs the command to provide a comprehensive set of diagnostic information about the network connection. This detailed output can include various technical details such as the route taken by packets, round-trip time, and other low-level data that can be useful for in-depth troubleshooting of network issues.

On Linux or macOS:

  • Use the nc (netcat) command:

    nc -vz <IP address> <port>
  • Alternatively, use:

    telnet <IP address> <port>

-vz are options where -v stands for verbose, giving more details about the connection process, and -z tells Netcat to scan without sending any data.

These commands attempt to establish a connection to the specified IP and port. If the connection is successful, it indicates that the port is open. If the connection fails or times out, it typically means the port is closed or not reachable.

I have related posts here: – Enhancing Local Development with Acrylic DNS, Connecting to a Kubernetes Cluster on Rancher with kubectl from Windows.

The official documentation for the PowerShell command is here: – https://learn.microsoft.com/en-us/powershell/module/nettcpip/test-netconnection?view=windowsserver2022-ps

Stephen

Hi, my name is Stephen Finchett. I have been a software engineer for over 30 years and worked on complex, business critical, multi-user systems for all of my career. For the last 15 years, I have been concentrating on web based solutions using the Microsoft Stack including ASP.Net, C#, TypeScript, SQL Server and running everything at scale within Kubernetes.