Creating a OnePK Vagrant Box

Document created by patrick.robinson on May 11, 2014Last modified by patrick.robinson on May 13, 2014
Version 6Show Document
  • View in full screen mode



Vagrant is a tool to easily stand up new development and test environments by pre-packaging Virtual Machine templates. Once these templates are packaged, new servers can be provisioned using the command "vagrant up". Once started you can SSH to a vagrant box using "vagrant ssh".


This guide is written using VirtualBox, although I've provided notes on differences with VMware I've not tested this.


Configuring the OnePK VM


First we need to make some changes to the OnePK VM. Import the OVA into VirtualBox, in this example we call the Virtual Machine "onepk-export" but you can name it whatever you like.


Once booted make the following changes:


  1. Change cisco user password to vagrant (this is optional, but vagrant best practise)
  2. Add the vagrant insecure public key (found here) to /home/cisco/.ssh/authorized_keys, ensuring .ssh folder has permissions of 0700 and authorized keys has perms of 0600
  3. Add cisco to /etc/sudeors with NOPASSWD option as so, ensuring it's below the sudo group as sudoers is last match

    # User privilege specification

    %sudo   ALL=(ALL:ALL) ALL



    cisco   ALL = NOPASSWD: ALL

  4. Replace the contents of /etc/udev/rules.d/70-peristent-net.rules with the following

    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", DEVPATH=="*pci0000:00/0000:00:11.0/*", NAME="eth0"

    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", DEVPATH=="*pci0000:00/0000:00:08.0/*", NAME="eth1"

  5. Install VirtualBox  guest additions (or VMware Tools if using VMware)
  6. VirtualBox Guest Additions 4.3.10 has a bug where some binaries aren't mapped to /usr/lib, causing vagrant to fail to mount the shared folder. To fix this run:

    sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions

  7. Shutdown the VM

Create Vagrant files


In an empty directory, download the attached files Vagrantfile and metadata.json.


If using VMware modify the metadata.json file and change the provider from "virtualbox" to "vmware"


Export Virtual Machine as Vagrant Box


From the directory you created in the previous step run the following command to export your OnePK Vagrant Box

vagrant package --base "onepk-export" --output


Making the box easily accessible


Once this is done you can easily store the .box file on a ftp or http server and change the "config.vm.box_url" option in the Vagrantfile to the boxes location.


Using Vagrant

Visit the website Vagrant