I'm currently using DroidWall to limit apps' access to the Internet - and it's working great.

Recently I've started to have the need of allowing certain apps network connectivity, but limited only to the current LAN (e.g. only to communicate with IP addresses 192.168.1.x)

DroidWall doesn't seem to offer this in any trivial way (except, perhaps via its custom scripts, for which there aren't any clear instructions for how to apply them only to an individual app).

How can I limit an individual app to LAN access only?

2 Answers 2


You can use rules like this in your custom scripts:

$IPTABLES -A "droidwall-wifi" -m owner --uid-owner 12345 --destination "" -j RETURN

Instead of 12345, you need to specify the UID assigned to the app; you can find that UID in the list of apps in DroidWall.

Remember that UIDs are assigned dynamically, and if the app is removed, the UID previously assigned to it may be assigned to a completely different app installed later.

There are some enhancement requests for DroidWall (#275, #253) requesting to add such feature, but developers did not respond to them yet.

  • DroidWall has some examples for custom scripts
    – ce4
    Commented Nov 6, 2012 at 22:35
  • 1
    A link to those examples is already in the question; however, the -m owner --uid-owner 12345 part which is required for per-app filtering cannot be found there. Commented Nov 7, 2012 at 19:28

I came across a solution that can work for you today.

I have been using this firewall for years but never realized that it has a hidden feature until today.

For most apps on the Android device will still work on LAN even if the APP is completely blocked from the internet.

I tested it and it did not access the internet at all but was able to access LAN.

This can easily be tested from a browser.

For other APPs that use UPNP services. It will not work on LAN if you block it. So then you will need to go to the access log and see the request on to the LAN and open it while making sure the others are blocked from the APP in the firewall.

The APP is called No-Root Firewall by Grey Shirts.

The APP works very well but just does not work on LTE connections and no updates since 2014.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .