Apple - Can I block ports and network traffic when using Personal Hotspot?
For outgoing connections, the only jailbreak application that exists is Firewall iP. It behaves similarly to the Mac OS X application Little Snitch.
For incoming connections, you will have to use a regular firewall system such as ipfw
.
Disclaimer: To anyone actually looking to use ipfw
on iOS, you're going to have to patch the kernel to include support for pf
. Documented, nobody has ever done it, but it's not technically impossible. The jailbreak itself patches the kernel upon boot, so this would require the same exploits used during that process. If you have happened to patch pf
into the kernel, then proceed with my original answer below.
Add the http://theworm.altervista.org/cydia/
repository in Cydia > Manage > Sources > Edit > Add
. Then install the MTerminal
app from the BigBoss repository and the network-cmds
package from The Worm repository. Then you can go into the terminal app you just got and run ipfw
. This will let you write to your firewall tables. If you need a tutorial on how to use ipfw
, there's a good one here.
You could look into using the tweak Firewall iP (a paid package hosted by BigBoss repository) - it provides a number of options for controlling outgoing connections from your iPhone.