TL;DR
This guide shows you how to block all internet access on a computer except for specific applications and websites. We’ll use the Windows Firewall with Advanced Security, creating rules to allow only what you need and deny everything else.
Steps
- Understand the Approach
- Allow Rules: These let specific applications access the internet.
- Block Rule: This blocks all other traffic. It’s important this is created after your allow rules, so it doesn’t prevent them from working.
- Open Windows Firewall with Advanced Security
- Search for “Windows Firewall” in the Start menu and select “Windows Firewall with Advanced Security”.
- Run
wf.mscfrom the Run dialog (press Windows key + R). - Create Allow Rules for Applications
- In the left pane, click “Outbound Rules”.
- In the right pane, click “New Rule…”.
- Select “Program” and click “Next”.
- Choose “This program path:” and browse to the application’s .exe file. Click “Next”.
- Select “Allow the connection” and click “Next”.
- Check all three profiles (Domain, Private, Public) – this ensures the rule applies in any network setting. Click “Next”.
- Give the rule a descriptive name (e.g., “Allow Chrome”) and click “Finish”.
- Create Allow Rules for Domains
- Open PowerShell as an Administrator (right-click Start menu and select “Windows PowerShell (Admin)”).
- Use the
Resolve-DnsNamecommand to get the IP addresses for your domain. For example, to find IPs for google.com:Resolve-DnsName google.com - For each IP address returned, create a firewall rule allowing outbound traffic on port 80 (HTTP) and port 443 (HTTPS). Replace [IP Address] with the actual IP address:
New-NetFirewallRule -DisplayName "Allow Google.com HTTP" -Direction Outbound -RemoteAddress [IP Address] -Protocol TCP -Port 80 -Action AllowNew-NetFirewallRule -DisplayName "Allow Google.com HTTPS" -Direction Outbound -RemoteAddress [IP Address] -Protocol TCP -Port 443 -Action Allow - Create the Block Rule
- In Windows Firewall with Advanced Security, click “Outbound Rules”.
- Click “New Rule…”.
- Select “Custom” and click “Next”.
- On the Program page, select “All programs” and click “Next”.
- On the Protocol and Ports page, leave all options at their defaults (Any protocol, Any port) and click “Next”.
- On the Scope page, leave all options at their defaults (Any IP address) and click “Next”.
- Select “Block the connection” and click “Next”.
- Check all three profiles (Domain, Private, Public). Click “Next”.
- Give the rule a descriptive name (e.g., “Block All Other Outbound Traffic”) and click “Finish”.
- Test Your Rules
- Verify that allowed applications can access the internet.
- Try to access websites not on your allowlist – they should be blocked.
- If something isn’t working, double-check your rule settings and ensure the block rule is at the bottom of the list (rules are processed in order).
We’re going to create two types of firewall rules:
There are a few ways to do this:
For each application you want to allow internet access, follow these steps:
Repeat these steps for each application.
This is more complex, as Windows Firewall doesn’t directly allow domains. We’ll use PowerShell to create rules based on IP addresses associated with the domain. Note: Domain IPs can change, so these rules may need updating periodically.
Repeat these steps for each domain you want to allow, and for all IP addresses returned by Resolve-DnsName.
This rule blocks all other outbound traffic:
After creating all rules:

