Tuesday, October 25, 2011

How to open/close ports in Windows 7 Firewall

Hello friends. Moving on to the second post of Windows firewall series. Here I will discuss how  to open or close a port/service on windows firewall. This is an important thing to know as it can be helpful for you to take charge of your firewall and build your own trusted list of communicating softwares.

Every software wants to be firewall-free hence it sets itself as a trusted software during installation. This is the reason why we can easily run Crome browser and the Firewall wont prompt even once. But if you try to run an FTP server then the firewall will intrrupt the connection. If you have missed the first part of this series then you can visit here.
If you want to know more basics about firewalls then you can download this PDF.

Before I begin there are two important definitions that I will like to share.

Inbound rules explicitly allow, or explicitly block, traffic that matches the criteria in the rule. For example, you can configure a rule to explicitly allow traffic secured by IPsec for Remote Desktop through the firewall, but block the same traffic if it is not secured by IPsec.
Outbound rules are rules that explicitly allow, or explicitly deny, traffic originating from the computer that matches the criteria in the rule. For example, you can configure a rule to explicitly block outbound traffic to a computer through the firewall, but allow the same traffic for other computers.

Let us see how we can open ports on windows firewall.

Step 1 - Go to control pannel, Click on windoews firewall. Click on Advanced settings.
Step 2 - On the left side you will see two options , Inbound rules and outbound rules.
Step 3 - In order to open a port, Right click on Inbound rules and create new rule.

Step 4 - Select "Port" and click next.

Step 5 - Now Choose the port type as either TCp or UDP and choose a port number. In this example I have chosen UDP and port number 12345.

Step 6 - Now choose connectivity type. It is recommended that you select all three options so that the port appears open even when you are not connected to any public network.

Step 7 - Now give a name to your rule. Click next to finish the process. You will notice that your newely created rule is now added in the rule list.

Step 8 - So your port is now open to receive connections. Right click on the rule and clicking on Delete will delete the rule and thus close the port.

But what to do after the port is open. Let us try to run a service over it. (all multiplayer game lovers pay attention).

Step 9 - Suppose you want to run a service on the port you just opened then the process is simple. Right click on the newely created rule, click on properties, then go to "Programs and services" tab.

Step 10 - You will have an option to add a service to the perticular open port. Suppose I want to run Netcat service over the port. So i choose the netcat executable here.

Bingo!! My Netcat service is up and running on my custom port. This can be an effective technique for setting up VPN's and Multiplayer game servers.

There is another important thing that security professionals will find helpful is viewing the firewall log file. It is an asset to determine network activities.
To view and configure firewall log file, open firewall, click on advanced settings, choose "monitoring".

In the middle pane you will find an option of "logging" .
You can find your firewall log file and also other configurations there.

Hope this post has solved some of your queries, if not then it must have helped you dig deeper into firewalls. Always be aware while making changes in the firewall settings.
If you have any problems or suggestions then please add comments below.



  1. Thank you Abhinav.. Nice post..
    Plz write more on this type of topics.


  2. Our services to Get instance Help , if you have facing any problem about windows 7 ,then please go through this Url its help you.
    windows firewall error 1068 windows 7
    Thank you
    Aalia lyon