Windows Firewall and VPN: Safe Configuration Tips
How to keep Windows Defender Firewall switched on and still let your VPN work: profiles, prompts, narrow rules, sharing settings and a safe troubleshooting routine.
10 min readUpdated Oct 15, 2026By XPASS Editorial Team

A firewall and a VPN are two different safeguards that sit in the same place on your PC, and they can get in each other's way. The firewall decides which connections may enter or leave your computer. The VPN wraps your traffic in an encrypted tunnel to another network. When the two disagree, you see symptoms such as a VPN that never connects, a printer that disappears, or a prompt that appears every time you start the app. The tempting fix, switching the firewall off, is the worst one. This guide explains how to configure Windows Defender Firewall so your VPN works, with a focus on the safe choices: the right network profile, careful rules, sharing settings and a troubleshooting routine that never turns protection off. For the conceptual difference between the tools, VPN vs antivirus vs firewall is a good companion.
Who does what on a Windows PC
Windows Defender Firewall is a host firewall. It inspects traffic at the computer itself, which means it sees both the physical adapter (Wi-Fi or Ethernet) and the VPN's virtual adapter. By default, it allows outbound connections and blocks unsolicited inbound ones unless an allow rule exists.
That default is helpful for VPN clients. A VPN app opens the connection outward to its server, so it usually works without any custom rule. Problems appear in four situations.
- The first-run prompt was dismissed, so the program is silently blocked.
- A stricter rule set was applied, for example by a security suite or a work policy, that blocks outbound traffic by default.
- The VPN adapter was classified under a different network profile than you expect, which changes what is allowed.
- You added rules from a web tip that opened more than you realised.
Keep this picture in mind: the firewall controls who may talk to the machine, the VPN controls where the traffic goes after it leaves. They are complementary, which is why the aim is to make them agree, not to pick one.

