Last Updated: January 19, 2023
·
162.3K
· mbillard

Access your VirtualBox guest localhost from your host OS

So you want to test your application from you host OS? There are plenty of tips for accessing the host localhost, but finding the information for the other way around has proven difficult, so here it is!

In your VM settings, go to Network and change the "Attached to" property from NAT to Bridged.

Picture

Now, all you need to do is find the IP address on the network that your Guest OS is using. So switch to your VM and find out its IP address.

Then open a browser in your host OS and type in the IP address (plus the port if needed). For example, 192.168.1.###:3000 for a typical Linux guest VM).

4 Responses
Add your response

Hmmm... but what if my server rewrites the URL to 127,0.0.1? Example. I navigate to the IP of 192.168.0.xxx:8080 and then it takes me to an outside server that logs me in, then redirects me back to my server (this part changes the url from 192.xxx... to 127.0.0.1) and prevents me from navigating the website. When I use Chrome on my phone along with Chrome://inpsect on my computer I can port forward my localhost and the port. so My phone can then use localhost:8080 without any problems. I am trying to achieve the same thing with my virtualbox. so far I still have yet to find a solution. :(

over 1 year ago ·

This worked for me. Really awesome

over 1 year ago ·

worked thanks. this connects the VM to the local network & lets it get it's own individual IP separate to the host computer.

over 1 year ago ·

You literally save my life man! Thanks heaps!!

over 1 year ago ·