How to open or close firewall ports in Windows for added security?

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 application. The firewall is configured in such a way that it can control what kind of traffic enters and exits through your home network connection.

Knowing how to close or open firewall ports will allow you to protect your computer from possible attacks. Many of the ports are closed by default to protect users. However, opening or closing a particular port can increase the connection speed of a specific service.




How to open or close firewall ports

The simplest way to open or close doors in Windows is create rules in the firewall. Open Control Panel and then click on the System and Security option.

<a name=How to open or close firewall ports in Windows for added security?" src="/images/posts/207d06b221bef95a7f7acfe113278ae0-0.jpg">

Then select the Windows Defender Firewall option. Now access the Advanced Settings you found in the left panel of the application.

Create a rule on the firewall

In the window Windows Defender Firewall with Advanced Security there are the options for creating a new rule. You can create an inbound rule, an outbound rule or connection security rules, from the left panel.

Depending on your requirement, select by create a new inbound or outbound rule. The first thing you need to 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 the ones that control connections and ports.




Now select if the rule applies to TCP or UDP. Followed by this select the ports to which the rule applies. You can choose to apply only to multiple specific ports or select the All local ports option.

Select the action to take when applying the rule. You can allow the connection or allow it only if it is secure. Otherwise you can block the connection for the selected ports.

Then a select when to apply the rule. 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, enter the name of the rule and a brief description to detail what this rule does.

Click the Finish button and if everything has been configured correctly, the rule created in the list will appear along with a green icon if its function is to open a door. Otherwise the icon is red if you want to restrict a connection.


Open ports from command prompt

A quick way to enable or disable ports is via the commands in CMD. Open the command prompt, running the application as an administrator.


<a name=How to open or close firewall ports in Windows for added security?" src="/images/posts/207d06b221bef95a7f7acfe113278ae0-1.jpg">

Now in the CMD window you need to write the command Netstat -ano to see the list of all available ports and which PID is associated with them.


The list shows the available ports, the local address they use, if they use the TCP or UDP protocol, the remote address and the status. If you want to find a specific port, enter the netstat command -an | found: 5424 (replace 5424 with the port you wish to filter).

To free a port it is sufficient to know the associated PID and enter the command taskkill / pid 544/F, the value 544 is what you need to replace with what you need in the search.

add a comment of How to open or close firewall ports in Windows for added security?
Comment sent successfully! We will review it in the next few hours.