端口基本上用作您的计算机与互联网或网络中其他计算机之间的接口。(Port)Web 上的每次通信都使用这些端口进行交换,因此它们是整个 Internet 通信模型的重要组成部分。
每个 IP 地址共有 65,535 个端口,它要么是 UDP 端口,要么是 TCP 端口(a UDP port or a TCP port)。计算机中的开放端口是指配置为接受连接的端口,而拒绝连接的端口显然是封闭端口。
虽然开放端口是互联网通信所必需的,但如果侦听端口的服务具有错误的安全规则并且配置错误,它们可能会很危险。这种开放的端口很容易受到攻击。
在今天的这篇文章中,我们将学习如何检查您的机器上正在使用哪些端口,如何测试防火墙(Firewall)是否阻塞了某个端口(Port),以及如何检查哪些进程或服务正在使用开放端口。
检查Windows 10(Windows 10)中打开了哪些端口
打开Command Prompt,键入以下内容,然后按 Enter以查看与(Enter)进程标识符(Process Identifiers)(PID)一起使用的端口:
netstat -ano
这将显示您 PC 上的端口。它将在 5 列中显示详细信息-
- 协议,
- 本地地址,
- 国外地址,
- 州和
- PID(进程标识符)。
这里的端口号显示在Local Adress栏下,例如Local Adress是0.0.0.0:5040,这里的5040就是端口号。
在State选项卡下,您可以检查端口是否打开。
- LISTENING意味着它只是等待并准备好在客户端程序请求它时发送答案。当客户端连接到该端口并开始对话时,连接将打开。
- ESTABLISHED表示连接已经建立。
- TIME_WAIT表示它正在等待回复或连接。这通常发生在端口被激活但连接尚未连接时。成立
- CLOSE_WAIT表示连接的另一端已经关闭了连接。
这是您检查 Windows 10 中所有端口打开的方式。
您还可以通过运行以下命令查看使用的端口以及进程名称:(Process Names)
netstat -ab
阅读(Read):如何使用端口查询工具(PortQry.exe)(Port Query Tool (PortQry.exe))。
检查(Check)哪个进程或服务正在使用开放端口
现在,当我们知道系统中所有端口都打开时,我们还可以检查哪个服务正在使用哪个打开的端口。要检查这一点,请转到PID(进程 ID(Process ID))选项卡。
以我们在列表中的第一个开放端口为例,端口 135,它的PID为 1192。
现在通过Ctrl+Alt+Delete. 打开任务管理器。(Task Manager)转到“服务(Services)”选项卡并检查 PID 1192。
在“描述”(Description)选项卡下,您将看到哪个应用程序/程序正在使用该端口。如果要关闭该连接,请结束该特定任务。
或者,您也可以使用以下命令找到它:
takslist|findstr "1192"
这将显示使用所选端口的程序。
如果您正在寻找一种简单的方法,您还可以使用一些第三方软件来检查您的 Windows 10 中打开了哪些端口。网络上有很多这样的免费软件可以告诉您计算机正在连接的所有网站到您的 PC 中打开的所有端口。其中一种免费软件是CurrPorts。
阅读(Read):如何在 Windows 防火墙中阻止或打开端口(Block or Open a Port in Windows Firewall)。
如何测试防火墙(Firewall)是否阻塞端口
CurrPorts是一个简单且便携的免费软件,用于检查以 zip 文件形式提供的开放端口,无需花费时间即可在您的 PC 上下载。由于它是便携式软件,因此您无需安装它。只需(Simply)下载它,提取所有文件并运行它。确保根据您的机器配置下载正确的版本。
CurrPorts 是一款网络监控软件,可显示您 PC 的所有开放端口的完整列表。除了端口号及其状态(State)之外,该免费软件还显示有关使用开放端口的进程的详细信息、进程的完整路径、文件描述、产品名称、文件版本、创建日期和时间等等。
一旦你下载了 CurrPorts 并运行它,主要的概述就包含了一切。它在一个窗口中显示整个事物。您可以在单个窗口中检查所有当前打开的TCP和UDP端口以及使用该特定端口的程序。(UDP)检查下面的屏幕截图。您可以一次选择一个或多个进程,检查它们的端口并在它们似乎不需要时终止它们。它还允许您将端口信息保存到HTML/XML/Text文件。
此外,CurrPorts还允许您从同一窗口终止进程。只需(Simply)选择要终止的进程,右键单击并从下拉菜单中选择“终止选定端口的进程”。
使用CurrPorts(CurrPorts)的另一个好处是它标记了身份不明的应用程序拥有的可疑TCP/UDP端口。因此,您可以直接杀死它们并使您的 PC 免受可能的攻击。
当然,与上面提到的命令提示符(Command Prompt)选项相比,使用这个免费软件是一个更容易的选择。您可以从官方网站Nirsoft.net 下载该软件。(Nirsoft.net.) 请注意,对于 x64 版本的(Please)Windows,有一个单独的下载链接。此实用程序几乎适用于所有Windows版本。它是一个独立的可执行实用程序,因此不需要任何安装。
How to check what Ports are Open or Blocking in Windows 11/10
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 the 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. Open port in a computer refers to a port that is configured to accept the connections and a port which 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.
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-
- Protocols,
- Local Address,
- Foreign Address,
- State, and
- 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 is using 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.
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 doesn’t require any installation.