Building a Cisco CSR 1000v Vagrant Libvirt Box

Cisco CSR 1000v is supported by the netlab libvirt package command. To build a CSR 1000v box:

  • Create an empty directory on a Ubuntu machine with libvirt and Vagrant.

  • Download a CSR disk image (.qcow2 file) with -serial in the file name (example: csr1000v-universalk9.17.03.04a-serial.qcow2) into that directory

  • Execute netlab libvirt package csr virtual-disk-file-name and follow the instructions

Warning

  • You MUST have a CSR disk image that expects to be configured through the serial interface for this procedure to work. If all you have is an image that expects a graphics card, the original recipe on codingpackets.com might still work for you.

  • If you’re using a ‌netlab release older than 1.8.2, or if you’re using a Linux distribution other than Ubuntu, please read the box-building caveats first.

Initial Device Configuration

During the box-building process (inspired by this solution) you’ll have to copy-paste initial device configuration. netlab libvirt config csr command displays the build recipe (based on the recipe published by Brad Searle):

Creating initial configuration for Cisco CSR 1000v
==================================================

* Answer 'no' to the 'Would you like to enter the initial configuration dialog' prompt
* Answer 'yes' to the 'Would you like to terminate autoinstall' prompt
* Press ENTER to start a CLI session
* Go into enable mode, enter configuration mode
* Copy-paste the following configuration

=============================================
hostname csr
no ip domain lookup
ip domain name lab.local
!
no service config
!
crypto key generate rsa modulus 2048
ip ssh version 2
!
aaa new-model
!
aaa authentication login default local
aaa authorization exec default local
!
username vagrant privilege 15 secret vagrant
!
ip ssh pubkey-chain
 username vagrant
  key-hash ssh-rsa DD3BB82E850406E9ABFFA80AC0046ED6
!
vrf definition MGMT
 description Management interface
 !
 address-family ipv4
 exit-address-family
!
interface GigabitEthernet1
 vrf forwarding MGMT
 description vagrant-management
 ip address dhcp client-id GigabitEthernet1
 no shutdown
!
line vty 0 4
 transport input ssh
!
end
=============================================

* Save the configuration with 'wr mem'
* Disconnect from console (ctrl-] usually works).

Notes on Using CSR Box

If you’re experiencing high CPU utilization with Cisco CSR, set halt_poll_ns to zero.