Building an Arista EOS Vagrant Libvirt Box

Arista EOS is supported by the netlab libvirt package command. To build an Arista EOS box:

  • Create an empty directory on a Ubuntu machine with libvirt and Vagrant.

  • Download vEOS disk image (.vmdk or .qcow2 file) into that directory

  • Execute netlab libvirt package eos virtual-disk-file-name and follow the instructions

Warning

  • The ‌netlab libvirt package eos command has been tested on Ubuntu 20.04 LTS and 22.04 LTS and might not work on other Linux distros.

  • On Ubuntu 22.04 LTS, libvirt-qemu user needs read and execute access to the VM disk file. It’s easiest if you create Vagrant boxes in a subdirectory of the /tmp directory.

Initial Device Configuration

During the box-building process (inspired by the step-by-step instructions by Brad Searle) you’ll have to copy-paste initial device configuration. netlab libvirt config eos command displays the build recipe:

Creating initial configuration for Arista EOS
=============================================

* Wait for the 'login' prompt
* Login as 'admin' (no password)
* Disable zero-touch with 'zerotouch disable'

NOTE: the management traffic is isolated in a dedicated management VRF (management).

===============
*** WARNING ***
===============
Disabling zero-touch (which will also cause a device reboot) is crucial.
With zero-touch enabled, the Vagrant box will acquire an IP address on the
management interface, but never start SSH, resulting in a stuck "vagrant up"
process.

After the system reboot

* Login as 'admin'
* Go into enable mode, enter configuration mode
* Copy-paste the following configuration

=============================================
aaa authorization exec default local
!
no aaa root
!
service routing protocols model multi-agent
!
vrf instance management
!
username vagrant privilege 15 secret sha512 $6$3kgdKcJLJ3j/0N51$a0YshIzKL3xtdwP6XXXRlY9B8yHFK/tLdg0I95YUIaW7oHqLsgK9TxMg8/0bL6VDkImuWT.g7WRKTxi8nNPtA1
username vagrant ssh-key ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key
!
interface Management1
   vrf management
   ip address dhcp
!
no ip routing
no ip routing vrf management
!
security pki key generate rsa 2048 default
security pki certificate generate self-signed default key default param common-name Arista
!
management api http-commands
   no shutdown
   !
   vrf management
      no shutdown
!
management api netconf
 transport ssh default
!
management api restconf
 transport https default
  ssl profile default
  port 6040
!
management security
 ssl profile default
  certificate default key default
!
management ssh
   vrf management
      no shutdown
!
no user vagrant shell
!
end
=============================================

* Save the configuration with 'wr mem'
* Poweroff the VM with 'bash sudo poweroff'

Mutating Virtualbox Boxes

Some releases of Arista vEOS are available as Virtualbox boxes. To use them with vagrant-libvirt:

  • Install Vagrant mutate plugin with vagrant plugin install vagrant-mutate

  • Download the box file from vendor web site

  • Install virtualbox version of the box file with vagrant box add filename –name boxname

  • Transform virtualbox box into libvirt box with vagrant mutate boxname libvirt

  • Remove the virtualbox box with vagrant box remove boxname –provider virtualbox command.

Warning

You might experience weird Vagrant errors when starting mutated vEOS boxes with ‌vagrant up or ‌netlab up command. Building a box yourself usually solves that problem.