Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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!

share|improve this question

2 Answers 2

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.

share|improve this answer
    
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 –  Leon Stafford Feb 5 at 22:12

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.