• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[APP][6.0+] NetGuard - No-root firewall

What are you mainly using NetGuard for?

  • Reducing data usage

    Votes: 447 30.8%
  • Saving battery

    Votes: 311 21.4%
  • Increasing privacy

    Votes: 795 54.8%
  • Blocking ads

    Votes: 936 64.5%

  • Total voters
    1,452
Search This thread

WongKit

Senior Member
Jan 3, 2010
75
24
wantastisch.de
If the app is programmed to connect to a remote server at launch and has no fallback solution it may hang and doesn't work as intended.
I thought so too, but both apps work fine when the phone has no data connection and NetGuard filtering is disabled. This is a state where both apps also can't connect to anything.

On the other hand, if I block wifi and mobile through NetGuard while the phone is connected, everything works fine as well.

It is only the offline scenario with filtering that causes issues.
 

M66B

Recognized Developer
Aug 1, 2010
25,124
52,620
If the app is programmed to connect to a remote server at launch and has no fallback solution it may hang and doesn't work as intended.
Yes, it could, but that's more a problem of the app than of NetGuard. It would happen too when there is no working internet connection, for example connected to a wifi router while the public network isn't working.
 

WongKit

Senior Member
Jan 3, 2010
75
24
wantastisch.de
Yes, it could, but that's more a problem of the app than of NetGuard. It would happen too when there is no working internet connection, for example connected to a wifi router while the public network isn't working.
I just tested it. I connected the phone to a wifi with no internet.

With filtering enabled, Sygic does not launch. With filtering disabled, the app launches. I am aware, that the issue is partially on the site of Sygic / HERE, but it is also clearly influenced by NetGuard.

I do not understand what the difference is between "no internet" and "no internet with filtering enabled".
 

M66B

Recognized Developer
Aug 1, 2010
25,124
52,620
I just tested it. I connected the phone to a wifi with no internet.

With filtering enabled, Sygic does not launch. With filtering disabled, the app launches. I am aware, that the issue is partially on the site of Sygic / HERE, but it is also clearly influenced by NetGuard.

I do not understand what the difference is between "no internet" and "no internet with filtering enabled".
Does it matter? For the app it is as if there is no response, and it should handle this appropriately.
 

ouzowtf

Senior Member
Sep 8, 2010
867
678
Yes, it could, but that's more a problem of the app than of NetGuard. It would happen too when there is no working internet connection, for example connected to a wifi router while the public network isn't working.
That's what I wanted to say, that Netguard is not the problem.

Maybe sygic just checks for internet connection via system and does not handle if specific pages can't be reached. One could try with a different DNS answer code in Netguard.
 

WongKit

Senior Member
Jan 3, 2010
75
24
wantastisch.de
Does it matter? For the app it is as if there is no response, and it should handle this appropriately.
It should not matter, but the apps somewhat react different with NetGuard. It is the same for HERE WeGo.

That's what I wanted to say, that Netguard is not the problem.

Maybe sygic just checks for internet connection via system and does not handle if specific pages can't be reached. One could try with a different DNS answer code in Netguard.
What would be a suitable DNS response code I could try? Or could this be the issue, that NetGuard should not reply with any dns response when there is no network?

//EDIT: Tested DNS response 0 and 2 without any different effect
 
Last edited:

folusmile

Senior Member
Nov 4, 2010
828
232
I still don't understand, some app in lockdown access internet and sent me a notification..like Twitter and Facebook
 

WongKit

Senior Member
Jan 3, 2010
75
24
wantastisch.de
@M66B Do you consider checking this case or is it still the fault of all other apps?

Testing different DNS responses (0,2,3,5) did not solve the app freezing. I also tested it on an Android 11 phone and another (Unity based) app.
- Its integrated update check (plain HTTP call) runs into some form of timeout after around 15 seconds. If filtering is disabled, it instantly knows, that there is no connection
- It freezes completely for ~15 seconds when trying to establish an UDP connection. Also only if filtering is enabled.

This behavior only appears, when there is no network connection available on the phone. If I would need to guess, I assume, that NetGuard holds the network connection back until it can do its DNS lookup. As there is no network available, it times out when doing so, leaving all apps waiting for every connection attempt.
 

M66B

Recognized Developer
Aug 1, 2010
25,124
52,620
@M66B Do you consider checking this case or is it still the fault of all other apps?

