Vagrant tip #4 Configuring a multimachine static environment

In this tip we will see how to configure a Multimachine Fedora ennvironment with two Fedora machines bound on a static IP address.

Vagrant and Multi-VM environments allow developers to model complex multi-server setups on a single development machine

The IP addresses we will reserve to the Fedora Machines are the following ones:

  • 192.168.122.10
  • 192.168.122.20

Here is our Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.provision :shell, path: "boot.sh"
  config.vm.network :public_network, :bridge => 'enp0s25', :dev => 'enp0s25'

  config.vm.define "fedora1" do |fedora1|
    fedora1.vm.box = "fedora/23-cloud-base"
    fedora1.vm.network "private_network", ip: "192.168.122.10"
  end

  config.vm.define "fedora2" do |fedora2|
    fedora2.vm.box = "fedora/23-cloud-base"
    fedora2.vm.network "private_network", ip: "192.168.122.20"
  end
end

Launch your VMs:

$ vagrant up

Now check the status of your VMs:

$ vagrant status
Current machine states:

fedora1                   running (libvirt)
fedora2                   running (libvirt)

Now you can log into the individual machines with:

$ vagrant ssh fedora1

or to the other VM with:

$ vagrant ssh fedora2

Found the article helpful? if so please follow us on Socials