Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

You can use rules like this in your custom scripts:

$IPTABLES -A "droidwall-wifi" -m owner --uid-owner 12345 --destination "192.168.1.0/24" -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.

share|improve this answer
    
DroidWall has some examples for custom scripts –  ce4 Nov 6 '12 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. –  Sergey Vlasov Nov 7 '12 at 19:28
    
oops, must have missed that, thanks. –  ce4 Nov 7 '12 at 19:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.