Keeping the PC safe is our priority to protect our information and that is why the firewall has an important role. Learning to use functions such as opening and closing the ports of the Windows firewall will allow you to have control of the type of traffic that enters and leaves through your connection .
The importance of the firewall for security
Ports are the input and output interface for information packets . There are ports that are assigned for a specific use or a particular application. The firewall is configured in such a way that it can control what type of traffic enters and leaves through your home network connection.
Knowing how to close or open the firewall ports will allow you to protect your computer from possible attacks. Many of the ports are closed by default to keep users safe. However, opening or closing a particular port can increase the connection speed of a specific service.
How to open or close firewall ports
The easiest way to open or close ports in Windows is by creating rules in the firewall. Open the Control Panel and then click on the System and Security option.
Then select the Windows Defender Firewall option . Now access the Advanced Settings found on the left panel of the application.
Create a rule on the firewall
In the Windows Defender Firewall with Advanced Security window are the options to create a new rule. You can create an inbound rule, an outbound rule, or connection security rules, from the left panel.
Depending on the requirement, select to create a new inbound or outbound rule . The first thing you must define is the type of rule you want to create, in this case we select the Port option, which allows you to control connections from a TCP or UDP port.
The term UDP is the initials of User Datagram Protocol or datagram and TCP is the data transmission protocol. Both protocols are what control connections and ports .
Now select if the rule applies for TCP or UDP. Followed by this, select the ports to which the rule applies . You can select that it applies only to several specific ports or select the All local ports option.
Select the action to be taken when applying the rule . You can allow the connection or only allow it if it is secure. Otherwise you can block the connection for the selected ports.
Then select when the rule should be applied . The available options are Domain, when the computer is connected to a corporate domain, Private with a private network connection, and finally Public when the computer is connected to a public network.
Finally, put the name of the rule and a brief description to detail what is the function that this rule has.
Click on the Finish button and if everything has been configured correctly, the rule created will appear in the list along with a green icon if its function is to open a port. Otherwise the icon is red if you want to restrict a connection.
Open ports from the Command Prompt
A quick way to enable or disable ports is through commands in CMD. Open the Command Prompt, running the application as administrator.
Now in the CMD window you must write the command Netstat -ano to see the list of all the ports that are available and what is the PID associated with them.
The list shows the ports that are available, the local address they use, whether they use the TCP or UDP protocol, remote address and the State. If you want to find a specific port, put the command netstat -ano | find: 5424 (replace 5424 with the port you want to filter).
To free a port it is only necessary to know the associated PID and place the command taskkill / pid 544 / F , the value 544 is the one that you must substitute for the one you need in the search.