Network profiles and why the VPN adapter matters
Windows sorts every network connection into a profile and applies a different set of rules to each.
| Profile | Meant for | Typical behaviour |
|---|---|---|
| Domain | Company networks joined to a domain | Set by the organisation's policy |
| Private | Home or other trusted network | More discovery and sharing allowed |
| Public | Cafes, hotels, airports, any unknown network | Most inbound traffic blocked, discovery off |
When a new adapter appears, Windows may classify it as Public, as Private if you click yes on a prompt, or leave it as unidentified. A VPN adds a virtual adapter, and its category can differ from your Wi-Fi's. That matters because file sharing and device discovery follow the profile.
To see how Windows currently sees your connections, open PowerShell and run:
Get-NetConnectionProfile
Read the InterfaceAlias and NetworkCategory columns. Safer defaults:
- Treat shared and public Wi-Fi, and the VPN adapter, as Public.
- Use Private only for a home or office network you trust and control.
- If a connection is set to Private in a cafe because you once clicked yes, change it back with
Set-NetConnectionProfile -InterfaceAlias "Wi-Fi" -NetworkCategory Public.
Public is the stricter choice. If a local printer or file share stops working on a trusted home network, switching that network to Private is the right fix, not loosening rules on a public one. The FTC's guidance on public Wi-Fi networks explains why unknown networks deserve the stricter treatment.
First-run prompts: answer them on purpose
The first time a program tries to accept or open certain connections, Windows shows a window titled something like "Windows Defender Firewall has blocked some features of this app". It offers two tick boxes, usually Private networks and Public networks, and an Allow access button. Wording varies by version.
How to answer for a VPN app:
- Read the program name and path in the prompt. Make sure it is the app you just installed and that the path points to the folder you expect.
- Tick the profile you actually use. If you use the VPN at home and in cafes, you need both boxes. Tick only Private if you use it only at home.
- Click Allow access. Cancel blocks the program, and Windows remembers that decision.
- Do not tick Domain unless you are on a company network that requires it.
If you pressed Cancel or the prompt never appeared:
- Open Windows Security, then Firewall and network protection, then Allow an app through firewall.
- Click Change settings, find the VPN app in the list, and tick the profile boxes you need.
- If the app is not listed, choose Allow another app, browse to its executable and add it.
- Reconnect the VPN.
Always add the app by its own executable. Never add a rule that allows "all programs" or a broad folder like the whole Program Files.
Check what the firewall is actually doing
Guessing wastes hours. Windows can show you.
- See the status of each profile. Run
Get-NetFirewallProfile | Select-Object Name, Enabled, DefaultInboundAction, DefaultOutboundAction. A normal default is inbound Block and outbound Allow. If outbound shows Block, someone changed the stance, and a VPN client will need a rule. - Open the rule list. Press Windows key plus R, type
wf.msc, press Enter. The Windows Defender Firewall with Advanced Security console lists inbound and outbound rules. Search by the program name. - Turn on dropped-packet logging. In wf.msc, right-click Windows Defender Firewall with Advanced Security, then Properties, the profile tab, Logging Customize, and set "Log dropped packets" to Yes. By default the log file is
pfirewall.logunder the Windows system32 LogFiles Firewall folder. - Reproduce the problem. Try connecting the VPN once and open the log. Look for DROP lines with the time of your attempt and the address of the VPN's server. The line shows the action, protocol, source and destination.
- Fix only what the log shows. If a DROP appears for your VPN program, create or correct the rule for that program. If no DROP appears, the firewall is probably not your problem.
Turn the logging back off when you are finished, because the file grows. The result is evidence instead of guesswork.
Rules that are safe, and rules that are not
Adding rules is where most damage happens. A tip that says "allow all inbound on every port" fixes the symptom by removing the protection.
| Do | Do not |
|---|---|
| Allow one named program, on the profiles you need | Allow "any program" for any port |
| Scope a rule to a specific remote address when you know it | Open a rule to every address "just to test" |
| Keep outbound Allow as default for consumer PCs | Switch outbound to Block without time to build rules |
| Delete rules for software you uninstalled | Leave stale allow rules for programs that no longer exist |
| Export rules before large changes | Edit rules from memory with no backup |
| Keep Remote Desktop and file sharing closed on Public | Expose Remote Desktop (port 3389) or file sharing (port 445) to the VPN or the internet for convenience |
Inbound access over a VPN deserves special care. If you read about reaching a home PC from outside, keep in mind that opening a service to the network increases the risk. VPN port forwarding explains the trade-offs in detail. In general, prefer the least access that does the job, and remove it when the job ends.
To remove a leftover rule from the command line: Remove-NetFirewallRule -DisplayName "Name of rule". Do it carefully, because the command removes any rule that matches the name.
Sharing and discovery on the VPN and on Wi-Fi
The firewall is not the only thing that exposes your PC on a network. File and printer sharing and network discovery are settings, and they follow the profile.
- Open Settings, Network and internet, Advanced network settings, Advanced sharing settings (Windows 11) or the equivalent in Network and Sharing Center (Windows 10).
- For the Public profile, set network discovery off and file and printer sharing off.
- For the Private profile, switch them on only if you need them at home.
- Keep password-protected sharing on.
Why this matters with a VPN: a tunnel changes your address and path, but it does not stop other devices on the same virtual network from reaching a share that you left open. Using a VPN on a hotel network with sharing enabled is a bad combination. Close the door first.
If your printer vanishes when the VPN connects, the cause is routing, not the firewall. The routing problem is explained in what split tunneling is. Do not weaken a firewall rule to fix a routing problem.

