Oracle VirtualBox is a type-2 hypervisor that is popular on Windows, macOS, Linux, and Solaris. For years I used VMWare Workstation and then switched to Hyper-V when it became part of Windows 8, largely because it was free and promised better performance as a type-1 hypervisor.
Then earlier this year, I decided to give VirtualBox a spin. I was curious as to why some people preferred it over Hyper-V. Initially, I was doubtful that VirtualBox could provide the same performance as Hyper-V but in practice, I’ve found the difference between the two to be negligible. But the main reason I’m still using VirtualBox is that it is more user-friendly if you need to interact with the VM. For example, VirtualBox supports file drag and drop between host and source, and vice versa. USB passthrough support is also more seamless than Hyper-V.
VirtualBox might be easier to use than Hyper-V but not everything is great. For instance, trying to get a high screen resolution inside virtual machines (VM) seems almost impossible. Also, 64-bit VMs aren’t supported in VirtualBox if another hypervisor, like Hyper-V, is also installed on the system. And to be fair to Hyper-V, it is a server solution that is provided in Windows 10 for the convenience of IT professionals rather than as a user-friendly virtualization solution for everyone.
But while I’ve found performance in VirtualBox to be excellent, one aspect hasn’t lived up to expectations. Using the default network configuration, browsing the web and transferring files is frustratingly sluggish.
Install a Paravirtualized Network Adapter
After some digging around, it seems that VirtualBox is optimized for Linux guests. Oracle’s documentation suggests the best way to get optimal network performance is to use the Paravirtualized Network (virtio-net) adapter type. By default, if you use the out-of-the-box settings, VirtualBox uses an emulated Intel PRO/1000 MT adapter for Windows VMs. But I discovered this is the root of the performance issue.
Unfortunately, it’s not quite as simple as just changing the Adapter Type field to Paravirtualized Network under Advanced in your VM’s network settings. You will also need to load drivers into Windows before you can use this adapter type. In the instructions below, I show you how to change your adapter type and get it working for better network performance. Before you follow the instructions, you should have at least one VM configured in VirtualBox using the default settings for Windows 10.
- Open VirtualBox Manager on your PC.
- In the list of VMs on the left, select the VM that you want to manage.
- In the list of actions on the top right, click the Settings
Before you can change the network settings for the VM, you need to make sure that it isn’t running. If the VM is running, log in and shut it down before proceeding.
- In the Settings dialog, click Network in the list of options on the left.
- Adapter 1 should be enabled as part of the default VM configuration. Make sure that the Adapter 1 tab is selected. You can select another adapter if you have more than one configured.
- On the adapter tab, expand the additional settings by clicking Advanced.
- Using the Adapter Type dropdown menu, select Paravirtualized Network (virtio-net).
- Click OK to commit the change.
- Now start the VM by clicking Start in the right of VirtualBox Manager.
- Log in to Windows and notice that the network adapter is no longer working.
Download Paravirtualized Network Adapter Drivers for Windows
To get the network adapter working again, you’ll need to download and install drivers for the device. Red Hat maintains signed Windows drivers for paravirtualized network adapters, which you can download here. Scroll down to Direct downloads and download the stable virtio-win iso.
Install Virtio-Win Drivers in Windows
Now all that’s left to do is install the drivers in Windows. First, we’ll attach the ISO to your VM and then use Device Manager to install the driver.
- Make sure your VM is still selected in the list of VMs on the left of VirtualBox Manager.
- On the right, look at the Storage section and find the Optical Drive. It’s usually attached to SATA Port 1. There you will see either Empty or the name of an attached image file. Click [Optical Drive] and then select Choose disk image from the context menu.
- In the file selector dialog, open the ISO file downloaded in the previous steps.
- The name of the ISO file should now appear to the right of [Optical Drive].
- Log in to your Windows VM.
- Right click the Start menu and select Device Manager from the menu. You will need to be logged in as an administrator to install the driver.
- In Device Manager under Network adapters, you should see an adapter that is highlighted as not working. Right click the adapter and select Update driver from the menu.
- On the Update Drivers screen, click Browse my computer for driver software.
- Click the Browse button to the right of Search for drivers in this location.
- In the file dialog, make sure that the optical drive is selected and then click OK. It should be listed as CD Drive.
- Make sure that Include subfolders is checked and then click Next.
- Windows will automatically find the right driver on the disk image and install it. You will need to confirm the installation of the driver by clicking Install in the Windows Security dialog.
Once the installation has completed, Device Manager will refresh automatically and display Red Hat VirtIO Ethernet Adapter instead of a generic Ethernet Controller that it doesn’t recognize. If you close Device Manager, you should see the network adapter is now working in Windows. Not only should it be working but it should work quickly and support up to 10GB transfer speeds.
Further Improving Network Performance
There are several different types of network you can configure in VirtualBox, including Network Address Translation (NAT), Internal, and Bridged. They all have their uses, and advantages and disadvantages. Check out 6.11. Improving Network Performance in Oracle’s documentation here to get a better idea of the performance of each network type.
The post How to Improve Network Performance in Windows VirtualBox Guests appeared first on Petri.