Testing different DNS responses (0,2,3,5) did not solve the app freezing. I also tested it on an Android 11 phone and another (Unity based) app.
- Its integrated update check (plain HTTP call) runs into some form of timeout after around 15 seconds. If filtering is disabled, it instantly knows, that there is no connection
- It freezes completely for ~15 seconds when trying to establish an UDP connection. Also only if filtering is enabled.

This behavior only appears, when there is no network connection available on the phone. If I would need to guess, I assume, that NetGuard holds the network connection back until it can do its DNS lookup. As there is no network available, it times out when doing so, leaving all apps waiting for every connection attempt.
There is not much to check. Please try to disable ad blocking.
 

WongKit

Senior Member
Jan 3, 2010
75
24
wantastisch.de
Ok then. I hoped it would be possible to automatically disable filtering, if the device is offline. If there is no network, there is nothing to filter.

Anyway, thanks for your time.
 

La_Globule

Senior Member
Nov 6, 2007
428
157
Hello Marcel,
Sorry to bother you with that but I'm experiencing a problem where NG firewall stops working without any reason. When it occurs, blocked apps get Internet access although they shouldn't. There is no message neither notification.
This problem occured many times before I decided to signal it.
I'm suspecting the configuration change (Wi-Fi to mobile data) event because it seems to occur at this moment.
I'm running the latest version (2.298) and Android 11.
What can be done? Do you need logs to investigate?
Thanks for your help.
 

M66B

Recognized Developer
Aug 1, 2010
25,124
52,620
Hello Marcel,
Sorry to bother you with that but I'm experiencing a problem where NG firewall stops working without any reason. When it occurs, blocked apps get Internet access although they shouldn't. There is no message neither notification.
This problem occured many times before I decided to signal it.
I'm suspecting the configuration change (Wi-Fi to mobile data) event because it seems to occur at this moment.
I'm running the latest version (2.298) and Android 11.
What can be done? Do you need logs to investigate?
Thanks for your help.
The app won't stop itself, but Android might, so:
  • Please make sure battery optimizations are disabled for the app
  • Take a look here:
 

La_Globule

Senior Member
Nov 6, 2007
428
157
Thanks for your reply.
I have double checked: battery optimization is Off for NG (as for FE).
But I didn't say that NG stopped, it stopped blocking apps.
The problem occurred again this evening when coming back home and switching from 3G/4G/5G to Wi-Fi.
I'm pretty sure that it is related to connectivity switches.
Don't you think that there might be a problem in managing those transitions?
BTW, why the seamless handover option has disappeared?
Couldn't the problem be there?
How to have it back?
 

M66B

Recognized Developer
Aug 1, 2010
25,124
52,620
Thanks for your reply.
I have double checked: battery optimization is Off for NG (as for FE).
But I didn't say that NG stopped, it stopped blocking apps.
The problem occurred again this evening when coming back home and switching from 3G/4G/5G to Wi-Fi.
I'm pretty sure that it is related to connectivity switches.
Don't you think that there might be a problem in managing those transitions?
BTW, why the seamless handover option has disappeared?
Couldn't the problem be there?
How to have it back?
Did you follow the advice in this FAQ and did you enable the Android always-on VPN?

https://github.com/M66B/NetGuard/blob/master/FAQ.md#user-content-faq1
 

La_Globule

Senior Member
Nov 6, 2007
428
157
Ok, I've read the FAQ about the Seamless VPN Handover option, thanks.
And yes, VPN always on is activated.
So NG is well still running but let pass all the flow...
 

