I am running an android image with genymotion 2.8.0 and virtualbox 5.0.28 on osx. My network has a router with dhcp 192.168.1.1 and I want to access my host system (the mac) from android by using 10.0.2.3 or the IP of the MAC. The problem is that the virtual network adapter is always getting an ip in the wrong net vboxnet1 => inet 192.168.57.1 Therefore I tried to changed the interface by setting the dhcp settings. Now every time when I do start the image with genymotion the dhcp settings are getting overridden as show in the screenshot.
1 Answers
The Cause of the Problem
Genymotion is rewriting your network settings in VirtualBox because it has it's own way to handle network connection. That is due to the fact that Genymotion needs to make the android emulator think it has a cellular network or WiFi connection.
Defining Network Through Genymotion Settings
Because you said that Genymotion keeps resetting your VirtualBox's network configurations, I think it might have something to do with Genymotion's own network configuration.
In order to define your network setting in Genymotion, you need to do the following:
Open Genymotion => Settings
=> Network
tab. You will get the following screen and in there you need to enable HTTP Proxy
:
It is called a proxy, but it is supposed to work as kind of a "bridge" between your machine's DHCP and the emulator.
You might need to define the connection inside android system too, depending on the case.
If so, inside the emulator itself, go to: Settings
=> Wi-Fi
=> Long Click on WiredSSID
=> Modify network
=> Advanced options
and modify the setting there too accordingly.
If that's not helping, you might need to change the specific setting of your emulator's virtual box:
Network Configuration via Virtualbox Settings
Genymotion uses two different kinds of network configurations in VirtualBox in order to operate.
- An internal and technical network (defined in
Network
=>Adapter 1
of VirtualBox settings) that helps Genymotion to display the virtual device screen or forward events (clicks or widgets) to the virtual device. This network configuration needs to remain untouched. Changing this may prevent Genymotion to run properly. - A network simulating access to your local network and to the Internet (defined in
Network
=>Adapter 2
of VirtualBox settings). This network configuration is the one responsible for the emulator's internet connection.
So, you can configure Network
=> Adapter 2
of VirtualBox settings as desired, according to the following cases:
- Use
NAT
, if you are using Genymotion on your local machine. - Use
Bridged Adapter
, if you need your virtual device to use an IP address of your local network (a DHCP server in your local network is required).
You will need to choose the Bridged Adapter
option, in your case.
Make sure to change that setting in your specific VirtualBox device.