I’ve always been a big fan of Virtualbox. It has some of the best tools for converting images between different hypervisors and is a leader in its support for different configurations. Virtualbox is a great option for testing out new or different OS’s and configurations. I don’t have to run a crippled hypervisor on my system or run some trialware just to try the latest bits.
Microsoft made a lot of changes to the Windows 8 network stack. One of the more obvious is the speed in which network connections resume from sleep or standby. Unfortunately, since running Virtualbox on the Dev Preview and on the Final Release, a bug in the Virtualbox Bridged Adapter breaks network connectivity. Below are a few ways to work around this issue. You can find more at the bugtraq I submitted to Oracle here: https://www.virtualbox.org/ticket/10317.
Option 1: Disable Virtualbox Bridged Adapter
For me, NAT adapters had too many draw backs to my testing and use. But, this is how I have been running until I got off my laurels and automated the disable/enable routine outlined in option 3.
- In Windows, go to: Control PanelNetwork and InternetNetwork Connections
- Right click the affected/in-use network adapter and select properties
- In the items list, uncheck the VirtualBox Bridged Network Adapter
- Hit OK and you should be all set
Option 2: Disable/Re-Enable Adapters After Resuming
Doing this manually is extremely laborious and usually ends up with you giving up on bridged adapters. Either select option 1 or 3. But, it may save you if you just installed Virtualbox and haven’t had the chance to implement option 1 or 3.
- In Windows, go to: Control PanelNetwork and InternetNetwork Connections
- Right click the affected/in-use network adapter and select disable
- Right click the affected/in-use network adapter and select enable
Option 3: Automate Option 2
The following steps will create a task that will automatically disable and reenable you network adapters upon resume. This will slow down reconnects but will allow the use of the VirtualBox Bridged Network Adapter.
- Create and save a script with the following command:
- gwmi Win32_NetworkAdapter -EnableAllPrivileges | ? { $_.PhysicalAdapter -and $_.NetEnabled } | % { $_.Disable(); $_.Enable() }
- Open the Event Log and go the the System Event Log
- Look/Search/Filter for Event ID 1, Source Power-Troubleshooter
- Right click on Event and select “Attach Task to this Event”
- In the Action section, under Program/script, enter: powershell.exe
- In the Arguments section, enter: c:scriptsvirtualbox-hack.ps1
- Make sure the path and name matches what you named your script in step 1
- On the finish screen, check the box “Open the Properties diaglog…” and press OK
- On the General tab of the task properties, select:
- “Run whether user is logged in or not”
- “Run with highest privilges”
- Select OK. It should prompt you for credentials. Enter the credentials and you are done.
Thanks! Exactly what I was looking for
Thanks! This is really useful. I had an issue where windows 8.1 doesn’t reconnect to wifi properly after sleep/resume (independent of any virtualbox use… although I DO have it installed…). Now things are working fine. I made a small tweak and added a “sleep 1” statement before your command in the script to give things a little extra time to wake up. Thanks again.
I’m seeing the problem with the latest Virtual Box (4.3.2) when the computer is restarted. I’m not using sleep or hibernate but any reboot has the issue. It looks like the VB Host-Only Network is getting initialized before the physical adapter, and then gets in the way of the physical adapter to start.