2

I try, to connect my android emulator (from sdk) to the lan via a network bridge and a tap interface and with the -qemu option. I need it to use multicast addresse in native library code for communication with IoT devices connected to the lan.

But depending the image version an achitecture (x86 or ARM) I have different behaviours.

For ARM image (Android 7.1.1 armeabi-v7a) the bridge work perfectly. Dhcp client work automaticly after boot time. I can ping the lan gateway, google ... and the multicasting work. But the nic add to the emulator is not present via ip link or ifconfig, it is hidden, and default route is not present !! strange thing. The emulator is no pingable from the outside.

For X86 image (Android 7.1.1 google_apis/x86), the bridge work perfectly. Dhcp client work and the guest nic is configured. I can ping the lan gateway, google ..., the multicasting work, and the nic is visible (eth1). But to ping the gateway or other host, I must use ping -I to specify the nic interface, the emulator use slirp network and it is not pingable from the outside.

It is possible to make the emulator pingable from the outside ?

It is possible to use ping in x86 emulator without to use -I option for ping ?

It is possible to see the network nic attach in the ARM emulator ?

thank for your help.

1

I think that if you add the IP of the server on you LAN network that will allow you to access it from the emulator. So a fight with iptables is required in your case

useful links https://developer.android.com/studio/run/emulator-networking.html

and there is a hole bunch of documentation of how to redirect network traffic to a new IP address using iptables

Good luck i hope my answer was useful!

  • Thank's, I know the link, The emulator use slirp qemu network. But maybe there is some other things that block the network traffic to the default route. Maybe an android services, iptable rules or a kernel module. On my host the network rules are fully open in the both way. – user254255 Mar 4 '18 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy