Prevent host-only VirtualBox network from vanishing after suspend/resume

The host-only network vboxnet0 that I set up to enable my VirtualBox virtual machines to communicate with the host laptop vanished after each suspend/resume cycle.

I had performed a clean install of Ubuntu 15.10 just before the problem occurred. Thanks to this comment on a VirtualBox ticket I remembered what needs to be done:

Add the following to /etc/NetworkManager/NetworkManager.conf:


Afterwards, restart the VirtualBox service to bring the interface back up again:

sudo service vboxdrv restart

You need to shut down all running virtual machines for this to work.