Beginning with EOS 4.15.2F, vEOS is available as a Vagrant box for VirtualBox. This single-file VM package makes it one of the fastest ways to get started with vEOS and is ideal for testing in automated environments. Multiple VMs may be defined within a single Vagrantfile, including non-vEOS VMs, allowing an entire topology to be defined in a single file. A customized Vagrantfile, checked in to revision control, is an effective way for multiple users to consistently recreate a complete environment.
Prior to EOS 4.15.2F, the vEOS vmdk and Aboot.iso files can be converted to a Vagrant box by following the directions at https://github.com/jerearista/vagrant-veos/.
- VirtualBox hypervisor
- Vagrant VM automation tool
- vEOS-lab-<version>-virtualbox.box – available from Arista Software Downloads
Once VirtualBox and Vagrant are installed, download a box and add it to your inventory. Adding a box to your local inventory allows you to use short-names to refer to boxes.
host:~ user$ vagrant box add --name vEOS-lab-<version> ~/Downloads/vEOS-lab-<version>-virtualbox.box host:~ user$ vagrant box list vEOS-lab-184.108.40.206F (virtualbox, 0)
Create a directory for a new environment, then initialize the environment using the short-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.
This is a good time to look through the newly created ‘
Vagrantfile‘ and add or modify options as desired. Once complete, boot the VM with ‘
vagrant up‘, then connect to vEOS with ‘
vagrant ssh‘. During the ‘vagrant up’ process, expect to see a series of “Warning: Connection timeout. Retrying…” messages.
host:veos user$ vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Importing base box 'vEOS-lab-220.127.116.11F'... ==> default: Matching MAC address for NAT networking... ==> default: Setting the name of the VM: veos_default_1444653159625_9472 ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat ==> default: Forwarding ports... default: 22 => 2222 (adapter 1) ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: root default: SSH auth method: private key default: Warning: Connection timeout. Retrying... default: Warning: Connection timeout. Retrying... default: Warning: Connection timeout. Retrying... default: Warning: Connection timeout. Retrying... default: Warning: Connection timeout. Retrying... default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... default: Removing insecure key from the guest if its present... default: Key inserted! Disconnecting and reconnecting using new SSH key... ==> default: Machine booted and ready! ==> default: Checking for guest additions in VM... default: No guest additions were detected on the base box for this VM! Guest default: additions are required for forwarded ports, shared folders, host only default: networking, and more. If SSH fails on this machine, please install default: the guest additions and repackage the box to continue. default: default: This is not an error message; everything may continue to work properly, default: in which case you may ignore this message. host:veos user$ vagrant ssh Arista Networks EOS shell -bash-4.1# FastCli localhost>
NOTE: Using ‘
vagrant ssh‘ will take you to a bash prompt instead of the EOS CLI. To get to the switch CLI, run ‘
FastCli‘ from bash or have vagrant start the command with ‘
vagrant ssh -c FastCli‘.
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
Additional Vagrantfile Configuration
Below are several common configuration options one might use. See the Vagrant documentation for a complete list of customization options.
Adding / Configuring interfaces
Using the Vagrantfile, Ethernet interfaces may be added to a VM and assigned to the desired VirtualBox network. In the example, below, a dummy auto-config address is used in the Vagrantfile but will have no effect within vEOS.
Vagrant.configure(2) do |config| # Create Ethernet1 config.vm.network 'private_network', virtualbox__intnet: true, ip: '169.254.1.11', auto_config: false # Create Ethernet2 config.vm.network 'private_network', virtualbox__intnet: true, ip: '169.254.1.11', auto_config: false config.vm.provider :virtualbox do |vb| # Networking: # nic1 is always Management1 which is set to dhcp in the basebox. # Patch Ethernet1 to a particular internal network vb.customize ['modifyvm', :id, '--nic2', 'intnet', '--intnet2', 'vEOS-intnet1'] # Patch Ethernet2 to a particular internal network vb.customize ['modifyvm', :id, '--nic3', 'intnet', '--intnet3', 'vEOS-intnet2'] end end
When developing eAPI applications, it can be useful to setup port forwarding to a vEOS box, then configuring the application to localhost on the configured port.
In the Vagrantfile:
config.vm.network 'forwarded_port', guest: 443, host: 8443
Then eAPI would be accessible via ‘https://localhost:8443/command-api’
Accessing the console
When working with Zero-Touch provisioning, you can access the VM’s console by adding the following setting in the Vagrantfile:
config.vm.provider :virtualbox do |vb| # Display the VirtualBox GUI when booting the machine vb.gui = true end
Provisioning EOS configuration from Vagrant
Using the shell provisioner in the Vagrantfile, EOS configuration can be specified allowing an environment to be brought up to a desired starting state without logging in to a VM.
# Enable eAPI in the EOS config config.vm.provision 'shell', inline: <<-SHELL FastCli -p 15 -c "configure username eapiuser privilege 15 role network-admin secret icanttellyou management api http-commands no shutdown end copy running-config startup-config" SHELL
Configuring the amount of RAM
The box defaults to 2048 MB of RAM. This value may be modified in the Vagrantfile.
config.vm.provider :virtualbox do |vb|
# Customize the amount of memory on the VM:
vb.memory = '2048'
Additional sample Vagrantfiles
Additional examples of Vagrantfiles may be found at https://github.com/jerearista/vagrant-veos/tree/master/examples