The purpose is to have several VM to reproduct production environment, simulate network failure. We start simply with a web machine and an external database (and specific disk size for that)

Install vagrant plugins

vagrant plugin install vagrant-vbguest
vagrant plugin install vagrant-disksize

Create your multi machine environment

cd {yourdir}/workspace/envdev/
mkdir my-multi-machine
cd my-multi-machine
vagrant init

Edit your Vagrantfile

Vagrant.configure("2") do |config|
	# WEB
	config.vm.define "web", primary: true do |web| = "debian/stretch64"
		web.vm.box_check_update = false "private_network", ip: ""
		web.vm.synced_folder ".", "/vagrant", owner: "vagrant", group: "vagrant", type: "virtualbox"
		web.vm.synced_folder "../../", "/home/vhosts", owner: "vagrant", group: "vagrant", type: "virtualbox"
		web.vm.provider "virtualbox" do |vb|
			vb.customize ["modifyvm", :id, "--name", "web"]
			vb.customize ["modifyvm", :id, "--memory", "512"]
			vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
			vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
	# DB
	config.vm.define "db" do |db| = "debian/stretch64"
		db.disksize.size = "30GB"
		db.vm.box_check_update = false "private_network", ip: ""
		db.vm.synced_folder ".", "/vagrant", owner: "vagrant", group: "vagrant", type: "virtualbox"
		db.vm.provider "virtualbox" do |vb|
			vb.customize ["modifyvm", :id, "--name", "db"]
			vb.customize ["modifyvm", :id, "--memory", "512"]
			vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
			vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]

“web” machine is the primary. When you vagrant ssh, you enter in it automatically. So to go in db, enter vagrant ssh db


Read the doc


If you want to get name (name.local)
Set {subconfig}.vm.hostname = "myname" and install apt-get install -y avahi-daemon libnss-mdns.

You can ping any other VM by using their hostname (plus .local at the end)