• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

Roger Perkin

Learn Network Automation

  • Network Automation
    • Ansible
    • Python
    • Terraform
    • pyATS
    • Git
    • Postman
  • ISE
  • Cisco
    • SD WAN Training
    • Password Recovery
    • Software-Upgrade-Guides
    • BGP
    • Data Center
    • WIRELESS
  • Blog
    • CCIE Blog
  • COURSES
  • Menu Item

How to run a Cisco Nexus 9000v Switch on a Windows 10 laptop with Vagrant and Virtualbox

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
  • Virtualbox
  • Vagrant
  • 30-60 minutes of your time!

Step 1 – Nexus 9000v Download

Page Contents

  • Step 1 – Nexus 9000v Download
  • Step 2 – Vagrant Download & Install
  • Step 3 – Download and install Virtualbox
  • Step 4 – Configure Vagrant

The first step is to download the Nexus 9000v box image, you will need a login to cisco.com.

https://software.cisco.com/download/home/286312239/type/282088129/release/7.0(3)I7(6)

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

nexus 9000v download

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.

vagrant download

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

vagrant – version command

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

virtualbox download

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

vagrant box list

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.

vagrant init

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

vagrant up

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

nexus 9000v virtualbox

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

virtualbox ram setting 4096 for nexus 9000v

Next click on Serial Ports – we need to add a Device Pipe to be able to console onto the switch

virtualbox device pipe

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

securecrt 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

nexus 9000v 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

conf t
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
Documents: http://www.cisco.com/en/US/products/ps9372/tsd_products_support_serie
s_home.html
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
http://www.gnu.org/licenses/gpl.html.

Nexus 9000v is a demo version of the Nexus Operating System

Software
BIOS: version
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]
Hardware
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?

The final step is to ssh to 127.0.0.1 on port 2222 and you have a fully operational Nexus 9000V switch which you can try out your configurations on or test out Ansible or Python.

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.

Previous Post: « ansible logo - rogers ccie blog What are the advantages of using Ansible roles?
Next Post: Cisco Certification Changes – Feb 24th 2020 »

Reader Interactions

Comments

  1. charles george

    June 18, 2019 at 1:33 am

    have you ever tested vpc and\or ovt

    • Roger Perkin

      June 18, 2019 at 2:00 am

      I have not tried any configurations yet, I believe VPC will work but I do not think OTV is supported

  2. Sinh Quan

    June 22, 2019 at 8:32 am

    Hi roger
    I get the following error message. i have re-installed several times but can’t go pass this stage. any idea?

    D:\Users\Sinh\Documents\Virtual Machines\Vagrant>vagrant up
    Bringing machine ‘default’ up with ‘virtualbox’ provider…
    ==> default: Importing base box ‘n9000v’…
    ==> default: Matching MAC address for NAT networking…
    ==> default: Setting the name of the VM: Vagrant_default_1561191133001_98829
    ==> 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…
    There was an error while executing `VBoxManage`, a CLI used by Vagrant
    for controlling VirtualBox. The command and stderr is shown below.

    Command: [“startvm”, “74585b00-0729-491b-9bd2-255b9fa86f13”, “–type”, “headless”]

    Stderr: VBoxManage.exe: error: The virtual machine ‘Vagrant_default_1561191133001_98829’ has terminated unexpectedly during startup with exit code 1 (0x1). More details may be available in ‘D:\IT Techinal Stuff\VirtualBox VMs\Vagrant_default_1561191133001_98829\Logs\VBoxHardening.log’
    VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component MachineWrap, interface IMachine

    • Roger Perkin

      June 22, 2019 at 2:04 pm

      How much RAM have you got set for the VM? What version of Window? How much RAM on your laptop?

Let’s get started

Take a look at my premium courses on Ansible, Nornir & Git or buy them all with the Network Automation Bundle!

Network Automation Courses

Social

Follow along on social media

Contact

Get in touch with me here

[email protected]

Navigation

Home

Blog

About

Contact

YouTube

Don’t forget to take a look at my YouTube Channel

youtube button

Copyright © 2021 · Roger Perkin · All Rights Reserved · Powered by Mai Theme