How to check port availability

How to check port availability

06.08.2021
Autor: HostZealot Team
2 min.
983

Here is a quick guide to help you understand how to check if a port is available and why it is needed. A port is an address used by multiple devices to exchange data, commands, etc. A port address is written as a 16-digit number with a value between 1 and 65,535. This range is divided into three types:

  • System - have a range of 0 to 1023;
  • User - ranging from 1024 to 49 151;
  • Dynamic - from 49 152 to 65 535.

The port availability check is carried out for different reasons, but most often it is necessary to determine whether the computer or server is ready to accept incoming connections. Testing can be done remotely or locally.

How to find out your port on Windows

For Windows 10 users, checking port availability is done in three steps:

  1. Run "Run" with the Win+R shortcut.
  2. Enter the command “cmd” and press Enter.
  3. In the window that appears, type the command netstat -an, and press Enter.

As a result of scanning the network stack, you will get detailed statistics on inbound and outbound connections with information on local address, external address, and connection status.

The method described above is not perfect and may misfire during security checks, since skilled hackers can easily hide the traces of illegally opened ports from the program. In that case, there is another, more effective tool for checking the port availability - to use a third-party port scanning utility. These are Nmap, Zenmap and other utilities that can be found on the Internet.

How to find out your port on Linux

On all Unix-like systems, the algorithm is quite simple. First, we have to install the netcat utility - it is a simple but efficient and informative tool that can be used to open TCP connections, send UDP packets, and most importantly, scan ports under IPv4 and IPv6. After installation, open a terminal application and type the command "$ nc -zv 192.168.0.1 22" to find out if port 22 is open at 192.168.0.1. You can ping any other port in the same way.

An important note: you can modify the command to specify any range of ports to ping. For example, "$ nc -zv 192.168.0.1 20-25" to check 5 ports at once.

How to test a specific port for availability

A popular tool is Telnet Client, which is recommended by Microsoft, it is released for all current versions of Windows, starting with Windows 7. Here are the official instructions from Microsoft on how to install this utility. Once installed, you can find out the ping of the port and its availability through the command line using the command "telnet server_name_port_number". If after sending the command, the terminal gives a "Connection failure" error, it means the port is closed.

Verwandte Artikel