1

I've been looking for a firewall app for Android for a couple hours now and all I could find is apps that only let me block outgoing connections (for specific apps). Is there any way to set which incoming connections and on which ports should be allowed/denied (something like Inbound Rules in Windows Firewall)? I'm OK with with the app requiring root.

  • 2
    Asking for recommendations is off-topic on AE – TheBro21 Apr 9 '16 at 12:14
0

If you don't mind with the solution not being an app, then you can use iptables. They are included in the AOSP kernel. You can access them by downloading a terminal app off of the app store. You might however need root for this.

The usage of iptables on android should be same as the ones on desktop Linux, so you can look up some GNU manual for it.

0

It's simple to achieve with iptables; thanks to Linux kernel. Since Android uses default policy ACCEPT, drop any unwanted packets. For instance you want to allow port 22 and block all others:

~# iptables -N MYCHAIN
~# iptables -I INPUT -j MYCHAIN
~# iptables -A MYCHAIN -i lo -j RETURN
~# iptables -A MYCHAIN -p tcp ! --dport 22 -m conntrack ! --ctstate ESTABLISHED,RELATED -j DROP
~# iptables -I FORWARD -j DROP

This will also block incoming connections from tethered devices on hotspot network. You can exclude those, see this: Is There A Mobile Hotspot App With A Firewall to Block Incoming Connections?

Your Answer

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

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