Android Firewall Without Root: Control App Network Access
How to block per-app network access on Android without root using the VPN API, with a step-by-step NetGuard setup guide, app comparison table, and practical whitelist recommendations.
Marcus Fielding 1 juin 2026Android ships with no built-in per-app firewall. Every app you install can, by default, open network connections whenever it wants - sending telemetry, phoning home to ad networks, or syncing data you never asked for. On a rooted device you can use iptables or nftables rules directly, but most users are not willing to void their warranty or risk a bootloop. The good news is that Android’s VPN API provides a legitimate, root-free path to the same goal: intercept every packet at the OS level, inspect it per-app, and drop whatever you choose to block.
This guide walks through exactly how that mechanism works, how to set up NetGuard as your no-root firewall, and how to pair it with Android’s built-in per-app network controls for a genuinely hardened setup.
How VPN-Based Firewalls Work on Android
Android’s VpnService API (available since API level 14) allows any app to create a local TUN interface and route the device’s entire IP traffic through it - without any system permission beyond BIND_VPN_SERVICE. The traffic never leaves the device; the app simply decides per-packet what to forward, what to drop, and what to redirect.
A firewall like NetGuard uses this to implement per-UID (per-app) rules:
- The TUN interface captures all outbound packets.
- The firewall identifies the source UID for each connection by reading the kernel’s socket tables at
/proc/net/tcp,/proc/net/tcp6,/proc/net/udp, and/proc/net/udp6. - It checks the UID against your allow/block list.
- Allowed packets are forwarded through the real network stack; blocked packets are silently dropped.
Because this operates below the app layer, it catches all protocols - HTTP, HTTPS, UDP, QUIC - regardless of what networking library an app uses. It cannot be bypassed by any normal Play Store or sideloaded app on a locked bootloader.
The key limitation: Android allows only one active VPN connection at a time. A VPN-based firewall occupies that slot.
Choosing a No-Root Firewall App
Several apps use this mechanism. The comparison below focuses on apps with an open-source codebase or a strong, verifiable track record.
| App | License | F-Droid | Root required | Real VPN passthrough | Last active development |
|---|---|---|---|---|---|
| NetGuard | GPLv3 | Yes | No | Via upstream proxy (Pro) | Active (2024-2026) |
| AFWall+ | GPLv3 | Yes | Yes (iptables) | N/A | Active |
| InviZible Pro | GPLv3 | Yes | No | Tor/DNSCrypt built-in | Active |
| Rethink DNS + Firewall | GPLv3 | Yes | No | Upstream proxy | Active |
| TrackerControl | GPLv3 | Yes | No | No | Maintained |
For most users the choice is between NetGuard (mature, minimal, stable) and Rethink DNS + Firewall (newer, adds DNS-level blocking and a blocklist ecosystem). This guide uses NetGuard because it has the longest production track record and the cleanest permission model.
If you want a deeper look at pairing any of these with a real VPN provider, see our best Android VPN apps for 2026 roundup.
Setting Up NetGuard Step by Step
Installation
The cleanest installation path is through F-Droid, which builds NetGuard from source and publishes a reproducible build. The Google Play version is functionally identical for core features but includes the in-app purchase layer. For the complete verification process for sideloaded APKs, the sideloading security guide covers APK signature verification in detail.
- Install the F-Droid client from f-droid.org and verify its signing certificate.
- Search for “NetGuard” (package
eu.faircode.netguard) and install. - On first launch, grant the VPN connection permission when prompted - Android will show the standard VPN warning dialog.
Initial Configuration: Whitelist vs. Blacklist Mode
NetGuard supports two fundamental modes:
- Blacklist mode (default): All apps can access the network unless you explicitly block them. Lower friction, but you must actively manage each new app you install.
- Whitelist mode: All apps are blocked unless you explicitly allow them. More secure by default; recommended for privacy-focused setups.
To enable whitelist mode: open NetGuard > Settings > Defaults > uncheck “Allow Wi-Fi” and uncheck “Allow mobile data”. Every app now starts blocked. You then enable the apps that legitimately need internet access.
Per-App Rules
The main screen lists every installed app with two toggles: Wi-Fi and mobile data. A filled icon means traffic is allowed on that interface; an empty icon means blocked. This granularity is useful for:
- Allowing a navigation app to use mobile data but blocking it on Wi-Fi (or vice versa) to prevent background sync.
- Blocking a game’s mobile data to avoid surprise charges while letting it access Wi-Fi for updates.
- Completely cutting off any app that has no legitimate reason to phone home.
Tap an app name to open the per-app detail screen, where you can also see a live log of blocked connection attempts - useful for diagnosing notification or sync failures after you block something.
System Apps and Special UIDs
Android assigns some traffic to shared UIDs. Notably:
- Android system (UID 1000): Handles OS-level connections including NTP and connectivity checks. Blocking this causes the “no internet” icon to appear even when connectivity exists.
- Google Play Services (UID varies): Routes push notifications for most apps via FCM. Block this only if you understand the downstream effect on notifications.
NetGuard shows these special UIDs alongside regular apps. In whitelist mode, add them explicitly if you need their functionality.
Advanced Features Worth Enabling
DNS over HTTPS / DNS Filtering
NetGuard’s Pro features (available in the F-Droid build at no cost) include a built-in DNS filter. Navigate to Settings > Advanced options > “Filter traffic” to enable deep-packet inspection of DNS queries. You can then set a custom upstream DNS server such as https://dns.quad9.net/dns-query (Quad9) or https://cloudflare-dns.com/dns-query (Cloudflare 1.1.1.1 with malware blocking).
This adds a DNS-level blocking layer on top of per-app UID rules - useful for blocking known tracker domains even within apps you have allowed network access.
Logging and Auditing
Settings > Advanced options > “Log Android Traffic” creates a persistent log of every connection attempt, with timestamp, app name, destination IP/domain, and allow/block verdict. Export this log periodically to audit what your installed apps are actually contacting. Several users have discovered unexpected telemetry endpoints this way - for example, seemingly offline games attempting connections to ad network APIs.
Upstream Proxy for Real VPN Passthrough
If you need a real VPN simultaneously - for example a WireGuard tunnel to your home network - configure it as an upstream SOCKS5 proxy in NetGuard (Settings > Advanced > SOCKS5). NetGuard routes allowed traffic through the proxy, effectively chaining the firewall and VPN. This requires a VPN provider or self-hosted endpoint that exposes a SOCKS5 interface; many commercial providers including Mullvad support this.
Complementary Android-Native Controls
No-root firewalls layer on top of Android’s own network controls. Since Android 10, the system includes a per-app setting to restrict background data:
- Settings > Apps > [App name] > Mobile data and Wi-Fi > toggle “Background data” off.
This is enforced by the system independently of any VPN firewall, so it adds a second layer. Android 12 introduced further privacy controls (microphone/camera indicators); Android 14 added health and photo permission scopes. None of these are network controls, but they complement a firewall by reducing the data apps can collect in the first place.
For a complete hardening checklist that covers permissions, DNS, lock screen, and browser choices alongside firewall setup, the Android privacy hardening checklist covers the full surface area.
Users running GrapheneOS or LineageOS also get per-app Network permission toggles at the OS level (Settings > Apps > [App] > Permissions > Network), which block an app’s network access in the kernel regardless of any VPN state. This is stronger than a VPN-based firewall because it cannot be worked around by the app under any circumstances. See the GrapheneOS vs. LineageOS comparison for a detailed breakdown of how these custom ROM features compare.
Practical Block List Recommendations
A sensible starting configuration for whitelist mode looks like this:
| App category | Wi-Fi | Mobile data | Notes |
|---|---|---|---|
| Browser | Allow | Allow | Primary use case |
| Email client | Allow | Allow | Sync needed |
| Maps / navigation | Allow | Allow (or block) | Background location risky on mobile |
| Games | Block | Block | Most have no legitimate network need if offline |
| Utility / flashlight / scanner | Block | Block | No network need; telemetry risk |
| Google Play Services | Allow | Allow | Required for FCM push notifications |
| Play Store | Allow | Block | Updates on Wi-Fi only |
| Social media | Allow | Block | Prevent background mobile sync |
| VPN client | Allow | Allow | If using alongside SOCKS5 proxy |
Start restrictive and open up as you identify broken functionality. The NetGuard log will show you exactly which blocked domain or IP caused a failure.
Known Limitations
A VPN-based firewall has a few boundaries worth understanding before you rely on it:
- Always-on VPN conflicts: Android’s “Always-on VPN” feature (Settings > Network > VPN) can be set to block connections if the VPN drops. If you enable this for a real VPN, it conflicts with NetGuard holding the VPN slot. Choose one or use the SOCKS5 proxy approach.
- IPv6 leaks on older ROMs: NetGuard handles IPv6, but some third-party ROMs have inconsistent VPN API implementations. Verify by checking
ip -6 routevia ADB while the firewall is active. - Work profile traffic: Apps in an Android work profile (managed by a separate UID namespace) may not be visible to a firewall running in the personal profile. If you use a work profile for sandboxing, verify coverage.
- System-signed app bypass: Apps installed as system-privileged APKs and signed with the platform key can call
requestNetwork()excluding the VPN transport, bypassing VPN routing entirely. This is only relevant on custom ROM builds that sign third-party apps with the platform certificate.
A no-root firewall is a meaningful privacy and security control, not a perfect sandbox. Pair it with other layers - a reputable DNS resolver, minimal app installation, and regular permission audits - for a genuinely robust posture.
FAQ
- Does a VPN-based firewall on Android encrypt my traffic?
- No. A local VPN firewall like NetGuard creates a TUN interface that never leaves the device. It intercepts packets solely to apply allow/block rules, not to encrypt or tunnel them to an external server. If you want encryption, you need a real VPN provider configured as an upstream SOCKS5 proxy through NetGuard, or run alongside it using a separate WireGuard or OpenVPN connection.
- Can I run NetGuard and a real VPN at the same time?
- Not directly, because Android allows only one active VPN slot. The workaround is to configure your VPN provider as a SOCKS5 upstream proxy inside NetGuard (Settings > Advanced > SOCKS5). NetGuard holds the VPN slot and forwards allowed traffic through the SOCKS5 proxy. Mullvad and several other providers expose a SOCKS5 interface on localhost when their client is running.
- Will blocking Google Play Services break push notifications?
- Yes, for most apps. Google Play Services handles Firebase Cloud Messaging (FCM), which is the push notification channel for the majority of Android apps. If you block it in whitelist mode, notifications from Gmail, messaging apps, and anything using FCM will stop arriving. Block it only if you are running a de-Googled ROM with a push alternative like UnifiedPush.
- Is NetGuard safe to download from the Play Store, or should I use F-Droid?
- Both versions are safe, but F-Droid is preferable for two reasons. First, the F-Droid build is compiled from source and has a reproducible build, so you can verify it matches the public code. Second, the F-Droid version unlocks all Pro features (DNS filtering, traffic logging) at no cost, since NetGuard is open source and the Play Store IAP layer is absent. Verify the F-Droid client itself against the signing certificate published at f-droid.org before installing.