The next VNF we will create within our lab is the Cisco Cloud Services Router (CSR) 1000V. It is an IOS based virtual router designed by Cisco for use within virtual environments and perfect for playing around with Cisco IOS automation.
Obtaining an Image
There are a few ways to obtain a CSR 1000V image for use within our lab. If you already have a valid Cisco support contract, you can download the image at https://software.cisco.com/download/home/284364978/type/282046477 – download a QCOW version.
If you do not have a Cisco support contract, then you can get access to the images (and others) by purchasing the CML-PERSONAL product from Cisco at https://learningnetworkstore.cisco.com/cisco-modeling-labs-personal/cisco-modeling-labs-personal/CML-PERSONAL.html.
If neither of these options works for you, then you might be able to obtain the image through other means on Google.
Extracting the Image (from CML-PERSONAL)
If you purchased the CML-PERSONAL product, you should have downloaded an ISO file (for me, it is called refplat_p-20210511-fcs.iso).
Double-clicking the file in Windows will open the ISO file up. Inside the ISO file, navigate to “D:\virl-base-images\csr1000v-170302” and copy the qcow2 file to a convenient location outside the ISO file.
Converting the Image
Now that we have downloaded a QCOW image, we need to convert it into a VirtualBox format to create our VNF. For the following steps, we need to open up a Linux Terminal and navigate to the location of our QCOW image. For me, it at the following location:
In Linux, start by navigating to the folder of the QCOW image:
nfvdev@ubuntu:~$ cd /mnt/c/Users/nfvdev/Documents/NFVs/ nfvdev@ubuntu:/mnt/c/Users/nfvdev/Documents/NFVs$
To convert the image, we will need install an application called “qemu-utils”:
nfvdev@ubuntu:/mnt/c/Users/nfvdev/Documents/NFVs$ sudo apt-get update [sudo] password for nfvdev: Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease Get:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB] ... Get:29 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 c-n-f Metadata [536 B] Fetched 7074 kB in 1s (4888 kB/s) Reading package lists... Done nfvdev@ubuntu:/mnt/c/Users/nfvdev/Documents/NFVs$ sudo apt-get install qemu-utils Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: ibverbs-providers libboost-iostreams1.71.0 libboost-thread1.71.0 libibverbs1 libiscsi7 libnl-3-200 libnl-route-3-200 librados2 librbd1 librdmacm1 qemu-block-extra sharutils Suggested packages: debootstrap sharutils-doc bsd-mailx | mailx The following NEW packages will be installed: ibverbs-providers libboost-iostreams1.71.0 libboost-thread1.71.0 libibverbs1 libiscsi7 libnl-3-200 libnl-route-3-200 librados2 librbd1 librdmacm1 qemu-block-extra qemu-utils sharutils 0 upgraded, 13 newly installed, 0 to remove and 26 not upgraded. Need to get 7118 kB of archives. After this operation, 33.6 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libnl-3-200 amd64 3.4.0-1 [53.9 kB] ... Setting up qemu-utils (1:4.2-3ubuntu6.19) ... Processing triggers for libc-bin (2.31-0ubuntu9.2) ... /sbin/ldconfig.real: /usr/lib/wsl/lib/libcuda.so.1 is not a symbolic link Processing triggers for man-db (2.9.1-1) ... Processing triggers for install-info (6.7.0.dfsg.2-5) ...
Now that it is installed, we can convert the file with the following command:
nfvdev@ubuntu:/mnt/c/Users/nfvdev/Documents/NFVs$ qemu-img convert -f qcow2 csr1000v-universalk9.17.03.02-serial.qcow2 -O vdi csr1000v-universalk9.17.03.02-serial.vdi
You should now see two files in the folder. Feel free to remove the .qcow image now (we can always extract it from the ISO or redownload it again).
nfvdev@ubuntu:/mnt/c/Users/nfvdev/Documents/NFVs$ ls -lh total 3.1G -rwxrwxrwx 1 nfvdev nfvdev 1.4G Feb 2 2021 csr1000v-universalk9.17.03.02-serial.qcow2 -rwxrwxrwx 1 nfvdev nfvdev 1.8G Jan 19 10:56 csr1000v-universalk9.17.03.02-serial.vdi nfvdev@ubuntu:/mnt/c/Users/nfvdev/Documents/NFVs$ rm csr1000v-universalk9.17.03.02-serial.qcow2
Creating the VNF
Open up VirtualBox, click the “New” button and give it a name. I will be using “csr1000v-universalk9.17.03.02-serial”. Give it a type of “Linux” and a version of “Other (64-bit)”.
Next is RAM. Cisco supports a configuration of 4GB however I have worked out that it will still boot with 3GB:
Select “Use an existing virtual hard disk file” for the hard disk, then click the browse button next to it. From here, click “Add” and then browse to your vdi file and confirm it.
After clicking “Create,” you should be back at the main VirtualBox screen. Before booting the Virtual Machine (VM), there are some settings we need to tweak. Make sure the VM is selected, click “Settings”, and go to the “Network” tab.
For “Adapter 1”, make sure the “Attached to:” to be “Host-only Adapter” – this will be our Management interface.
I also like to change the “Adapter Type” (which is under Advanced) to “Paravirtualized Network (virtio-net)”.
The next step is only needed if you downloaded a CSR image that includes “serial” in the file name.
Cisco will output any console output to the serial port rather than the VirtualBox screen with a serial image. To work with this, we need to set a serial port. Under “Serial Ports”, enable Port 1. Set it to a “Host Pipe” and then put a “Path/Address” of “\\.\pipe\csr”. This will create a named pipe within Windows that we can connect to.
Now it’s time to start the Virtual Machine. Click “Start” and it should boot up until you see “Booting the kernel.”
Next open up Putty (download from https://www.putty.org/ if not installed). Click the “Serial” radio button and enter a “Serial line” of “\\.\pipe\csr” and click Open.
After a while, the VNF will be fully booted up and you will see:
You now have a fully working Cisco CSR 1000V running in VirtualBox!