Patch to fix Vagrant 1.8.6 networking issue

There’s a bug in the latest release of Vagrant that can affect VMs built with the XNAT Vagrant project. The immediate symptom is that you won’t be able to reach a newly created VM through its IP address. The cause is a screw-up in the network interface management code inside of Vagrant that inserts the Ethernet device for the private network IP (that is, the IP that gets set through the Vagrant configuration) with the same ID eth0 as the already existing Ethernet device. Every once in a while, it will actually work in spite of this, but mostly it just fails.

I found a fix for this problem in the Vagrant issue tracker on github and managed to get it working with our Vagrant project. I’ve attached a patch to this post that you can apply over the xnat-vagrant repo until Vagrant itself is updated (this fix is already in the development code, so it’ll be part of the release in Vagrant 1.8.7). To apply this patch, just save it somewhere, change to your xnat-vagrant folder, wherever that may be, then run:

$ git apply /path/to/xnat-vagrant-1.8.6.diff

Clear the patch by running:

$ git checkout scripts/Vagrantfile
$ rm scripts/network_interfaces.rb

Follow this post to be notified about any updates. If you find any issues or have problems, feel free to comment as well.