Windows Firewall: Block Access to the Internet, Inbound and Outbound Traffic
Tags: beginners, testing, tutorial, security
Published: 2022-01-16 20:36:31

In this article, we will explore how to block inbound and outbound traffic for an application with the help of Windows Firewall. This method of blocking access is the easiest and the most flexible at the same time.

Why would you need it? Blocking inbound traffic allows to disable unwanted software updates and annoying advertising or save your precious megabytes. Blocking outbound traffic can prevent leaks of confidential information. Blocking is also good if you want to secure your child from watching unwanted content or spending too much time playing online games.

We will have a look at how firewall works in Windows 10, but this method will also work in Windows 8 or 7.

## Create a Widows Firewall rule
To begin with, you should start the firewall extended interface. To do it, go to Control Panel, switch to large icons mode, and click on Windows Defender Firewall.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4dqrjhnr9d2te0e12zaa.jpg)

The firewall extended interface (which you can access by clicking on Advanced settings link on the left) has a lot of settings. Make all changes very attentively, and do exactly what this tutorial tells you. If you set certain things wrong, it will result in lots of problems in the work of your computer.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h8fmvn2bemg3won23ixx.jpg)

In the left navigation pane, select Outbound Rules. The system will show all rules created before – and don’t be surprised to see dozens of entries created by Windows.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t4r5i1kqnhx1pn28kobz.jpg)

In the right pane, click New Rule…

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/32fmcup02dusl9sw2yzh.jpg)

By default, you are suggested to create a rule for a program, so confirm your choice by clicking Next.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o497vxig661kjcjevnze.jpg)

The next step is to show the path to the executable file of the program to block it.

With the example of Opera browser, we’ll see how Internet connection can be blocked. You can either enter the path to the .exe file manually or use the Browse button.

If you choose the second option, the system will automatically replace a part of the path by the environment variable.

In our case, the file address is:

**C:\Users\User\AppData\Local\Programs\Opera**

An important note: For a number of reasons, environment variables may be determined incorrectly by the system. If you see that a blocking rule doesn’t work properly, edit the rule by pasting the full path to the file into the input field.

Another important note: In most cases, blocking the executable file of a program is enough to restrict its Internet access. However, this approach may not work with online games. For example, if you want to block access to Minecraft game servers, you should block the corresponding Java application (executable file Javaw.exe), as the game connects to the Internet via Java.

Confirm the choice of file by clicking Next.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tz399re7yds1wfbb6h7c.jpg)

At the next stage, confirm the choice Block the connection by clicking Next.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x8map2xmqj78n11o0wwo.jpg)

Your next step is to choose when the rule should apply (by default, all elements are checked). They determine if the rule applies depending whether the computer is connected to a network which you define as public or private.

An important note: If you choose Private and uncheck Public, it means that the program will have access to resources of the local network, but it will not have access to the Internet.

Let’s suppose you use a laptop at home (in a network you define as private), at work (in a domain network) and at a cafe (in a network you define as public). If you want the rule to apply at the cafe, at work and at home, select all the three options. If you want it to apply only in one of the three cases, select the corresponding option.

If you have doubts, just leave all blocking options enabled by default. Confirm the choice by clicking Next.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/idlo05ek291w49vg7snx.jpg)

The last step is to give this rule a name. Think about a name that makes sense so that you will be able to find it easily later. At this point, you can also describe this rule so you will be able to remember why you created it - after some time. Windows creates a lot of firewall rules automatically, and all of them have quite fancy names.

To make your rule stand out, name it Blocking Opera Browser. Close the wizard by clicking Finish.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3lww0n0792do5bmc2hi4.jpg)

Now there is a new item on the outbound rules list. You can double-click on it to edit it. For example, you can specify the users for whom this rule will apply or not, or decide that only a certain protocol should be blocked - TCP, or other.

##Test the block effectiveness
Blocking will start as soon as you create the rule so you don’t have to log off or restart. Start Opera and go to the website https://www.google.com, to make sure the connection is blocked.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/676lf1bdtclvqmhhrd1a.jpg)

If you need to disable the blocking, you will have to return to Windows Firewall advanced settings, left-click on the rule to select it and then disable or delete it. Use the corresponding items in the right pane of the Firewall to do it.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/033rkjfxvsvernp77y6s.jpg)