When connected to the Internet, the operating system allocates ports to the programs working with the network, through which data is received and sent. The port can be open or closed. Sometimes the user needs to check the status of the ports.
Instructions
Step 1
When they say about a port that it is open, it means that some program is currently using it. More than 65 thousand ports can be used to connect to the network. Ports that are not currently in use are closed. That is why it is impossible to look at closed ports as such; when analyzing network connections, they look at open ports.
Step 2
How do I see which ports on my computer are open? To do this, open the command line (console): "Start" - "All programs" - "Accessories" - "Command line". In the appeared black window (its appearance can be customized) enter the command netstat –aon and press Enter. A list of current network connections will appear. The first column shows the type of network protocol - TCP or UDP, in the second you will see local addresses.
Step 3
Pay attention to the numbers in the lines of the local address after the colon, these are the numbers of ports open on your computer. How do you know which programs are opening them? To do this, pay attention to the last column - PID. This is the process ID. Knowing it, you can always find out the name of the process to which it belongs. To do this, in the same console window, type the tasklist command. A list of processes running on the computer will appear. In the second column, find the identifier you are interested in, to the left of it there will be the process name.
Step 4
There are situations when you need to forcibly open a port in the firewall - that is, make it open for connection. If we are talking about the standard Windows firewall, then it is quite possible to work with it through the console. So, to open a port, just type the command netsh firewall add portopening TCP 45678 system in the console and press Enter. In this example, port 45678 will be opened via TCP.
Step 5
To close an open port, enter the command netsh firewall delete portopening TCP 45678 in the console. This example closes a previously opened port. You can view your firewall settings by entering etsh firewall show config in the console.
Step 6
Is it possible to forcefully close a specific port by means of a firewall, that is, generally prohibit programs from opening it? You can, but it doesn't make any sense. High-quality Trojans randomly choose the port they open, so it is impossible to guess which port should be closed in order to protect against a particular Trojan.
Step 7
It is also impossible to close all the "extra" ports, since when working on the Internet, the browser uses not only the 80th port, but others as well. Therefore, firstly, you should configure the list of trusted applications, and secondly, watch the list of connections in the console if there is suspicious network activity on your computer. It is also useful to enable connection logging in the firewall settings.