20 Sep

Virtualizing a Cisco Nexus 9K with GNS3

I’m currently busy automating the configuration of network devices at a big bank in Belgium.

The tool we’re using is Infoblox NetMRI, which is basically a solution that can automate the provisioning and configuration of network devices via CLI.

However, since the beginning of the project, I found it annoying not to be able to test my NetMRI scripts when I was not at the customer.

Each time I had a new idea for automating something, I had to wait for the next day I would be onsite so that I could do the test on “real” devices.

Also, it’s sometimes just not a good idea to tests things on real hardware, and although the material on which you test your automation scripts is “lab”, you probably don’t want to break it either… especially when you’re playing with Cisco Nexus switches that cost dozens of k€/unit…

While I did have a virtual image of Infoblox NetMRI on my laptop running on VMware Workstation Player, I was eventually lacking the network devices on which to run my automation scripts…

But this time is over.


A couple weeks ago, after a bit of research, I decided to buy another 8 Gigs of RAM for my laptop, and to run the virtualized version of the network devices on my own laptop, with GNS3.

This way, I would be able to test any of my scripts anytime, anywhere, without bothering the customer for a remote session, or even having to go onsite for a small modification, and… for free!

After delivery and installation of my RAM, I was finally ready.

Let’s dig in!


GNS3 Setup

So basically, I went on with the installation of GNS3, which is made up of 2 components:


The all-in-one software GUI client enables creating the topology, but the actual devices images need to be virtualized by a server process.

This server part can be run on :

  • Local GNS3 server (without VM)
  • Local GNS3 VM
  • Remote GNS3 VM


The virtual machine is needed if you intend to virtualize advanced network device images such as NXOS from Cisco, or other vendors.

This is the case here since I want to virtualize a Nexus 9K image.

This is precisely what the wizard will show upon completion of the all-in-one software installation:

Just go ahead and select the first option.

Then chose localhost as GNS3 local server setting (will go back to this later on).

The connection should be successful:

Then GNS3 will ask you which virtualization platform you want to run to GNS3 VM on.

We’ll choose VMware here.

If not already done, download the ZIP file that contains the OVA file in our case via the download link and deploy it inside VMware Workstation Player.

Upon completion, the GNS3 OVA should appear in the drop down menu, and be available for selection.

Note: If you don’t see anything here, it means you’re probably lacking the VMware VIX API, which is the way GNS3 will control the GNS3 VM.

Download and install it from here

Once the API is installed, restart the GNS3 configuration and you should be good.

Don’t forget to add sufficient resources to that VM.

When clicking next, GNS3 should automatically configure and boot this VM with those resources.

GNS3 should now be booting our GNS3 VM inside VMware Workstation Player! 🙂

Import an appliance template

If you press finish, the appliance template import wizard should pop up.

Download the appliance template that you wish to emulate. Here, we’ll take the Cisco NX-OSV-9000:

Then select “Import an appliance template file”

And select the template :

Confirm you would like to run this appliance on the GNS 3 VM:

Some checks are being done to ensure the template can run on the GNS3 VM:

What we want then is to download the NXOS image from Cisco to make it available in GNS3.

If not already done, download the KVM image from Cisco’s website (of course you need a valid support contract with Cisco to be able to download this):

And if you’re lucky enough to have all your downloaded files in your download folder, GNS3 should automatically find it and make it available for you:

If the .fd file is missing, just click on it and select download and restart the wizard.

The same goes for the qcow2 file. Select your downloaded file to start deploying it on the GNS3 VM.

This can take a while before it finishes. The 700MB+ are now being pushed to the GNS3 VM 🙂

You can check the files by browsing the file system on the GNS3 VM.

Our image should be right under /opt/gns3/images/QEMU/

There it is 🙂

Upon completion, our template is ready for installation ! Select the version you just imported and click next :

Select your architecture (likely to be x86_64):

Finally, review the settings summary and click next:

Your custom NXOS image is now ready to be started in your topology!

Launch your virtual lab

Open a new GNS3 project, select “Switches” and edit the template we just created:

You may want to adjust the RAM and vCPUs by checking Cisco’s recommendations.

4GB were just fine in my case.

Note: Pay attention not to exceed the resources allocated to the host GNS3 VM, otherwise the VM will fail to boot the appliance.

Then, drag and drop the appliance template on the blank page.

Then right click the appliance and select “Start” to boot your appliance.

You can follow the boot sequence by opening a console:

Be patient!

And there we go 🙂

Host/Guest connectivity

Now, you might wonder, how do I make this virtual NXOS communicate with my host laptop/other VMs?

Nothing simpler than this!

First make sure you configure the mgmt0 interface of your virtual Nexus so that it resides in the same subnet as your VMware NIC and GNS3 VM:

Then add a Cloud to your topology, and map it to the GNS3 VM NIC card:

Edit the Cloud settings so that the Cloud Ethernet interface maps to GNS3 main NIC card:

Then add a link from the Cloud (eth0) to the mgmt0 port of the Nexus 9K:

Here is a ICMP test from my laptop:

We can then SSH into it and start playing:

Note: Don’t forget to configure the nxos image as boot image, otherwise, the next time the virtual appliance will boot, it won’t find any image to boot from !

Now that the connectivity is OK, we can go ahead and manage it with NetMRI!

This will be the topic of my next article!

Hope this helps 🙂