Как проверить занятость порта windows

Checking open TCP/IP ports on your Windows computer is crucial for managing network security and ensuring smooth connectivity. Certain apps and processes in Windows may face issues due to closed or misconfigured ports, often caused by firewalls or private IP addresses. This guide will walk you through step-by-step methods to check whether a TCP port is open or closed using built-in tools and third-party utilities.

Why You Should Check TCP/IP Ports?

Here are some common scenarios where checking ports is necessary:

  • Troubleshooting connectivity issues for applications or services.
  • Configuring firewalls to ensure necessary connections are allowed.
  • Detecting suspicious activity that might indicate a security breach.

Methods to Check Open TCP/IP Ports

There are several ways to check open TCP/IP ports in Windows. Here are a few options:

Method 1. Using Telnet Client

Step 1: Check whether the telnet client feature is ON or not. In order to check, open the Turn Windows feature on or off settings from the search bar. OR press the ‘window’ key and type ‘windows’ features. Then press on “Turn Windows features on or off”.

Windows Features Option

A new prompt will be opened. Search for “Telnet Client” and check the box in front of ‘telnet Client’.

Windows Features

Step 2: Open the command prompt. Press the ‘windows’ key and type ‘cmd’. Press “Command Prompt”.

Command Prompt Option

Step 3: On the command prompt, type the command “telnet + IP address or hostname + port number” and check the status of the provided TCP port.

Telnet Command

Step 4: If only the blinking cursor is visible, then the port is open.

Port is Open

Step 5: If you get the message “connection failed” then the port is closed.

Port is close

Method 2: Using built-in netstat command-line utility:

Step 1: Open the command prompt. 

Step 2: Run the following command:

netstat -an

Method 3. Using TcpView

Another option is to use the TcpView utility from Microsoft’s Sysinternals suite of tools. This utility provides a more user-friendly interface for viewing active TCP/IP connections, along with additional information such as the process ID and process name for each connection. Steps to be followed:

Step 1: Download the TcpView utility from the Microsoft Sysinternals website. You can find the download link on the TcpView page of the Sysinternals website.

Download Page

Step 2: Extract the downloaded file and run the TcpView.exe file to launch the TcpView utility. This will open the TcpView window, which shows a list of all active TCP/IP connections on your machine.

Extracted FIles

Step 3: Open the tcpview.exe (application).

By default, TcpView will display the following columns in the list of connections:

Protocol: Shows the protocol being used for the connection (TCP or UDP)

Local Address: Shows the local address and port being used for the connection

Remote Address: Shows the remote address and port being connected to

State: Shows the current state of the connection (e.g. Established, Listen, etc.)

You can use the “Local Address” and “Remote Address” columns to see which ports are being used by which applications. For example, if you see a connection with a local address of “127.0.0.1:80”, this means that the local application is using port 80 for outgoing connections.

Method 4. Using Windows PowerShell

You can also use Windows PowerShell to check open TCP/IP ports. To do this, use the Get-NetTCPConnection cmdlet, which allows you to view a list of active TCP/IP connections and the local and remote addresses and ports being used. For example, you can run the following command to view a list of all active TCP/IP connections:

Get-NetTCPConnection | 
Select-Object LocalAddress,
LocalPort, RemoteAddress, RemotePort

Get-NetTCPConnection cmdlet

Method 5. Using Nmap

To install Nmap in the Windows command line, follow these steps:

Step 1: Download the latest version of Nmap from the Nmap website. You can find the download link on the Nmap download page: 

https://nmap.org/download.html

Step 2: Extract the downloaded file to a location on your computer. This will create a new folder containing the Nmap files.

Step 3: Open a command prompt and navigate to the directory where you extracted the Nmap files. For example, if you extracted the files to the C:\nmap directory, you would run the following command:

cd C:\nmap

Step 4: Once you are in the Nmap directory, you can install Nmap by running the nmap.exe file. To do this, run the following command:

nmap.exe -V

