Using Vagrant to create an automated virtualised Juniper Lab

Using Vagrant to create an automated virtualised Juniper Lab

Throughout my education, job experience and out of work projects I have used various ways to study; using videos from places such as Pluralsight, courses and hand-on labs with physical/virtual equipment.

My first step into the Networking world was through Cisco, I entered a great skills competition (World Skills UK). This enabled me to study and practice the wonders of networking, and I fell in love. This also allowed me to study various other elements (Microsoft, Linux, VMware etc). These were all easy for everyone to implement virtually at home. However, Juniper I have found was a different story, I could only find the use of Junos Olive, which is great however I was looking for something which provides more.

I absolutely love networking, I also love being able to script in many different languages and automate various tasks, this is how I Found Vagrant. Vagrant is an open source tool for building and managing virtual machine environments; this decreases the development environment setup time and provides the virtual machine "ready to use" without you having to do anything, brilliant I know.

Prerequisites

1) Virtualbox - This is a Hypervisor that will allow the Juniper Devices to run in a virtual machine. VMware is currently not supported at the moment.

2) Vagrant - This is the tool which will configure our Virtual Machines for us using the configurations stored within the Git Repo.

3) Git - This is a version control tool we will be using to download the Juniper-Vagrant Repositories, which will also contain all the needed configurations for running this machine.

How to Create a Simple vQFX Juniper Lab.

There are 2 different versions of the vQFX we can run, full and light.

Full Mode

In full mode, it requires 2 Virtual Machines for each instance you create:

  • 1 Routing Engine VM, running Junos (vqfx10k-re.box), 1GB Ram, interface type: 82540EM
  • 1 Packet Forwarding Engine, running Linux (vqfx10k-pfe.box), 1.5/2GB Ram, interface type: 82540EM

These 2 VM's need to be interconnected with a dedicated private network between them on their first interface. Up to 8 network interfaces are supported and will be named xe-0/0/0 to xe0/0/11.

Only a few features are not supported in this mode compared to a real vQFX10k.

Light Mode

In light mode, only 1 Routing Engine VM, running Junos is required for each instance.

Up to 5 interfaces are supported and will be named em3 to em7.

Family ethernet-switching is not supported in this mode.

Installation

Once you have all the prerequisites installed, we can use Git to "clone" the Github repository that contains the configurations we need for running our lab (Download it to our local machine).

Depending on you Operating System, open a terminal. If in Windows use the Git Bash terminal, navigate to a directory you want to place this in (Documents). Then run the following command to clone the repository.

git clone https://github.com/Juniper/vqfx10k-vagrant

Once the repository has been cloned we need to navigate to the vQFX directory. Navigate to the vagrant environment for the Full mode vQFX.

cd vqfx10k-vagrant-full-1qfx

Within this directory there will be a file named "Vagrantfile" This contains instructions to Vagrant for downloading and configuring a virtual machine. What this means for use is we just run this, get a cup of tea, and wait until everything is setup for us.

If you would like to have more than one vQFX so you can perform VLAN's and trunking etc then we need to change the Vagrant file to install 2 vQFX boxes for us. This is available here: VagrantFile. Copy and paste this file to the directory you will are currently in.

Now we need to simply run this simple command to get everything started:

vagrant up --no-provision

This will download, build and start your virtual machines ready for use, no need to do anything else (Grab a nice cup of tea while you wait).

The "--no-provision" flag instructs Vagrant to skip the Ansible provisioning process so we can get straight to playing with Junos. I will follow up this article with another one that focuses on the various configurations made possible via Ansible.

You will see something like this:

Once everything is complete it will drop you back into the terminal. Now we can access this machine by simply entering:

If you have used the default Vagrantfile:

  • Vagrant ssh

However if you have used the attached Vagrantfile

Vagrant ssh vqfx-1

Vagrant ssh vqfx-2

This will log into the vfqx-1 and there you have it, and by using magic you now have a Juniper Switch emulated using automation to simplify everything.

Once you are done with the virtual machines and no longer need them, run a "Vagrant destroy" this will remove thew virtual machines from your machine for you.

I hope this has been informative, I had a lot of fun investigating and setting everything up. Have fun with this and create a lot of interesting projects. This is definitely the way forward for creating visualised environments in my opinion.

To view or add a comment, sign in

More articles by Shane Carpenter

Others also viewed

Explore content categories