0

My device is rooted with magisk, and I prefer cli options over apps.

My device have android version 10 with stock android.

All the firewall apps connect to a vpn (which i don't trust at all) to block applications from using mobile data. That is why I'm looking for better options, I'm thinking of using iptables but I don't know how to block specific apps with that.

EDIT: I recently switched to Lineage OS 17.1, it does have options for disabling mobile data/wifi for individual apps.

  • 1
    See: Block apps from accessing the Internet on Android device If you've already tried the solutions listed there, please update your question with what attempted. – Morrison Chang Apr 17 at 5:44
  • 2
    All the firewall apps don't connect to VPN, they just use VPNService API so that whole network traffic is redirected towards them (over TUN interface) and they may control it in whatever way they want. // Since every app owns a unique UID, you can use owner module with iptables to control traffic i.e. iptables -m owner --uid-owner .... That's what AFWall+ does. For details: How to view network traffic requested by a specific app? – Irfan Latif Apr 17 at 5:44
  • 1
    Apart from that, not "all the firewall apps" use VPN – only those that don't have root access revert to that. I'm using AFWall+ and it does not use VPN, but iptables. And you can decide per-app as well as per-interface what app gets Internet access: via mobile data, WiFi, while in Roaming. It uses a GUI, but can be extended by your own scripts (which is what I e.g. do to override my providers DNS). // As your question is for command-line, I'm not sure if an answer along these lines would be acceptable? "iptables howto" would rather be off-topic ;) – Izzy Apr 17 at 6:22
  • 1
    @IrfanLatif that could probably be solved by running a service. But yes, I see your point. In dubio pro reo, let's assume OP meant to prefer cli over GUI, and things could match again ;) – Izzy Apr 17 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.