This will display the version number of Nmap, indicating that it has been installed successfully.

Step 5: To use nmap to scan for open TCP/IP ports, run the “nmap -sT” command, followed by the IP address or hostname of the machine you want to scan.

nmap -sT localhost

This will scan the specified host or IP address and display the results. You can also use the -h option to view a list of available options and arguments for the nmap command. Overall, installing Nmap in the Windows command line is a straightforward process. You can download the latest version of Nmap from the Nmap website, extract the files, and then run the nmap.exe file to install it. Once it is installed, you can use the nmap command to scan hosts and IP addresses and view the results.

Common Issues That Close Ports

  • Applications not functioning as expected.
  • Misconfigured firewall rules blocking connections.
  • IP addresses improperly set as private.

Troubleshooting Common Issues

Here are some common issues that may occur during opening TCP/IP Ports in Windows:

  • Telnet Not Listed in Features: Ensure your system version supports Telnet or enable it via PowerShell.
  • Firewall Blocking Ports: Temporarily disable the firewall to test port connectivity.
  • Command Not Recognized: Verify tool installation and environment variables.

Conclusion

Checking open TCP/IP ports on your Windows computer is an important step for maintaining your system’s security and efficiency. By regularly monitoring these ports, you can identify any unwanted or suspicious connections that might put your computer at risk. Windows provides several simple tools, like Command Prompt and PowerShell, which make it easy to see which ports are open and what applications are using them. Taking the time to check your open ports helps ensure that your computer runs smoothly and stays protected from potential threats. Staying proactive about monitoring your network connections is a key part of keeping your digital environment safe and reliable.

Как посмотреть список открытых портов в Windows

Статья обновлена: 10 сентября 2021
ID: 101

Чтобы посмотреть список открытых портов:

  1. Откройте командную строку. Инструкция в статье.
  2. Выполните команду:

netstat -a

  1. Нажмите Enter на клавиатуре.

Переход к просмотру списка открытых портов

Вы получите список открытых портов в Windows.

Спасибо за ваш отзыв, вы помогаете нам становиться лучше!

Спасибо за ваш отзыв, вы помогаете нам становиться лучше!

A Port basically serves as an interface between your computer and the internet or other computers in the network. Every communication over the web is exchanged using these ports, so they are an essential part of the entire internet communication model.

Every IP address has a total of 65,535 ports, and it’s either a UDP port or a TCP port. An open port in a computer refers to a port that is configured to accept the connections, and a port that rejects connections is obviously a closed port.

While open ports are necessary for internet communication, they can be dangerous if the service listening on the port has bad security rules and is misconfigured. Such open ports are vulnerable to attacks.

In this post today, we will learn how to check which ports are being used in your machine, how to test if a Firewall is blocking a Port, and also learn how to check which process or service is using the open port.

How to check what Ports are open in Windows 10

Open Command Prompt, type the following, and hit Enter to view the Ports used along with the Process Identifiers (PIDs):

netstat -ano

This will display the ports on your PC. It will display the details in 5 columns-

  1. Protocols,
  2. Local Address,
  3. Foreign Address,
  4. State, and
  5. PID (Process Identifier).

The port numbers here are displayed under the Local Adress column, for example, if the Local Adress is 0.0.0.0:5040, 5040 here is the port number.

Under the State tab, you can check whether a port is open or not.

  • LISTENING means that it just waits and it is ready to send an answer whenever a client program requests it. The connection becomes open when a client connects to that port and a conversation begins.
  • ESTABLISHED means that the connection has been established.
  • TIME_WAIT means it’s waiting for a reply or connection. this often happens when a port is activated and the connection has not yet. been established
  • CLOSE_WAIT means that the other side of the connection has closed the connection.

This is how you check what all ports are open in your Windows 10.

You can also view the Ports used along with the Process Names by running this command:

netstat -ab

Read: How to use Port Query Tool (PortQry.exe).

Check which process or service is using the open port

Now when we know what all ports are open in our system, we can also check which service is using which open port. To check that, go to the PID (Process ID) tab.

