VirtualBox provides multiple Virtual Networking solutions on how you want to configure your Virtual Machine and how the internal or external network traffic is routed. If you want to connect your VM on the LAN (or your WiFi Network) and appear like any other devices connected – make a two-way network connection VM to all LAN IPs and LAN devices to the VM – then choose the Bridged adapter in VM settings.
- How to configure NAT adapter for a VirtualBox VM
- How to access a webserver port of VirtualBox V from the host
The Bridged Adapter concept
Oracle VirtualBox by default sets the VM network to NAT (Network Address Translation). (here is a guide on configuring VM to NAT network). A bridged adapter, as the name says acts as a network bridge between your LAN ethernet or wireless (WiFI) network and the VM’s virtual ethernet interface adapter.
You have your VirtualBox Host running on the host Operating system, which is connected to the LAN via cable or WiFi. This is how you get an IP address and internet access.
Now that Virtual Box’s virtual router provides the IP address comes to the VM, and the VM work on a virtual Network.
How to attach a VirtualBox VM to use the NAT network?
Follow the steps below to configure or re-configure a VirtualBox VM to NAT configuration.
You would be required to stop the VM before making this change.
- Shut down the VM if it is in the running/paused state
- Open the Settings menu, then select Network as shown below
- Select Bridged Adapter as the option for “Attached to”
- Save the settings.
How to connect to the local network from the VM and the other way around?
When you start the VM, it will come up on the VirtualBox Bridged network and assumes an IP address from your local network DHCP. You may assign a static IP if required from the OS network settings.
The VM and its ports are by default available on LAN this way. You can check your OS network and firewall settings if you face any issues with network access.
In this guide, we have tried out the steps to configure a VirtualBox Virtual Machine to work on the LAN ethernet networking using a Bridged adapter.
Another commonly used VBox network setting is NAT. NAT networks also support limited two-way network connectivity by port forwarding while isolating the VM from the LAN network. You can refer to this guide for more information: How to configure VirtualBox VM to work on a virtual NAT router.
Here is another guide explaining how to forward a webserver port for example port 80 on VBox NAT network: How to access VM port from local host machine