0
votes

I have following hw environment: - dev board; - Android device; - Ubuntu laptop;

Android connected to the board by USB cable. Laptop connected to Android dev by wifi hotspot.

From Android I able to ping a board throw USB tethering (and vise versa). Also from Android I able to ping a laptop throw wifi hotspot (vise versa).

|Dev board| <--- usb tether ---> |Android| <--- wifi ---> |laptop|

On Android device, I have usb0 and wlan0 interfaces. I want to ping dev board from the laptop.

How to setup bridge? And this bridge should work with ADB throw wifi.

Android details:

ifconfig

bridge0 Link encap:Ethernet HWaddr 58:A2:B5:7F:7B:21
inet6 addr: fe80::7824:93ff:fe96:c19f/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:399 errors:0 dropped:21 overruns:0 frame:0 TX packets:358 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:46412 (45.3 KiB) TX bytes:26128 (25.5 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:227 errors:0 dropped:0 overruns:0 frame:0 TX packets:227 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:22816 (22.2 KiB) TX bytes:22816 (22.2 KiB)

usb0 Link encap:Ethernet HWaddr DE:46:31:73:06:7E
inet addr:192.168.42.129 Bcast:192.168.42.255 Mask:255.255.255.0 inet6 addr: fe80::dc46:31ff:fe73:67e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:449 errors:0 dropped:0 overruns:0 frame:0 TX packets:241 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:33485 (32.7 KiB) TX bytes:26750 (26.1 KiB)

wlan0 Link encap:Ethernet HWaddr 58:A2:B5:7F:7B:21
inet addr:192.168.43.1 Bcast:192.168.43.255 Mask:255.255.255.0 inet6 addr: fe80::5aa2:b5ff:fe7f:7b21/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:674 errors:0 dropped:3 overruns:0 frame:0 TX packets:398 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:47625 (46.5 KiB) TX bytes:35994 (35.1 KiB)

Interface bridge0 Android setup automatically when USB tether or wifi hotspot enabled.

Thank you!

1

1 Answers

1
votes

I found solution for me.

Just

echo "1" > /proc/sys/net/ipv4/ip_forward

and remove all iptables rules

iptables -F

iptables -X

iptables -t nat -F