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 I receive "connect: Network is unreachable" meanwhile if I specify the ppp0 interface with `ping -I ppp0` 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 icmp_seq=xxx Destination Net Unreachable" where 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         UG        0 0          0 ppp0 UH        0 0          0 ppp0   U         0 0          0 eth0

This is the output of `netstat -rn`:

    default via dev ppp0 dev ppp0 proto kernel scope link src dev eth0 proto kernel scope link src 

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]

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