Let’s take the example of our first open port in the list, port 135, and its PID is 1192.

Now open the Task Manager by hitting Ctrl+Alt+Delete. Go to the Services tab and check for PID 1192.

Under the Description tab, you will see which app/program uses that port. End that particular task if you want to close that connection.

Alternatively, you can also find this using this command:

takslist|findstr "1192"

This will display the program using the selected port.

If you are looking for an easy way, you can also use some third-party software to check what all ports are open in your Windows 10. There is quite a few such freeware available on the web which tell what all websites your computer is connecting to and what all ports are open in your PC. One of such freeware is CurrPorts.

Read: How to Block or Open a Port in Windows Firewall.

How to test if Firewall is blocking a Port

CurrPorts is a simple and portable freeware to check open ports that comes in a zip file and takes no time to download on your PC. Since it is portable software, you do not need to install it. Simply download it, extract all the files and run it. Make sure you download the correct version as per your machine’s configuration.

CurrPorts is a network monitoring software that displays the entire list of all open ports of your PC. Apart from the port number and its State, the freeware also shows detailed information about the processes using the open ports, the complete path of the process, file description, product name, file version, date and time it was created, and much more.

Once you download CurrPorts and run it, the main overview has it all. It displays the entire thing in one single window. You can check all the currently opened TCP and UDP ports and the program using that particular port in a single window. Check the screenshot below. You can select one or more processes at a time, check their ports and kill them if they seem to be unwanted. It also allows you to save the port information to an HTML/XML/Text file.

How to check what Ports are Open or Blocking in Windows

Furthermore, CurrPorts also lets you kill the process from the same window. Simply select the processes you want to kill, right-click and select ‘Kill processes of selected ports’ from the dropdown menu.

Another benefit of using CurrPorts is that it marks the suspicious TCP/UDP ports owned by the unidentified applications. So you can directly kill them and save your PC from a possible attack.

Certainly, using this freeware is an easier option as compared to the Command Prompt option mentioned above. You can download the software from the official website Nirsoft.net. Please note that there is a separate download link for x64 versions of Windows. This utility works fine with almost every version of Windows. It is a standalone executable utility so it doesn’t require any installation.

Read: Closed Port vs Stealth Port.

Обмен данными по локальной сети или через интернет осуществляется путем подключения друг к другу двух компьютеров. Чтобы получить данные с удаленного сервера, требуется соблюсти несколько условий – наличие IP-адреса у источника и получателя, выбор конкретного протокола приема-передачи и открытые порты на обоих компьютерах.

Что такое порт компьютера

Порт – это виртуальное дополнение к сетевому адресу, которое позволяет разделить запросы разных приложений и обрабатывать их автономно. Часть постоянно занята системными службами Windows или другой операционки, остальные свободны для использования прикладными программами, в том числе запускаемыми на удаленных серверах.

Проверка порта на доступность

Особенности портов:

  1. Иногда порты путают с разъемами на материнской плате (формально они и являются ими, но там речь идет о подключении физических устройств).
  2. Общее количество портов составляет 65535. Они имеют определенное назначение, например, 20-21 «по умолчанию» используется для соединения по FTP, а 110 выделен под почтовый протокол POP3.
  3. Сочетание IP-адреса и порта принято называть сокетом или файловым дескриптором, при помощи которого программа передает данные.

Перед подключением к какому-либо порту рекомендуется проверить, свободен ли он. Если нет, то операционная система выдаст ошибку, и соединение прервется. Многие программы делают проверку в автоматическом режиме и сами пытаются менять номера в поиске незанятого подключения. Но в ряде случаев это требуется сделать вручную, например, при отладке собственного кода.

Комьюнити теперь в Телеграм

Подпишитесь и будьте в курсе последних IT-новостей

Подписаться


Как проверить, открыт ли порт для подключения

