The Nexus 9000v switch is a free virtual edition of the very popular Nexus 9K switch. It is free to use and will run most of the features of a real Nexus.
This post will detail how I run the Cisco Nexus 9000v switch on my Windows 10 laptop using Vagrant and Virtualbox, for an amazing on box local lab I can test Ansible playbooks and Nexus configuration on.
You will need:
- Nexus 9000v image
- 30-60 minutes of your time!
Step 1 - Nexus 9000v Download
The first step is to download the Nexus 9000v box image, you will need a login to cisco.com.
This should bring you to this screen which is the latest version of software at the time of writing. You have a choice of the 7 or 9 train, for this post I am using 7
The image we want is the .box image for Vagrant. You can also run the Nexus 9000v switch on esxi and Fusion but for this tutorial we need the .box image. Click on the download button and save the image in a relevant folder.
I have created a folder called Vagrant
Step 2 - Vagrant Download & Install
To download Vagrant head over to vagrantup.com click on the latest version and download the correct version for your operating system. In this tutorial we will be downloading the Windows version.
Once you have downloaded Vagrant, run the executable and just click next, next, next, until the software has been installed.
Once Vagrant is installed you need to open your terminal or cmd window and just type vagrant --version to check if the installation is ok, It should return the version that you downloaded. In our case 2.2.4
So we now have Vagrant installed the last thing we need is Virtualbox
Step 3 - Download and install Virtualbox
To download Virtualbox head over to virtualbox.org/wiki/downloads
The installation steps for virtualbox are very simple just run the executable and click next,next,next until you finish.
Step 4 - Configure Vagrant
I would suggest you create a folder where you want to keep all your Vagrant files. Mine is located in C:\Virtual Machines\Vagrant
Copy the Nexus9000v box file into this folder
Now with your cmd or terminal navigate to your Vagrant folder. You need to add the box file into Vagrant
To add an image to Vagrant type the following
vagrant box add --name n9000v nxosv-final.7.0.3.I7.6.box
The name n9000v is the name of your vagrant box file
If you now type the command vagrant box list you should see the image added
Note: I have 2 vagrant boxes configured, but the one we are going to use is n9000v
Note: Make sure at this stage you have Virtualbox running.
From this point we have 2 options, you can either do a vagrant init which will create a Vagrant file or you can create your own based on my settings below. It is always good to understand what lines in the config file do so I would suggest you type the command vagrant init and lets see how the vagrant file is made up.
If you now look in your Vagrant folder you will have a file called Vagrantfile
This vagrantfile contains all the information about your environment but at this stage it only contains one line config.vm.box
# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
config.vm.box = "n9000v"
If you now type vagrant up this will start your Nexus 9000v Switch
At this point the Nexus 9000V switch will be booting up in Virtualbox with 8GB of RAM and no console port so you can’t see it booting.
If you look in Virtualbox you will see the VM running
We need to kill this vm from booting by right clicking on it and selecting close / power off.
Now click on Settings and System I wind the RAM back to 4096
Next click on Serial Ports - we need to add a Device Pipe to be able to console onto the switch
For Port 1 ensure Enable Serial Port is ticked, Port Number is COM1, Port Mode is Host Pipe and Path/Address is \\.\pipe\COM6
Click ok and go into your terminal software, I am using SecureCRT and configure a named pipe
Now we go back into cmd prompt and type vagrant up again, this time we should see the switch boot up in SecureCRT
Note: You have to wait until Vagrant has said VM booting before you can view it in SecureCRT
C:\Virtual Machines\VAGRANT>vagrant up
Bringing machine 'default' up with 'virtualbox' provider…
==> default: Clearing any previously set forwarded ports…
==> default: Clearing any previously set network interfaces…
==> default: Preparing network interfaces based on configuration…
default: Adapter 1: nat
==> default: Forwarding ports…
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM…
==> default: Waiting for machine to boot. This may take a few minutes…
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you’re using a custom box, make sure that networking is properly
working and you’re able to connect to the machine. It is a common
problem that networking isn’t setup properly in these boxes.
Verify that authentication configurations are also setup properly,
You can see from the above output that you will be able to access your switch using SSH using the IP 127.0.0.1 and port 2222
You will also see a warning about timed out while waiting for machine to boot, this is nothing to worry about, Vagrant wants to verify that the machine has booted and the Nexus 9000v takes a long time so Vagrant is unable to log in and verify it’s up. More on this later.
So now if watch the console you should see your switch booting
Once the switch has booted you will be able to login with the default username and password of admin/admin
At this point we need to do one maintenance task otherwise when you boot the switch the next time it will get stuck on loader prompt
You just need to login and enter the following command
boot nxos <image name>
Check your current image with show version and enter the command referencing your running version of software.
Nexus9000v# sho ver
Cisco Nexus Operating System (NX-OS) Software
TAC support: http://www.cisco.com/tac
Copyright (c) 2002-2019, Cisco Systems, Inc. All rights reserved.
The copyrights to certain works contained herein are owned by
other third parties and are used and distributed under license.
Some parts of this software are covered under the GNU Public
License. A copy of the license is available at
Nexus 9000v is a demo version of the Nexus Operating System
NXOS: version 7.0(3)I7(6)
BIOS compile time:
NXOS image file is: bootflash:///nxos.7.0.3.I7.6.bin
NXOS compile time: 3/5/2019 13:00:00 [03/05/2019 22:04:55]
cisco Nexus9000 9000v Chassis
--More--2019 Jun 18 01:24:58 Nexus9000v %$ VDC-1 %$ %ASCII-CFG-2-CONFIG_REPLAY_STATUS: Ascii Replay Done.
2019 Jun 18 01:25:01 Nexus9000v %$ VDC-1 %$ %ASCII-CFG-2-CONF_CONTROL: System ready
Nexus9000v# conf t
Enter configuration commands, one per line. End with CNTL/Z.
Nexus9000v(config)# boot nxos nxos.7.0.3.I7.6.bin
Performing image verification and compatibility check, please wait….
At this point I would also change the hostname to N9K-1
save the config
copy run start
You now have a fully operational Nexus 9K switch running on your laptop.
Nexus9000v(config)# Nexus9000v(config)# hostname N9K-1 N9K-1(config)# end N9K-1# copy run start [########################################] 100% Copy complete, now saving to disk (please wait)… Copy complete.
So, how can you actually use this?
Shutting down your switch
For most Vagrant boxes you can shut them down gracefully with vagrant halt but the Nexus does not play well like this so you just have to go into Virtualbox and right click on the VM and click Close / Power off
In the next post I will be showing you how to run 2 x Nexus switches and connect two interfaces together and we will be going through the Vagrantfile in more detail. Once both switches are up I will also be using Ansible to perform some basic configuration tasks.