How to access web server on VirtualBox from host

Image contains VirtualBox home screen and htopskills.com home page with quick assist thumbnail

Many of you are facing problem, you can access web server and other services in virtual machine, but cannot access web server on VirtualBox from host and on other device on your host network.


This post provides two methods to help you access services in VirtualBox guest from another computer, namely bridge mode and port forwarding in VirtualBox.


This example, I can access a web server inside the guest but it is unreachable on the host and any other computer on the host network


How to fix NAT network issue in VirtualBox

  • Change the network settings to bridge or
  • Forward a port for the guest to a port on the host


How to change network settings to bridge in VirtualBox

Open VirtualBox

Select the virtual machine, then click on the settings icon (Ctrl + s)

If you are using an older version of VirtualBox, remember to shut down the virtual machine first.

In the settings window, select Network

Choose the adapter you want to change to bridge by selecting the appropriate tab

Make sure the Enable Network Adapter option is checked

In attached to, click the drop-down menu, and then select the bridge adapter.

Click on OK.


How to Forward Ports to a Virtual Machine

Open VirtualBox

Navigate to file in the menu, then click preferences

In the Preferences window, select Network, choose NatNetwork, then click the edit icon

In the NAT Network Details window, click Port Forwarding

To add a new rule, click on the add icon on the right of the screen

Give the rule a name

TCP protocol

Host port, any unused port greater than 1024 (use 8080)

Type the guest’s IP address (in my case 10.0.2.4)

Guest port 80

Click OK to close all windows

If you see a Windows Firewall warning, click Allow Access


To access the web server from another computer, type the IP address of the host and the port number.


Video to show you how to access web server on VirtualBox from host


What To Read Next


If you like the content of this post or if it has been useful to you, please consider sharing it on your social media and follow me on Facebook and Twitter for more exclusive content.