4

I have successfully installed CentOS7 as a guest on VirtualBox for mac.

I have also installed a Tomcat 7 as shown in the picture below and I can successfully access http://localhost:8080 from Firefox within the CentOS virtual machine.

However, I am not able to access http://localhost:8080 outside the centOS virtual machine (i.e. I am not able to access the website from my host Yosemite web browsers like Safari or Firefox).

Here are my centOS7 network settings from within Virtual Box:

enter image description here

With the above network settings, I am able to connect to the internet within the CentOS virtual machine. But I can't connect to the host machine.

3

With these network settings, the webserver will not be running on the localhost interface of the host machine. Your host machine in essence has become a router behind which the guest machine is accessing the network. If you look at the IP address of the guest machine it will probably be something like 10.10.10.100. You can try surfing to (in this example) http://10.10.10.100:8080 on the host machine and, depending on your firewall and network settings, you should get to your webserver.

The better solution is to change guest machine's network settings to use bridged mode, so the IP address of the guest machine and the host machine will be the same. At that point you should be able to surf to http://localhost:8080.

The VirtualBox Networking Manual has more details on the different networking modes available and what they do.

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.