I have a few VirtualBox VMs that I use to test clustering, Gluster, Ceph and various other technologies. These hosts have a NAT interface as well as a host network for internal communications. This week I revamped several of my Vagrantfiles to use a host network and learned a few things in the process. To get a machine to ‘vagrant up’ and connect to an existing VirtualBox host network I first had to install the vbguest plug-in:
$ vagrant plugin install vagrant-vbguest
Copy iso file /usr/share/virtualbox/VBoxGuestAdditions.iso into the
mount: /dev/loop0 is write-protected, mounting read-only
Installing Virtualbox Guest Additions 5.1.6 – guest version is unknown
Verifying archive integrity… All good.
Uncompressing VirtualBox 5.1.6 Guest Additions for Linux………..
VirtualBox Guest Additions installer
Copying additional installer modules …
Installing additional modules …
vboxadd.sh: Building Guest Additions kernel modules.
Once this plugin was installed I added a “private_network” stanza similar to the following to each Vagrantfile:
config.vm.network “private_network”, ip: “188.8.131.52”
Then I ran ‘vagrant up’ and my machines could see the host networks my VirtualBox VMs reside on. Niiiiice!