[Solved] Public access for web server on guest VM.

Discussions about using Linux guests in VirtualBox.
Post Reply
bcrimmins
Posts: 4
Joined: 17. Feb 2018, 07:26

[Solved] Public access for web server on guest VM.

Post by bcrimmins »

Hi,

I Windows 10 machine running an Ubuntu VM on VirtualBox 5.2.6. I have an Comcast (Xfinity) model/router. I have a php app running on Apache on the VM that I need to make available to the interwebs.

I have read everything I can find online and I have tried every arrangement of port forwarding I can think of on the Comcast modem, in the VirtualBox app and on the VM. Through port forwarding in the VM I am able to access the php app through a browser on the Windows host. This seems like a necessary step in the right direction but not enough. A couple things really seemed like it should work but ultimately didn't. I am suspicious of maybe port 80/443 being blocked by a firewall but I've tried disabling the firewall at various times and it still didn't work. Of course, maybe I didn't disable the firewall at one of the moments where it would have made a different with one of the solutions that would have worked. Arrrg... so many combinations!

After several days of many, many hours I'm at wits end. I gotta believe someone out there has done this before and can share the road map.

Thanks for any help!

Bob
Last edited by socratis on 27. Feb 2018, 05:21, edited 1 time in total.
Reason: Marked as [Solved].
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Public access for web server on guest VM.

Post by socratis »

You didn't mention your network mode chosen for the VM, or what your port forwarding rules look like. Unless you want us to start guessing, we can't go very far.

As far as VirtualBox goes you should be using Bridged, NAT with port forwarding or NATnetwork with port forwarding. See ch. 6.2. Introduction to networking modes including the Overview table, which shows quickly what kind of connection is required to achieve what you want.

Oh, and keep in mind that a lot of ISP won't allow traffic on port 80. From the world to your house/work that is...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
bcrimmins
Posts: 4
Joined: 17. Feb 2018, 07:26

Re: Public access for web server on guest VM.

Post by bcrimmins »

Thanks, Socratis. Currently, I have my guest (Ubuntu VM) networking set at NAT with the following port forwarding:

Rule 1, TCP, HostPort: 8080, GuestPort: 80
Host IP and Guest IP are blank.

This said, I have tried many other combinations. This is just one of the combinations that allows me to access the guest web server using http://localhost:8080.

On the comcast modem/router, Port Forwarding requires identifying an internal IP address in order to setup a rule. But I can't get figure out how to get the Guest VM to expose an IP that the comcast modem can see. Using ifconfig, I can see "inet addr: 10.0.2.15". But comcast doesn't find it. I have tried forwarding port 80 on the host machine but that doesn't appear to have any affect.

There have been a few occasion (combinations of settings) that yielded this error when I tried to access my local ip address from a separate computer over the internet:
Wepage not available
The webpage at http://67.183.xx.xxx/ cound not be loaded because: net::ERR_EMPTY_RESPONSE
That felt promising because at least it was a response possibly indicative of a connection of some kind. But, alas, whatever connection there was apparently didn't make it all the way to the guest apache server.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Public access for web server on guest VM.

Post by socratis »

  1. Go with Bridged.
  2. Figure out the IP of your guest from within your guest.
  3. Try to access the guest from the host using the above IP.
  4. Configure your router to port forward the outside requests to the IP from step 2.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
bcrimmins
Posts: 4
Joined: 17. Feb 2018, 07:26

Re: Public access for web server on guest VM.

Post by bcrimmins »

Thanks, I will give that a try and report back.
bcrimmins
Posts: 4
Joined: 17. Feb 2018, 07:26

Re: Public access for web server on guest VM.

Post by bcrimmins »

@socratis, you nailed it. Worked perfectly. Thanks a ton!

Bob
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Public access for web server on guest VM.

Post by socratis »

Glad you got it going. Marking as [Solved].
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply