Use Vagrant with Juniper Junos VMs on Ubuntu

vagrant-junosThis is a short guide for using Vagrant with Virtual box to spin up Juniper Junos virtual machines on Ubuntu. It makes practicing your Juniper Junos skills without an EX or SRX device possible.

Use Vagrant with JunOS VM Tutorial on Ubuntu/Debian

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

sudo apt-get install virtualbox -y

Install Vagrant First (requires 1.7) latest version

wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.4_x86_64.deb
sudo dpkg -i vagrant_1.7.4_x86_64.deb

Install Vagrant plugins for JunOS

vagrant plugin install vagrant-junos

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

vagrant plugin install vagrant-host-shell

Initialize the Juniper environment full Juniper vagrant boxes list

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

Adjust the vagrant file to allow the GUI of the Junos virtual machine to be displayed

nano Vagrantfile

Make it match below, note that this is only for Virtualbox, it can be useful to have a bridged adapter too, adjust the IP to a value on your network and wlan0 to eth0 if you are using ethernet. Also force Virtualbox to only use 1 CPU core and 512 MB of RAM instead of the default.

   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"
     vb.cpu = "1"
      #config.vm.network "public_network", bridge: 'eth0'
     config.vm.network :public_network, ip: "192.168.40.250", :bridge => 'wlan0',
        :use_dhcp_assigned_default_route => true
   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

vagrant ssh

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
Advertisements

2 thoughts on “Use Vagrant with Juniper Junos VMs on Ubuntu

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s