IOS – Firewall on iPhone/iOS (ipfw or pf)

firewalliosipfwiphonejailbreak

I want to run ipfw or pf on my iPhone — or the equivalent. Seems simple, but I can't find anything that works.

Device is jailbroken, looked very carefully through Cydia, and even through some of the alternate repositories. I've tried off and on for months, digging and digging, it's been really frustrating.

I found this post: Can I block ports and network traffic when using Personal Hotspot? here on apple.stackexchange, and tried installing ipfw via theworm.altervista.org/cydia. It installed without issue, but no matter what I do it just says:

ipfw: getsockopt(IP_FW_GET): Protocol not available

Found this post: http://nixcraft.com/all-about-freebsd-openbsd-netbsd/3726-ipfw-getsockopt-ip_fw_get-protocol-not-available.html which suggests creating a file: /etc/rc.conf, with the following:

firewall_enable="YES"
firewall_script="/usr/local/etc/ipfw.rules"

But that didn't help at all, still get the same error.

I'm aware of the Cydia/commercial software "IP Firewall", which would help with much of what I want to do, but not everything.

Please help!

Best Answer

This thread over the FreeBSD forums suggests that pf works on iOS. Disclaimer: I haven't tested this myself.

Edit:

pfctl -sr

as root returns:

No ALTQ support in kernel
ALTQ related functions disabled

and no rules whatsoever, but it seems that pf is there