Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I modify the host file on a Genymotion VM from windows?

I'm basically trying to simplify my development workflow a bit. I have a azure mobile services project running inside IIS on my windows host machine, which I can connect to from the Genymotion Android VM using an IP address (10.71.34.1).

What I'd like to be able to do is connect to the mobile services website using a host header (e.g. http://devmobservices rather than http://10.71.34.1:12345).

How can I modify the host file opn the Genymotion VM to allow me to do this?

(Also, if there's a better solution then please point me at that!)

Thanks

Matt

like image 742
Matt Whetton Avatar asked Feb 13 '15 19:02

Matt Whetton


People also ask

What is host file modification?

A hosts file can be modified to override your network settings and allow your local machine to view a website before the DNS changes propagating.


2 Answers

To modify the host file, you need first to mount the system partition in read-write.

After launching your Genymotion device, open a command line and type:

adb shell
mount -o remount,rw /system
echo "10.71.34.1   devmobservices" >> /etc/hosts

After that you will be able to reach your service through http://devmobservices:1234 address.

like image 177
eyal-lezmy Avatar answered Sep 28 '22 08:09

eyal-lezmy


Thanks to the prior commenters for their assistance. Note that the location of adb is different on OS-X, so the actual commands would be:

/Applications/Genymotion.app/Contents/MacOS/player.app/Contents/MacOS/tools/adb shell

mount -o remount,rw /system

echo "10.71.34.1   devmobservices" >> /etc/hosts

Also, be sure the VM you want to modify is first running before entering the first command.

like image 30
Dan D Avatar answered Sep 28 '22 08:09

Dan D