Jon Ursenbach
Jon Ursenbach

Reputation: 3192

How can I connect my Android device to a VM running on OSX?

So I do all of my development in a VMWare VM on OSX Lion. The VM is sharing my Mac's internet connection via NAT. I would like to be able to view what I'm developing in my VM on my Android phone (Samsung Galaxy Nexus), but am having a hard time figuring out how to do this.

Since my VM doesn't actually live on my network, and I'm accessing it via a 172.x.x.x address, I can't just hit a standard 192.x.x.x IP in the mobile browser to do it.

Any ideas?

Upvotes: 0

Views: 1295

Answers (1)

Evan Fribourg
Evan Fribourg

Reputation: 36

You will need to use port forwarding to have your Mac forward requests to a certain port into the VM to be processed. It's a fairly easy process (Note that these instructions are for VMWare Fusion 4 - Version 3 has different file locations):

  1. cd /Library/Preferences/VMware\ Fusion/vmnet8
  2. Edit nat.cnf - find the [incomingtcp] section and add

    80 = your 172.x.x.x ip:80

    and save out the file. As an example, mine is:

    80 = 172.16.65.130:80

  3. Quit and restart VMWare (you can just let it suspend and resume your VM)

When your webserver comes back up on your box, you should now be able to access the web server in your local browser by just browsing to http://localhost. To access the server via your phone, just hit the IP of your Mac (your 192.x.x.x address) and it will forward the traffic to the webserver.

Upvotes: 2

Related Questions