Use Vagrant with Juniper Junos VMs on Windows

vagrant-junosThis is a short guide for using Vagrant with Virtual box to spin up Juniper Junos virtual machines on Windows. It makes practicing your Juniper Junos skills without an EX or SRX device possible and easy. For this guide Juno firefly perimeter will be used since some kind individuals have create Vagrant boxes for us.

Use Vagrant with JunOS VM Tutorial on Windows

Vagrant uses Virtualbox to spin up a virtual machine so you will need Virtualbox installed for Vagrant to manage

Next you will need Vagrant latest version

Install Vagrant plugins for JunOS, run this in a Windows command prompt

vagrant plugin install vagrant-junos

To fix this error Message: LoadError: cannot load such file — vagrant-host-shell

vagrant plugin install vagrant-host-shell

Create a Vagrant folder somewhere (e.g. c:\Vagrant)
Run a command prompt and enter the folder

cd c:Vagrant

Initialize the Juniper environment full Juniper vagrant boxes list by typing this in the command prompt

vagrant init juniper/ffp-12.1X47-D15.4-packetmode

Edit the Vagrantfile which is located in C:\Vagrant\Vagrantfile and find this section and uncomment the lines by deleting # so it matches below.
It will enable the Virtualbox GUI so you can set the root password and be able to SSH using Putty without converting the Vagrant SSH keys (how to convert SSH keys is shown later).

config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
end

Start the vagrant Juniper Junos box, by default Vagrant expects Virtualbox to be installed so it can use that to bring up the virtual machine

vagrant up

If you are using VMPlayer or VMWorkstation (note this requires a paid version of Vagrant unfortunately)

vagrant up --provider vmware_desktop

You will want to SSH into the Junos virtual machine, if you have Cygwin installed it is as simple as this (must be run in the c:\Vagrant folder)

vagrant ssh

If you want to use Putty you will have to get convert the vagrant SSH key so Putty can use it or set the root password by using the Virtualbox gui that popped up when you ran vagrant up.

In Windows, you must convert the Vagrant SSH private key in c:\Vagrant\.vagrant\machines\default\virtualbox\private_key using Puttygen

Run Puttygen, click Load key and then save it as ppk, you don’t have to set a passphrase

To use the ppk in Putty, choose connection in category pane, choose SSH, then auth.

Click Browse and choose the ppk file, now you can connect by entering root as the user when prompted

Play with your Vagrant machine to your heart’s content

Additional Vagrant Commands

Reload the vagrant machine (turn off and then back on again)

vagrant reload

Destroy the Vagrant machine (you can bring it back up again)

vagrant destroy

Suspend the Vagrant machine and save its state

vagrant suspend

Turn the Vagrant Junos machine off

vagrant halt

Leave a comment