0

I am trying to change localhost: for a CentOS 7 local webserver to a NAT'd IP (internal/private) that I can connect to from inside my own network and perform testing on a webpage from various devices. However, I can only connect to the device using localhost: from the client that is running the virtual machine as I have the port forwarded in VirtualBox. I cannot however connect to it from any other devices, more specifically a smart phone or tablet.

I have changed configuration in /etc/httpd/conf/httpd.conf to Listen 10.0.2.15:80 and disabled firewalld entirely, and it even shows when running netstat -antup that it is listening over 10.0.2.15:80, however I can't connect to that IP via any other devices on my network OR the client device hosting the virtual machine. The only way I can view the webpage is by going to localhost: on the local machine running the instance......

What am I missing?

0

To allow other devices on your network to access your virtual machine, your port forwarding settings in VirtualBox should typically look something like this:

ex VirtualBox NAT Port Forwarding

VirtualBox NAT Port Forwarding


Note that Host IP and Guest IP are empty in the screenshot above.


I can't connect to that IP via any other devices on my network OR the client device hosting the virtual machine.

Assuming you mean 10.0.2.15, this is normal.

The only way I can view the webpage is by going to localhost on the local machine running the instance[.]

To be clear, if you aren't on localhost, you need to use the IP of the Host with NAT port forwarding.

  • thank you for your reply. So to clarify, I am trying to access the virtual machine web server from a mobile device on my network to view pages from a mobile perspective, to ensure maximum compatibility. The virtual machine is hosted on my desktop, which with port forwarding enabled (blank guest and host ip and ssh/http ports forwarded), I can only get the the webserver with localhost:80. What would I need to place in guest or host ip to access it from my mobile device/tablets? – j.kells Sep 10 at 22:15
  • You shouldn't need to place anything in those fields. The rules above should work for any device on the network, including mobile devices and tablets. Assuming your Host (not Guest) IP is ex. 1.2.3.4, you would use that address in your mobile device browser. As a small FYI, the webserver on your Guest should be the only one running on port 80 (i.e. any web server on your Host should stopped or running on a different port). – Anaksunaman Sep 10 at 22:36
  • One other thought: for testing purposes, you might try switching the Guest to a bridged adapter. If you can't directly connect to the network IP assigned to the Guest (not the Host), there is likely a configuration issue on the Host blocking the Guest. – Anaksunaman Sep 10 at 22:42
  • thank you so much!!!! – j.kells Sep 10 at 23:59
  • You're welcome. =) – Anaksunaman Sep 11 at 1:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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