I want to add an iptables rule on my Android phone. I used:
iptables -t nat -A PREROUTING -p 6 -d 192.168.66.1 --dport 80 -j DNAT --to 192.168.66.1:808
...as root. This rule can be checked in adb shell, and I can see that it was added:
# iptables -t nat -nL chain PREROUTING (policy ACCEPT) prot opt source destination idletimer_nat_PREROUTING all -- 0.0.0.0/0 0.0.0.0/0 DNAT tcp -- 0.0.0.0/0 192.168.66.1 tcp dpt:80 to:192.168.66.1:8080
I want this rule to persist after a reboot, so I added an iptabless file in
/etc/sysconfig with these contents:
-t nat -A PREROUTING -p 6 -d 192.168.66.1 --dport 80 -j DNAT --to 192.168.66.1:8080
However, when I reboot my phone, no rule is added.
Does Android support the
/etc/sysconfig/iptables path? I got this path from a PC Linux installation ( I tested
/etc/iptables/rules.v4 as well, it also did not work).
At the same time, I also don't know whether its content is right.
Additionally, I cannot root my testing phone in the future. Is it possible to add persistent iptables rules on an unrooted phone?