How to forward traffic from eth0 to ppp0 on Android

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to forward traffic from eth0 to ppp0 on Android

Riccardo Bruè
Hi, I am using Android 10 on a custom device. The Android image has been generated by AOSP.
I need to forward the traffico from the eth0 to the ppp0 (LTE module) interface.
I've managed to enable the ppp0 interface by using the pppd script (i.e.: `pppd call my-connection-info`) and I can see that I receive the two DNS server addresses and my public IPv4 successfully.
Now the first weird thing: If I ping to 8.8.8.8 I receive "connect: Network is unreachable" meanwhile if I specify the ppp0 interface with `ping -I ppp0 8.8.8.8` I can successfully ping the target.

Now I want to forward the eth0 traffic to the ppp0, to do so I've tried the following commands:

    $ echo 1 > /proc/sys/net/ipv4/ip_forward
    $ iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

But the PC on the other end of the eth0 interfce still prompts "From 192.168.10.1 icmp_seq=xxx Destination Net Unreachable" where 192.168.10.1 address is the Android device (which acts like a gateway).

This is the content of `netstat -rn` command:

    Kernel IP routing table
    Destination Gateway Genmask Flags   MSS Window  irtt Iface
    0.0.0.0         10.64.64.64     0.0.0.0         UG        0 0          0 ppp0
    10.64.64.64     0.0.0.0         255.255.255.255 UH        0 0          0 ppp0
    192.168.10.0    0.0.0.0         255.255.255.0   U         0 0          0 eth0

This is the output of `netstat -rn`:

    default via 10.64.64.64 dev ppp0 
    10.64.64.64 dev ppp0 proto kernel scope link src 10.53.117.129 
    192.168.10.0/24 dev eth0 proto kernel scope link src 192.168.10.1 

This is the output of `iptables -L` (which I've flushed with `iptables -F`, `iptables -X` and `iptables -t nat -F`):

    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination         
    
    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination         
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination


Which is the issue here? Thank you.

--
--
unsubscribe: [hidden email]
website: http://groups.google.com/group/android-porting

---
You received this message because you are subscribed to the Google Groups "android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-porting/9e5f8e73-6390-41c5-909e-f2c8e7816844n%40googlegroups.com.