如何用iptables在Android应用程序

问题描述:

我如何在Android应用程序中使用iptables的?我需要这样一个类似防火墙的功能,即数据包过滤,阻止网站等。

How can I use iptables in an Android application? I need this for a firewall-like functionality i.e. packet filtering, blocking sites etc.

我也不能肯定的iptables是否在Android内核中可用。

I'm also not sure whether iptables are available in the Android kernel.

我previously听说我要创建的iptables的交叉编译的二进制文件 - 但我怎么能做到这一点?我如何使用它们的应用程序?

I previously heard that I'd have to create cross-compiled binaries of iptables – but how can I do that? And how can I use them in the application?

这是绝对有可能。你可能会考虑看 $ C $了C Droidwall

It's definitely possible. You might consider looking at the source code of Droidwall.

DroidWall - Android的防火墙是强大的iptables的Linux防火墙前端应用程序。它可以让你来限制哪些应用程序允许访问您的数据网络(2G / 3G和/或Wi-Fi)。

DroidWall - Android Firewall is a front-end application for the powerful iptables Linux firewall. It allows you to restrict which applications are permitted to access your data networks (2G/3G and/or Wi-Fi).

退房的从Droidwall 的iptables API 以具体的例子。

Check out the iptables API from Droidwall for specific examples.

请注意,当使用的iptables 需要root访问到您的手机。

Note that when using iptables you need root access to your phone.