androidnetwork-programmingpinggenymotiondhcp

Why does my genymotion emulator show 127.0.0.1:6555 on its top window border, rather than a real IP address?


Previously, this same Genymotion Emulator device (Custom Android 11 Phone) used to show a real IP address on its top Window border (e.g. 192.168.122.130:5555), which was from one of the networks shown when I run ip a on the host machine. This way I could easily ping host from genymotion and genymotion from host.

But, out of nowhere, the same device has started to show 127.0.0.1:6555 on its top Window border.

enter image description here

It can be seen in the following screenshot, that from my host machine, if I try to ping the IP address shown in Settings of the Genymotion, it fails. Because the IP address in the Settings of the Genymotion emulator does not fall in the same IP scheme as that in the host machine interfaces, as shown by the hostname -I command.

enter image description here

Moreover, in adb shell (i.e. from the Genymotion shell), if I try to ping any IP address of the host machine, it fails.

enter image description here

The question is why and how do I get it back to always getting an IP address from one of the networks on the host machine?


Solution

  • This is because you are using Qemu hypervisor: Qemu uses the localhost with a port instead of an NAT IP.

    If you absolutely need a NAT IP, then use VirtualBox instead. See https://docs.genymotion.com/desktop/02_Application/#hypervisor-settings