I want to enable IP forwarding on an Android Lollipop device. 

The idea is to forward traffic between the ethernet & WiFi networks, where 
the Android device is acting as a router.


A USB ethernet adapter is connected to the device and I can access ethernet 
connected hosts and vice versa. 

Also, WiFi is enabled and functioning. 

I have enabled IP forwarding in the kernel, by doing: 

"echo 1 > /proc/sys/net/ipv4/conf/all/forwarding"


Here is a diagram with IP settings on the device:

172.16.1.1/24[eth0]<-Android->[wlan0]172.16.2.1/24


Ethernet eth_host1 has the IP 172.16.1.2 and a static route set to access 
the wlan0 network: 

"ip route add 172.16.2.0/24 via 172.16.1.1". 

Wireless wifi_host1 has the IP 172.16.2.2 and a static route set to access 
the eth0 network: 

"ip route add 172.16.1.0/24 via 172.16.2.1".


I had to add a route on the Android device to enable connectivity with the 
ethernet network, as all traffic was exiting through the default route on 
wlan0: 

"ip rule add prio 100 from all lookup 100" "ip route add table 100 
172.16.1.0/24 dev eth0"


However, I cannot ping eth_host1 from wifi_host1 and vice versa. 

What could be the problem here?

-- 
-- 
unsubscribe: android-kernel+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-kernel
--- 
You received this message because you are subscribed to the Google Groups 
"Android Linux Kernel Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-kernel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to