Enable Network Folder Sharing Between a VirtualBox Host and Guest VM

VirtualBox is Oracle’s free desktop virtualization platform that you can run on your Windows PC and create your own virtual machines for purposes such as testing new operating systems and software etc. You can create as many VMs as your host computer’s hardware can handle and these virtual machines will be able to use the host computer’s internet connection to go online. They VMs will also be able to communicate with each other on their shared internal network.


But what if you want to share files between your host and virtual machine? One method is to enable the Shared Folders feature on VirtualBox as seen in this video.

But if you want to configure your virtual machines to communicate with each other as if they were physical machines on the same network as your host computer then you can setup their network adapters so they can communicate on the same network as your host.

By default, VirtualBox VMs are configured to use NAT (Network Address Translation) to share the internet connection that they host PC is using. If you were to run the ipconfig command on a virtual machine, you would get a result similar to the image below (Your IP address will most likely differ than the example).

ipconfig virtualbox

As you can see, the VM has an Ethernet adapter with an IP address of 10.0.2.15 and is using a class C subnet mask of 255.255.255.0.

Running ipconfig on the host shows a VirtualBox Host-Only Network Ethernet adapter with an IP address of 192.168.56.1. This is the subnet you want to use to communicate with the host computer over the network.

Enable Network Folder Sharing Between a VirtualBox Host and Guest VM

To configure the virtual machine to communicate on this network, you will need to add an additional network adapter from the virtual machine’s settings. To add this adapter, the VM will need to be powered off.

When you get to the settings for the VM, go to the Network section on the left and then click on the tab that says Adapter 2. If you are already using Adapter 2 for something else, then you can go to Adapter 3 instead etc.

Once you are there you can check the box that says Enable Network Adapter and then select Host-only Adapter where it says Attached to. Then you can click the OK button and restart the virtual machine.

Enable Network Folder Sharing Between a VirtualBox Host and Guest VM

On the virtual machine, you can once again open a command prompt and run the ipconfig command and you should see your new Ethernet adapter configured on the same subnet as what was seen on your host for the Host-Only Network.

Enable Network Folder Sharing Between a VirtualBox Host and Guest VM

In order to get your networking to work you might need to make some changes to the Windows Firewall. To do this, do a search for Windows Defender Firewall and then click on Allow an app or feature through Windows Defender Firewall.

Windows firewall, add an app or feature

Then you can click on the Change settings button to enable editing mode for the firewall and scroll down to File and Printer Sharing and enable it by clicking the checkboxes.

Windows firewall file and printer sharing

You might also want to make sure that Network discovery and File and printer sharing are enabled in the Network and Sharing Center under Change advanced sharing options. The Network and Sharing Center can be found in the Windows Control Panel, or you can do a search for it.

Change advanced sharing settings
Turn on network discovery

After getting all of this set up, it will be up to you to configure folder sharing and permissions on your host computer and virtual machines. You will also need to know the login information for a user with appropriate access levels on the VMs for when you are asked to provide credentials to access shared folders.



Related Posts

© 2024 Online Computer Tips
Website by Anvil Zephyr