• Creating A Multi-node vEOS Vagrant Enviroment

Print Friendly, PDF & Email


Beginning with EOS 4.15.2F, vEOS is available as a Vagrant box for VirtualBox. Vagrant is great whether you are simply getting started with vEOS or want to easily create a complex test environment.  With Vagrant, multiple VMs may be defined within a single ‘Vagrant file’, including non vEOS VMs allowing for an entire topology to be instantiated using a single file. For more info on Vagrant, check out their documentation

This document will go through the details of how to use the predefined Vagrantfile shared below to instantiate a Spine&Leaf topology with vEOS. The topology that will be created is shown below: 


The Vagrant File will spin up 2 Spines and 3 leafs. The above topology creates a flexible environment that allows you to test several Arista configs. Note there are also 3 interfaces available to attach to host VMs. The file has comments describing each section, and can be easily modified to instantiate more VMs or change the topology.  



Step 1:

To start, download and install VirtualBox and Vagrant. After both environments are setup, download the latest prepackaged vagrant box (e.g. vEOS-lab-4.20.1F –virtualbox.box). Note this will require you have an Arista account setup which is free to do. If the latest vEOS image is not available as a virtualbox to download,  you can create your own virtualbox base box from vEOS by following the instructions on this page. 


 Step 2:

Create and name your vagrant box for vEOS and add it to your inventory using the command shown below. 

host$ vagrant box add --name vEOS-lab-<version> ~/Downloads/vEOS-lab-<version>-virtualbox.box

host$ vagrant box list
ansible/tower    (virtualbox, 3.0.3)
vEOS-lab-4.17.2F (virtualbox, 0) 

As seen above I have two boxes one for Ansible and one I have created for vEOS.  Create a directory for a new environment, then initialize the environment using the short-name ( –name)  you gave the box image above.  This creates an initial Vagrantfile with default settings.

host:~ user$ mkdir veos
host:~ user$ cd veos

host:veos user$ vagrant init vEOS-lab-<version>
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

Have a look at the default Vagrantfile to get an understanding on how its structured, it is a good starting point to learning how an environment is instantiated from the file. Note, from the default file, only one VM is configured to be started. Now let us replace the default file with the file we have created to spin up a multi-node leaf/spine fabric. Delete the default file from the environment directory we have created and replace it with the customized file. 

Once completed, boot the VMs with the vagrant up command. You should expect to see 3 leaf switches and 2 spines boot-up. See snippet below: 

host:vEOS host$ vagrant up
Bringing machine 'SW1' up with 'virtualbox' provider...
Bringing machine 'SW2' up with 'virtualbox' provider...
Bringing machine 'SW3' up with 'virtualbox' provider...
Bringing machine 'Spine' up with 'virtualbox' provider...
==> SW1: Importing base box 'vEOS-lab-4.17.2F'...
==> SW1: Matching MAC address for NAT networking...
==> SW1: Setting the name of the VM: vEOS_SW1_1486413493485_7680
==> SW1: Clearing any previously set network interfaces...
==> SW1: Preparing network interfaces based on configuration...
    SW1: Adapter 1: nat
    SW1: Adapter 2: intnet
    SW1: Adapter 3: intnet
    SW1: Adapter 4: intnet
==> SW1: Forwarding ports... SW1: 80 (guest) => 8081 (host) (adapter 1) SW1: 22 (guest) => 2222 (host) (adapter 1) ==> SW1: Running 'pre-boot' VM customizations... ==> SW1: Booting VM... ==> SW1: Waiting for machine to boot. This may take a few minutes... SW1: SSH address: SW1: SSH username: root SW1: SSH auth method: private key SW1: SW1: Vagrant insecure key detected. Vagrant will automatically replace SW1: this with a newly generated keypair for better security. SW1: SW1: Inserting generated public key within guest... SW1: Removing insecure key from the guest if it's present... SW1: Key inserted! Disconnecting and reconnecting using new SSH key... ==> SW1: Machine booted and ready! ==> SW1: Checking for guest additions in VM... SW1: No guest additions were detected on the base box for this VM! Guest SW1: additions are required for forwarded ports, shared folders, host only SW1: networking, and more. If SSH fails on this machine, please install SW1: the guest additions and repackage the box to continue. SW1: SW1: This is not an error message; everything may continue to work properly, SW1: in which case you may ignore this message. ==> SW1: Configuring and enabling network interfaces... ==> SW1: Running provisioner: shell... SW1: Running: inline script ==> SW1: Copy completed successfully. ==> SW2: Importing base box 'vEOS-lab-4.17.2F'... <snip>

Once the VMs have been created and started you can either access them from VirtualBox or using vagrant ssh <hostname>.  When you logon to the switch, you will be in the bash prompt instead of EOS CLI. To get to the switch CLI, issue the FastCli command from bash or when doing ssh from vagrant run the following vagrant ssh -c FastCli.

host:vEOS host$ vagrant ssh sw1

Arista Networks EOS shell -bash-4.3#

See ‘vagrant help’ for additional commands including:

  • vagrant reload – Restarts the VM, reading the most current Vagrantfile
  • vagrant halt – Powers off the VM
  • vagrant suspend – Pauses the VM
  • vagrant destroy – Stops and deletes all VM state (resets to the initial box)

Once halted or destroyed, the entire vagrant environment may be removed by deleting the environment directory:

host:veos user$ cd ..
host:~ user$ rm -rf veos


  • In the  multi-node VagrantFile attached the image_version variable should match the name of the box you created earlier in step 2
  • There are comments throughout the Vagrantfile, so you can easily change it to spin up more vEOS switches and customize it to your needs
  • Great Reference article:  https://eos.arista.com/using-veos-with-vagrant-and-virtualbox/



Get every new post on this blog delivered to your Inbox.

Join other followers: