Virtual router instances Juniper vSRX, Juniper vMX and GNS3

From Iwan
Jump to: navigation, search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

In order to build Proof of Concept networks to test new features in mixed-vendor networks I have decided to create a setup with some virtual routers that I can test and use together with my existing lab environment.

I am going to implement:

  • Juniper vSRX on ESXi
  • Various Cisco IOS routers trough GNS3 on a Ubuntu VM (on ESXi)
  • Juniper vMX on ESXi

Juniper vSRX on ESXi

I downloaded the "junos-vsrx-12.1X47-D20.7-domestic.ova" file and deployed the OVA (trough the vSphere desktop client) using this and this link.

In order to get make sure the vSRX behaves like a router (packet-mode) a few commands needed to be executed:

root# set system host-name NL-RTD01-VSRX01
root# set system root-authentication plain-text-password
root# set interfaces ge-0/0/0 unit 0 family inet address x.x.x.x/xx
root# delete security
root# set security forwarding-options family mpls mode packet-based
root# set security forwarding-options family iso mode packet-based
root# set security forwarding-options family inet6 mode packet-based

GNS3 on a Ubuntu VM 〈on ESXi〉

I started with installing the Ubuntu Server (ubuntu-14.04.3-server-amd64.iso). Ubuntu server installs itself without the GUI that we need for GNS3 later, so I used this link to install the gui with the commands:

sudo apt-get update
sudo apt-get install ubuntu-desktop

I used this guide install all the dependancies for GNS3 and GNS3 itself.

Once GNS3 was installed I created some extra directories (images, projects, configs, ie, capture, and tmp) as a best practice that I found here.

I copied all my IOS images to the "images" folder and added some routers using this link.

IOU licence generator

There is an option to also use IOU images trough GNS3. In order to do this you need to have an IOU licence which can be created with the script found on this website.

Create a file named "CiscoKeyGen.py" with the following content:

root #! /usr/bin/python
print "\n*********************************************************************"
print "Cisco IOU License Generator - Kal 2011, python port of 2006 C version"
import os
import socket
import hashlib
import struct
root # get the host id and host name to calculate the hostkey
hostid=os.popen("hostid").read().strip()
hostname = socket.gethostname()
ioukey=int(hostid,16)
for x in hostname:
 ioukey = ioukey + ord(x)
print "hostid=" + hostid +", hostname="+ hostname + ", ioukey=" + hex(ioukey)[2:]
root # create the license using md5sum
iouPad1='\x4B\x58\x21\x81\x56\x7B\x0D\xF3\x21\x43\x9B\x7E\xAC\x1D\xE6\x8A'
iouPad2='\x80' + 39*'\0'
md5input=iouPad1 + iouPad2 + struct.pack('!L', ioukey) + iouPad1
iouLicense=hashlib.md5(md5input).hexdigest()[:16]
root # add license info to $HOME/.iourc
print "\n*********************************************************************"
print "Create the license file $HOME/.iourc with this command:"
print " echo -e '[license]\\n" + hostname + " = " + iouLicense + ";'" + " | tee $HOME/.iourc "
print "\nThe command adds the following text to $HOME/.iourc:"
print "[license]\n" + hostname + " = " + iouLicense + ";"
root # disable phone home feature
print "\n*********************************************************************"
print "Disable the phone home feature with this command:"
print " grep -q -F '127.0.0.1 xml.cisco.com' /etc/hosts || echo '127.0.0.1 xml.cisco.com' | sudo tee -a /etc/hosts"
print "\nThe command adds the following text to /etc/hosts:"
print "127.0.0.1 xml.cisco.com"
print "\n*********************************************************************"

After the script is runned on the machine I got the following output:

ubuntu@NL-RTD01-GNS301:~/Downloads$ ./CiscoKeyGen.py

*********************************************************************
Cisco IOU License Generator - Kal 2011, python port of 2006 C version
hostid=*******, hostname=NL-RTD01-GNS301, ioukey=*******

*********************************************************************
Create the license file $HOME/.iourc with this command:
 echo -e '[license]\nNL-RTD01-GNS301 = *******;' | tee $HOME/.iourc 

The command adds the following text to $HOME/.iourc:
[license]
NL-RTD01-GNS301 = *******;

*********************************************************************
Disable the phone home feature with this command:
 grep -q -F '127.0.0.1 xml.cisco.com' /etc/hosts || echo '127.0.0.1 xml.cisco.com' | sudo tee -a /etc/hosts

The command adds the following text to /etc/hosts:
127.0.0.1 xml.cisco.com

*********************************************************************
ubuntu@NL-RTD01-GNS301:~/Downloads$ 

Juniper vMX on ESXi

For the Juniper vMX I used the file "jinstall-vmx-14.1R1.10-domestic.img" and this link to set it up in ESXi.