Android模拟器默认内核不支持netfilter,所以试图使用iptalbes时,会出现错误。
# iptables -L
iptables -L
iptables v1.3.7: can't initialize iptables table `filter': iptables who? (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
#
解决方法是重新编译一个android内核,编译的时候打开netfilter相关模块,用新内核替换原有内核即可。
实验环境:ubuntu10.04 64bit
下载适用模拟器的android内核代码
root@ubuntu:~/android/kernel# git clone https://android.googlesource.com/kernel/goldfish.git
Initialized empty Git repository in /home/shanks/android/kernel/goldfish/.git/
remote: Counting objects: 28280, done
remote: Finding sources: 100% (6/6)
remote: Getting sizes: 100% (5/5)
remote: Compressing objects: 100% (5/5)
Receiving objects: 100% (2442118/2442118), 499.20 MiB | 772 KiB/s, done.
remote: Total 2442118 (delta 2048586)