Third-party security suites and the double firewall problem
Many PCs run a security suite that includes its own firewall. When that happens, Windows Defender Firewall may be turned off, or set to defer to the other product. The risk is not that two firewalls are better than one; it is that confusion about which one is in charge produces rules in the wrong place.
- Find out which product manages the firewall. In Windows Security, open Firewall and network protection. It tells you if another provider is active.
- Make the VPN app's allow rule in the product that is in charge. A rule in Windows Firewall does nothing if another firewall is making the decisions.
- Some suites include web protection that inspects encrypted traffic. If a VPN app will not connect only while that feature is on, look for an exception for the app in the suite's settings rather than disabling the protection altogether.
- Do not run two active firewalls. If you install a new suite, check that Windows has deferred to it, and that you are not left with neither active.
When the symptoms are Windows connection errors such as 809 or 691, the fix common Windows VPN errors guide covers the codes and the checks in order.
A troubleshooting routine that never turns protection off
When the VPN will not connect and you suspect the firewall, follow this order.
- Confirm it is not simpler. Check the internet connection, the username and password on My Pass, and that the pass is active. The VPN not connecting guide covers those basics first.
- Check the profile. Run
Get-NetConnectionProfile. Confirm the network is as you expect. - Check the program rule. In Allow an app through firewall, confirm the VPN app is ticked for the profile in use.
- Read the log. Enable dropped-packet logging, attempt to connect, and read the DROP lines.
- Restore a clean state if needed. If the rules are a mess, export them first with
netsh advfirewall export "C:\Temp\firewall-backup.wfw", then reset withnetsh advfirewall reset. This restores Windows defaults and removes every custom rule, so you may need to re-add rules for other programs. A work PC should not be reset without IT approval. - Re-add only what you need. Open the VPN app, answer the prompt carefully, and reconnect.
- If it still fails, stop and ask. Keep the log lines and ask support instead of disabling protection.
The Microsoft guide to connecting to a VPN in Windows is worth keeping handy, and the download page links the official installer if a clean reinstall is the next step.
Three scenarios, common mistakes and limits
The student who clicked Cancel. Kim installed the VPN app and dismissed the firewall prompt. The app opened but never connected. She did not need to reinstall: she opened Allow an app through firewall, ticked the Private and Public boxes next to the app and reconnected.
The remote worker on cafe Wi-Fi. Ravi's laptop had labelled the cafe network as Private from an earlier day, so network discovery was on. He set the connection back to Public and turned discovery off, then connected the VPN. No other device on the cafe network could see his shares.
The family PC after a security suite. A new suite took over the firewall. The VPN app stopped connecting. The Windows Firewall rule was fine, but the suite was making the decisions. Adding an exception in the suite fixed it.
Common mistakes:
- Turning off the firewall to test and forgetting to turn it on again.
- Ticking both profiles for every program by habit.
- Allowing a whole folder instead of a single program.
- Leaving Remote Desktop open on the VPN adapter.
- Copying a script from a forum that you do not understand.
- Resetting a managed work PC without telling IT.
Limits: a firewall cannot see inside encrypted traffic, a VPN does not replace it, and neither one stops phishing, weak passwords or malware you run yourself. The firewall rules described here also depend on your Windows build, so wording and menu names may differ. NIST's guide to VPNs is a deeper reference if you manage this for a team.
Summary
For windows vpn firewall setups, keep Windows Defender Firewall on, treat shared and VPN networks as Public, answer first-run prompts deliberately and allow the VPN app by its own executable only. Check status and the dropped-packet log before changing anything, avoid broad rules, keep sharing closed on public networks, make sure only one firewall is in charge, and use export and reset as a last resort rather than switching protection off.
If a simple prepaid pass fits the way you work, the pricing page shows what is available.
Frequently asked questions
Should I turn off Windows Firewall to make my VPN work?
No. Turning the firewall off removes protection for every network you use, and it rarely turns out to be the real cause. Review the firewall log and the app's rule instead, and change only the specific rule that blocks the connection.
Which network profile should my VPN connection use?
Treat the VPN adapter and any shared or public Wi-Fi as Public. Use Private only for a home network you trust. The Public profile blocks most unsolicited inbound traffic and turns off network discovery.
I clicked Cancel on the firewall prompt. How do I fix it?
Open Windows Security, Firewall and network protection, then Allow an app through firewall. Find the VPN app, change settings, tick the profile you need and save. If the app is not listed, add it by its executable path.
Do I need an inbound rule for my VPN app?
Usually not. A VPN client starts the connection outwards, and Windows Firewall allows outbound traffic by default. Inbound rules are only needed for services that must accept connections, and those deserve extra care.
Can I run a third-party security suite and Windows Firewall together?
Usually only one should manage the firewall. If a security suite takes over, Windows Firewall may be switched off or set to defer. Check which product is in charge before you troubleshoot, and keep its rules and the VPN app's rules consistent.
References
About the author

Bob Kanokphon Thongdee
- Founder of XPASS VPN
- Co-founder of eSIMonline.asia
- More than 7 years in online marketing
- Founder of Cojourney Visa and Cojourney Travel
Need a VPN for a short trip or a busy month?
XPASS sells prepaid passes for a set number of days. You pay once and nothing renews automatically.
See passesKeep reading

VPN Security
VPN vs Antivirus vs Firewall: Do You Need All Three?
A VPN, antivirus software and a firewall solve three different problems. Here is what each one does, what it cannot do, and how they fit together.
9 min read

Troubleshooting
How to Fix Common Windows VPN Errors (809, 789, 691)
A step-by-step guide to the most common Windows VPN error codes: what they mean, the usual cause of each and the safest fix to try first.
7 min read

Troubleshooting
VPN Not Connecting? Step-by-Step Fixes
A clear order of checks for when the VPN will not connect: pass status, login details, Wi-Fi and mobile data, permissions, firewalls, app conflicts and error messages.
8 min read

VPN Security
VPN Port Forwarding Explained: Uses and Risks
Port forwarding lets outside connections reach a device on a private network. This guide explains how it works with and without a VPN, what it is used for and what an open port can put at risk.
9 min read

Device Guides
How to Set Up a VPN on Windows
Step by step: download VPNclient for Windows, install it, answer the Windows security prompts, sign in with your My Pass details and connect.
7 min read