Порты присутствуют у всех сетевых устройств, включая маршрутизаторы и роутеры, поэтому при анализе среды важно понимать, какой именно узел проверяется. На этом отчасти основаны системы безопасности, когда ради блокировки вероятных хакерских атак закрываются все свободные сокеты и открываются только те, которые используются корпоративным софтом.

Открыт ли порт

Существует три основных способа проверки открытых портов:

  1. Специализированные онлайн-сервисы.
  2. Прикладные приложения, запускаемые на компьютере.
  3. Встроенные в операционную систему утилиты.

Выбор решения зависит от задач. Так, если требуется открыть доступ к своему компьютеру извне, можно воспользоваться сервисами 2ip.ru или portscan.ru. При локальных работах удобнее приложения типа Portforward Network Utilities или штатная утилита TELNET. Она поставляется в «стандартной» сборке Windows и доступна для запуска в консоли CMD.

Перечень открытых портов на локальном компьютере

Открытый порт на домашнем или рабочем компьютере – это фактически «дыра» в безопасности и риски утраты контроля над ситуацией. Именно через них проникают трояны и иные вирусы, которые имеют цель предоставить злоумышленнику возможность удаленного подключения к ПК без разрешения владельца. 

Командная строка

Проверить занятые порты легко:

  1. Нужно нажать комбинацию клавиш <Win+R>.
  2. Ввести команду CMD и нажать кнопку Enter.
  3. Ввести команду netstat –a и повторно нажать Enter.

В консоли отобразится перечень занятых портов с указанием, какое приложение или служба ими «распоряжается». Такой вариант проверки интересен тем, что он дает объективную картину. Если рассчитывать только на онлайн-сервисы, иногда создается впечатление, что открытых портов нет. Эффект создается из-за блокировки внешних запросов брандмауэром Windows или другим ПО.

Порт телнет

Если хочется изучить список на предмет «посторонних» программ, его лучше выгрузить в файл при помощи команды netstat –a >имя.txt. По умолчанию список сохраняется в каталоге пользователя, в аккаунте которого происходил запуск утилиты (типа C:\\Пользователи\User\). При желании перед запуском утилиты можно перейти в корень диска командой cd c:\.

VDS Timeweb арендовать

Просмотр открытых портов на удаленном компьютере

При взаимодействии с удаленным сервером используется другая утилита – TELNET. В Windows она по умолчанию отключена, потому что не относится к пользовательским приложениям. Перед первым запуском придется провести «активацию». Существует два способа включения – в консоли или через графический интерфейс.

Запуск утилиты telnet

Активация заключается во вводе специальной команды:

dism /online /Enable-Feature /FeatureName:TelnetClient

Она сработает только при запуске консоли с правами администратора. Схема открытия приложения несколько иная:

  1. Нажать комбинацию клавиш <Win+X>.
  2. Выбрать пункт «Командная строка (администратор)».
  3. В открывшемся окне ввести команду активации telnet.

Команда telnet

Если пользователь предпочитает управлять компьютером через графический интерфейс, нужно запустить панель управления, а в ней утилиту «Удаление программы». В открывшемся окне нужно перейти в раздел «Включение или отключение компонентов Windows», далее в общем списке найти строку «Telnet», поставить в ней галочку и нажать кнопку ОК. Все, служба активирована и готова к использованию (даже в консоли).

клиент Телнет

Синтаксис:

telnet опции хост порт

Хост – это домен или его IP-адрес, порт – виртуальное дополнение для образования сокета, опции же позволяют менять режим подключения. Их основные варианты:

  1. -4 – использовать адреса стандарта IPV4;
  2. -6 – использовать адреса стандарта IPV6;
  3. -8 – применять 8-битную кодировку типа Unicode;
  4. -E – отключение поддержки Escape-последовательностей;
  5. -a – вход с именем пользователя из переменного окружения User;
  6. -b – использовать локальный сокет;
  7. -d – включить режим отладки;
  8. -p – режим эмуляции rlogin;
  9. -e – задать символ начала Escape-последовательности;
  10. -l – пользователь для авторизации на удаленном сервере.

