how can i solve the following issue in android regarding "iptables"? - android

This is the error i am getting in logcat:
runIptablesCmd(): failed /system/bin/iptables -t raw -A bw_raw_PREROUTING ! -i lo+ -m owner --socket-exists res=768
After issued strace -c netd i got the following things. please suggest me to proceed further.
iptables v1.4.11.1: can't initialize iptables table `raw': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.11.1: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

It seems like a ramdisk issue.
Check and make sure your ramdisk (mainly init.rc) has the necessary parts for the mdns service. You can see here that there are additions to the netd service (these mdns services weren't in Android versions before Jellybean) that have mdns added to it and there is also an mdns service as well at the bottom of the init.rc I linked to earlier.
Add those two parts to the init.rc and see if that resolves the issue.

Related

android genymotion iptables

I am using Genymotion emulator for Testing My proxy.So I need use iptables to redirect all tcp data to my proxy Port.
when I use
iptables -t nat -N REDSOCKS
it prints 'can't initialize iptables table `nat': Table does not exist (do you need to insmod?)'
But when I use
iptables -L
it prints the default table 'filter' complete chains.
'nat' and 'filter' are default tables in netfilter, Why nat table does not exist?
Users of retail Android devices cannot access iptables binary. Even Android OS itself cannot access that binary.
Source.
A few general things about routing with iptables.
Dont forget to enable routing .
sudo sysctl net.ipv4.ip_forward=1
or
echo 1 > /proc/sys/net/ipv4/ip_forward
and
iptables -t nat -A PREROUTING -i $device -p tcp --dport $srcPortNumber
-j REDIRECT --to-port $dstPortNumber

Error : iptables v1.4.11.1: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)

I'm building a ROM from AOSP ICS, when i'm running it on emulator and trying to access the iptables it gives me the error as
iptables v1.4.11.1: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
What must be the problem?
Your kernel image does not contain the dependent modules for IPTABLES.
Please check your kernel build config files to see if iptables (netfilter, netlink etc) is enabled.
ADB SHELL SU
change to root and try again

iptables 1.4.11 on Android

I have downloaded the Android kernel sources from http://source.android.com/source/building-kernels.html
I have then started the emulator and wanted to play with iptable rules but I get this following error. Is the iptable package not fully installed? why is NAT table missing?
Initially I had started following http://randomizedsort.blogspot.de/2011/03/porting-iptables-1410-to-android.html#comment-form_8482839589527760177 to install iptables, but having seen iptablesv1.4.11.1 on the adb shell, I had abandoned the idea. Has anybody tried porting iptables on newer android kernel sources??
adb shell
# su root
# iptables -t nat -A OUTPUT -p tcp --dport 8000 -j REDIRECT --to-port 8080
FIX ME! implement getprotobyname() bionic/libc/bionic/stubs.c:450
iptables v1.4.11.1: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
Please advise!
Use protocol numbers (-p 6) instead of names (-p tcp):
iptables -t nat -A OUTPUT -p 6 --dport 8000 -j REDIRECT --to-port 8080
See this answer for more info:
getprotobyname error iptables

Android Iptables: Can´t drop port

I try to iptables -A OUTPUT -p tcp --sport 5228 -j DROP but it comes to failure messages:
FIX ME! implement getprotobyname() bionic/libc/bionic/stubs.c:378
I have an rooted device and busybox on it. Strange is that if I see the rules list of iptables this port is in it. I´m not sure does it work? What is my problem?
Seems like a known bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=558415
It lists workarounds if you're interested.
Use protocol numbers (-p 6) instead of names (-p tcp):
iptables -A OUTPUT -p 6 --sport 5228 -j DROP
See this answer for more info:
getprotobyname error iptables

Looking for iptables binary for Android 2.3 ARM platform?

I am trying to setup a proxy on an Android device using iptables. We are using Androd 2.3. I don't see iptables in emulator or in our platform build.
Where can I download a prebuilt iptables binary (and all supporting libs it needs) for setting up a NAT like rule?
I like to run it like this eventually:
iptables -t nat -A PREROUTING -p tcp --dport 24 -j REDIRECT --to-port 7060
Thanks
I'm not aware of any pre-built iptables binary that android is supposed to have. That said, you could probably build iptabels for you device using the source code found here.

Categories

Resources