Enabling wlan0 and rmnet on Android

see if you can share the data from rmnet_data0 interface to ecm0 interface on WP76 module:

iptables -F && iptables -I INPUT -j ACCEPT
iptables -t nat -A POSTROUTING --out-interface rmnet_data0 -j MASQUERADE
iptables -A FORWARD -o ecm0 -i rmnet_data0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i ecm0 -o rmnet_data0 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward

On android side, you can try “ping 8.8.8.8”

i am able to ping from adb shell but i guess, the browser needs soemthing more.

you might also need to setup DNS information.
e.g.
on module side:
cat /etc/resolv.conf
nameserver 10.144.148.1
nameserver 10.145.148.133

On Android side:
ndc resolver setnetdns 10 “” 10.144.148.1

No luck!!

Did the same on module,

round-trip min/avg/max = 12.365/15.667/18.969 ms
root@swi-mdm9x28-wp:~# cat /etc/resolv.conf
domain wifi.local
nameserver 8.8.8.8
root@swi-mdm9x28-wp:~#

Android :

25 ip route add default via 192.168.2.2 dev usb0
26 ip route list
27 /system/bin/ndc resolver setnetdns usb0 1.1.1.1 8.8.8.8
28 /system/bin/ndc network default set usb0

so now your adb shell can ping google server, and your Android application can ping 192.168.2.2, right?

Yes. Able to ping, but browser does not work.

can android application ping 8.8.8.8

From android adb shell able to ping 8.8.8.8

3 packets transmitted, 3 received, 0% packet loss, time 2006ms
rtt min/avg/max/mdev = 22.531/24.288/25.246/1.257 ms
shell@:confused: # ping www.google.com
PING www.google.com (172.217.163.36) 56(84) bytes of data.
64 bytes from maa05s01-in-f4.1e100.net (172.217.163.36): icmp_seq=1 ttl=115 time=33.1 ms
64 bytes from maa05s01-in-f4.1e100.net (172.217.163.36): icmp_seq=2 ttl=115 time=26.2 ms
64 bytes from maa05s01-in-f4.1e100.net (172.217.163.36): icmp_seq=3 ttl=115 time=28.3 ms
^C
www.google.com ping statistics —
3 packets transmitted, 3 received, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 26.270/29.283/33.194/2.903 ms
shell@:confused: # ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=115 time=28.7 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=115 time=22.7 ms
^C
— 8.8.8.8 ping statistics —
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 22.739/25.746/28.754/3.011 ms

How about android app? Can it go to some real ip address?
You need to isolate if this is dns issue

From the Android browser - firefox, not able to connect any where.
google.com / 8.8.8.8 Not able to get browse.

Then can browser access 192.168.2.2 ?
E.g. setup a http server in module

Cannot browse 192.168.2.2
Able to only ping.

did you set up the http server?
or you can set up a TCP server on port 80 and see if you receive the HTTP request from browser

Regret for the delayed response and silly questions asked below.

Do a http server needs to be setup ?

All that is running on the MangoH red board is atServer application running on socket, waiting for a socket client to communicate with.

With the c executable on Android setup, able to send at commands to the atServer application after the below setting.

25 ip route add default via 192.168.2.2 dev usb0
26 ip route list
27 /system/bin/ndc resolver setnetdns usb0 1.1.1.1 8.8.8.8
28 /system/bin/ndc network default set usb0

UI application like browser unable to communicate with usb0

Again regret for silly questions.

For UI application, you need to setup those ndc commands

E.g.
ndc network create 10
ndc network interface add 10 wwan0
ndc network route add 10 wwan0 0.0.0.0/0 10.105.171.186
ndc network default set 10

On adb shell using these below commands able to get enable and disable usb0 with ui.

24 ndc network create 10
25 ndc network interface add 10 usb0
26 ndc network route add 10 usb0 0.0.0.0/0 192.168.2.2
27 ndc resolver setnetdns 10 usb0 1.1.1.1 8.8.8.8
28 ndc network default set 10

Need to integrate with UI apk, Will try that. Thanks jyijyi.

So this is the update on this.

ON bootup of the Android, the usb0 interface is up by default.
After abt 20 seconds, the usb0 interface is disabled using, “netcfg usb0 down”. This will enabled the wwan0 to be up.

So in the UI apk also we have incorporated enabling usb0 on start of apk using, “netcfg usb0 up” and then “netcfg usb0 down” when apk closes or wifi disconnect is initiated from the apk end.

Even the ndc commands provided worked.