Простейший вариант проверки открытых портов – это ввод команды без опций:

telnet 10.0.119.127 80

Если на экран будет выведено сообщение «Сбой подключения», порт закрыт, нужно подбирать другой номер. Если порт открыт, пользователь увидит пустой экран или приглашение со стороны сервера ввести логин и пароль.

Windows Netstat Command to Check Open Ports in Windows

In this tutorial, we will learn how to run the netstat command to check open ports in Windows Operating System. We will also look at command options and how to use the findstr command (similar to grep) to filter the netstat output.

To check open ports, open a command prompt (or PowerShell) as administrator and run the netstat command as follows:

netstat -aon

The command displays lots of information. What you should pay attention to are Local Addresses that are in the LISTENING state.

check if port is open windows

As you can see in the previous screenshot, In my Windows 10 computer, port 22 (SSH) is open.

Administrators can run the following command to show opened ports only without all other details:

netstat -aon | findstr /i listening

One important point is that the Windows Firewall may block a port even if it is in the listening state. In the Windows Defender Firewall with Advanced Security, there has to be a corresponding inbound firewall rule to match the listening port (Anything with a green checkmark is an open rule).

listening ports windows firewall

The Foreign Address column of the output shows the IP address and port of the computer/server at the remote end of the connection.

To check that the port is open from a remote computer, an administrator can run the telnet command from a remote computer against the IP address of the Windows computer.

For example, to check if port 22 is open, I will run the telnet command from a remote computer as follows:

telnet IP_ADDRESS 22

Replace IP_ADDRESS with the actual IP Address of the Windows computer.

check if port is open from a remote computer

Filtering netstat using findstr

Administrators can use the findstr CMD command (which is similar to grep) to filter netstat command data based on string patterns.

For example, run the following command to check TCP connections in TIME_WAIT State.

netstat -a | findstr /i TIME_WAIT

The /I option is for the case insensitive matching.

cmd netstat command to check open ports in windows

Command Options

Windows netstat command, without any command-line arguments, displays active TCP connections.

It also includes some useful command options to show network connections and ports in various forms, such as show connections and opened ports based on the protocol, find the process id of a connection/port, view network statics, and find the application that utilizes connections and ports.

-a displays all network connections and ports on which Windows is listening (include both IPv4 or IPv6 addresses).
-b The output shows you which applications are using each active connection and ports (need administrative privileges).
-e Displays network statistics, such as the Errors, the number of bytes, and packets sent and received.
-n Displays addresses and ports in numerical format.
-f When used, the output will contain Fully Qualified Domain Names (FQDNs) of IP addresses, if available.
-o Displays an additional column that contains the Process ID (PID).
-p Display data for a specific protocol (e.g., -p TCP). The Protocol can be one of the following: TCP, UDP, TCPv6, or UDPv6. If combined with the -s option, Protocol can be TCP, UDP, ICMP, IP, TCPv6, UDPv6, ICMPv6, or IPv6.
-r Check Windows routing table.
-s Displays detailed network statistics for each protocol (IPv4, IPv6, ICMPv4, ICMPv6, TCP, and UDP).
interval Sets Time interval (in seconds) to automatically update the output. See examples to learn more.

Examples: Using the netstat command

List all Active TCP connections:

netstat

Check open ports:

netstat -aon | findstr /i listening

Only want to see information about TCP protocol:

netstat -a -p tcp

Show network statistics:

netstat -s

Real-time network monitoring — In the following example, we set a 5 second time interval to check active network connections in real-time. The number 5 causes the command to repeat every five seconds (Press CTRL+C to quit).

netstat -n 5

If you need more information about the Windows netstat command, type netstat \? in the command prompt.

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Чем записать dmg на windows
  • Widcomm bluetooth software windows 10 на русском
  • Hklm software microsoft windows photo viewer capabilities fileassociations
  • Hashing algorithm for windows
  • Как отключить hp support assistant для windows 10