Top Liked Posts

  • There are no posts matching your filters.
  • 7
    Version 2.300 is available on Bitbucket now.

    Download:
    https://bitbucket.org/M66B/netguard-test/downloads/NetGuard-v2.300-release.apk

    There will be no update notification for this preview release.

    Changelog:
    • Improved Android 12 compatibility
    • Removed subscriptions (due to new Play store policies)
    • Updated builds tools and translations
    All changes:

    https://github.com/M66B/NetGuard/compare/2.299...2.300?w=1
    2
    Hi Marcel,

    I understand that NetGuard is no more available on GitHub but on Bitbucket.

    Is this new version 2.300 a stable or beta version ? It's not indicated when trying downloading it.
    The Bitbucket version is a preview version. It will be made available on GitHub later.
    2
    Hi there,

    first of all a big thanks @M66B for Netguard. I almost immediately bought the premium version after I got my new phone and decided to try going root-less and replace AfWall+ with it for a while. And from what I can tell it runs perfectly fine since some months :)

    I really love the integrated ad-blocking feature and let Tasker update my blocklist via service intent. In that way, Netguard both replaces AfWall+ and my VPN to my Pi-Hole at home with only minimal restrictions (not being able to access my Shaarli instance at home for example if I am away), since the Wireguard app sadly does not support Socks5 :rolleyes:.

    I have one question though which I could not find in the app FAQ or in this thread: Is it also possible to append a local hosts file via a second service intent or shell command after the main hosts file has been updated?
    1
    Hi,
    NetGuard does not request access rights for storing data thus I can't grant permission. This is the same for all of my devices and it is working on the others.
    Is there some sort of if-then condition to enable or disable those buttons?
    Please read the res of the referenced FAQ too and skip the part of the storage permissions.

    The FAQ is for FairEmail, but the problem is similar.
    1
    Any chance for a root-version of NetGuard to get it working without VPN?
    Perhaps as Magisk module or donation-feature?


    Short notice: As I was looking for a firewall app I also found this one.
    It is using your app description. Perhaps just the description or also your codebase with different interface ui.
    I have no plans for a root version, sorry.

    The referenced app is most likely based on the code of NetGuard, without permissions ...
  • 348
    ic_launcher.png


    NetGuard provides simple and advanced ways to block access to the internet - no root required.
    Applications and addresses can individually be allowed or denied access to your Wi-Fi and/or mobile connection.

    Blocking access to the internet can help:
    • reduce your data usage
    • save your battery
    • increase your privacy

    Features:
    • Simple to use
    • No root required
    • 100% open source
    • No calling home
    • No tracking or analytics
    • No advertisements
    • Actively developed and supported
    • Android 5.1 and later supported
    • IPv4/IPv6 TCP/UDP supported
    • Tethering supported
    • Optionally allow when screen on
    • Optionally block when roaming
    • Optionally block system applications
    • Optionally forward ports, also to external addresses (not available if installed from the Play store)
    • Optionally notify when an application accesses the internet
    • Optionally record network usage per application per address
    • Optionally block ads using a hosts file (not available if installed from the Play store)
    • Material design theme with light and dark theme

    PRO features
    • Log all outgoing traffic; search and filter access attempts; export PCAP files to analyze traffic
    • Allow/block individual addresses per application
    • New application notifications; configure NetGuard directly from the notification
    • Display network speed graph in a status bar notification
    • Select from five additional themes in both light and dark version

    There is no other no-root firewall, except for clones, offering all these features.

    This XDA thread is about using the latest version of NetGuard.
    Off topic comments are allowed as long they are related to NetGuard and are in the general interest of the followers of this thread.

    Discussion of purchases is not allowed here, please contact me via here instead.

    NetGuard is being maintained and supported, but new features won't be added anymore.

    For ad blocking, see here. Ad blocking is provide "as-is".

    More information on Github:

    Downloads:

    Screenshots:
    101-main.png
    102-main-details.png

    103-main-access.png
    108-notifications.png


    For more screenshots, see here.






    XDA:DevDB Information
    NetGuard, App for all devices (see above for details)

    Contributors
    M66B
    Source Code: https://github.com/M66B/NetGuard/


    Version Information
    Status: Stable

    Created 2015-10-25
    Last Updated 2020-03-11
    25
    25
    I have just released stable version 2.39.

    Changelog/download
    https://github.com/M66B/NetGuard/releases/tag/2.39

    This version will be available in the Play store after Google's approval.

    Usage data sharing has been removed from this version.

    The future of this project depends on the general support for this project. You can for example write something positive here or in the Play store, press the thanks button, donate something, purchase a pro feature or contribute translations or source code.
    17
    I have just released beta version 2.268

    Changelog/download:
    https://github.com/M66B/NetGuard/releases

    This version adds a setting for a domain name to use to validate the internet connection. The default is www.google.com. You could for example change this into www.opendns.com.
    17
    I have just released beta version 2.21.

    Changelog/download:
    https://github.com/M66B/NetGuard/releases/tag/2.21

    This version will be available as beta version in the Play store after Google's approval.