How to access a vmware guest web server from another device on the network

2

1

I am developing a mobile website. I develop in Ubuntu via a virtual machine (vmware). I have a Windows 8 host and Ubuntu 13.10 guest.

I want to be able to view the site-in-progress on my phone for testing purposes. How can I do this?

I'm a developer, not a network guy =)

Note: I am using a NAT connection. I can access the guest web server from a host browser, but not from my phone's browser (chrome). The phone is connected to the same (wireless) network.

Thanks!

Sir Robert

Posted 2014-01-16T21:29:02.813

Reputation: 183

Answers

5

NAT is used if you want the VM to share the same IP address as the computer it's running on.

If you want it to have it's own IP address, switch the VM's virtual network adapter to bridged mode. You can then let the VM get an IP from DHCP, or assign one manually.

You can make servers accessible through the VM's NAT if you really want, but you have to set up port forwarding on the VM. It's much easier just to use bridge mode.

If you want the site to be accessible through your phone's cellular data connection as well, set up port forwarding on your Internet router as @Pierre above explains.

LawrenceC

Posted 2014-01-16T21:29:02.813

Reputation: 63 487

in these days of wifi-only laptops, it may be good to note that bridged mode will not usually work over combinations of NIC and routers, in which case, NAT with port forwarding should be your target solution – ljs.dev – 2014-02-05T22:12:11.193

0

Assuming:

  • Your mobile phone is connected to a network operator,
  • Somewhere in your local network, an ADSL modem is connected to another network operator (or to the same operator as the one used for your mobile phone),
  • A router is installed somewhere in your local network (could be inside your ADSL modem).

Well.

  1. Configure your VM and change its NAT to a Bridge connection,
  2. Configure your guest machine (Ubuntu 13.10) by setting manually its network interface to a fixed IP address (for example 192.168.0.3 + gateway + DNS),
  3. Install PHPMyAdmin in your guest machine, for security reasons (PhpMyAdmin trap the default incoming traffic),
  4. Configure your router to redirect traffic entering on port 80 protocol TCP (for example) towards a local IP address port 80 protocol TCP (192.168.0.3 same as your guest machine).

That's it. From your mobile phone browser enter http://your-ADSL-ip-address:80/yourapp/

Works for me:

Windows 6.1 / VirtualBox 4.3.6 / Debian 7.3 / Apache 2.2.23
Android 2.3.3

Pierre

Posted 2014-01-16T21:29:02.813

Reputation: 309