Fix Network Connectivity with VVV

Published on 07 December 2016

At some point a few weeks ago, the network connectivity on my VVV instance started behaving inconsistently, and attempts to reprovision it would not only fail, but then caused the installation to hang when shut down, with VirtualBox showing the VM stuck at “Stopping”.

As I was in the middle of a few projects, I didn’t want to etch-a-sketch it and start from scratch. So I tried updating Vagrant, VirtualBox, brew, the vm, and VVV, but to no avail. And really, it probably made things worse.

The inability to shut down the VM without hanging didn’t seem to affect my development workflow, so I tolerated the issue until I realised some of my testing was impeded by the lack of connectivity. So I moved my development to a VPS that I use for demo and staging purposes, and started the process of wiping the slate clean with VVV.

Interestingly, it was still unable to get a network connection, and as a result, the provision would fail miserably because none of the necessary packages could be downloaded.

Searches on the VVV issue tracker kept showing suggestions of adding the following to the Vagrantfile. This was already in the repo, but was offered as a solution for users who didn’t have the most recent Vagrantfile[2].

config.vm.provider :virtualbox do |v|
    v.customize \["modifyvm", :id, "--natdnshostresolver1", "on"\]
    v.customize \["modifyvm", :id, "--natdnsproxy1", "on"\]
end

Something wasn’t sitting right with me about this, but I couldn’t put my finger on it. It certainly wasn’t resolving my issue, despite having come up in several threads with kudos and thanks following it. And so I pressed on, and had incorrectly come to the conclusion that perhaps an OSX update had shafted something. After several hours of fruitless tinkering, and with my eyes glazed over, I called for backup, the spouse.

Sure enough, it wasn’t long before he too circled back to those VirtualBox options. --natdnshostresolver1 was set to off, and my VVV instance started provisioning beautifully, and to some mild irritation on my part.

So if VVV isn’t provisioning due to no network connectivity, try that.

For what it’s worth, I’m running:

  • OSX El Capitan with the most recent software updates
  • Vagrant 1.9.0
  • VirtualBox 5.1.10
  • VVV 1.4

[1] Cloud Unavailable in Feature Image by Mourad Mokrane from the Noun Project

[2] For an explanation of these options, see: VirtualBox Manual: Chapter 9. Advanced topics