Building a Cisco IOS XR Vagrant Libvirt Box

Cisco IOS XR is supported by the netlab libvirt package command. To build an IOS XR box:

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

  • Download IOS XR software, and unpack the image archive to get the qcow2 disk image (example: xrv9k-fullk9-x-7.4.2.qcow2).

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


  • The netlab libvirt package iosxr command has been tested on Ubuntu 20.04 LTS and 22.04 LTS and might not work on other Linux distros.

  • On Ubuntu 22.04 LTS, libvirt-qemu user needs read and execute access to the VM disk file. It’s easiest if you create Vagrant boxes in a subdirectory of the /tmp directory.

Initial Device Configuration

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

Creating initial configuration for IOS XR

Don't despair, the system boot takes forever. After the boot is complete, the system
might displays the "Administrative User Dialog", in which case create root-system
username 'vagrant' with password 'vagrant'.

* Login with username 'vagrant' and password 'vagrant'
* Use 'config' to enter configuration mode and copy the following configuration:

hostname xrv
domain name lab.local
aaa authorization exec default local
aaa authentication login default local
vrf MGMT
ssh server v2
ssh server logging
ssh server vrf MGMT
ssh server vrf default
ssh server netconf vrf MGMT
ssh server netconf vrf default
username vagrant
 password vagrant

netconf agent tty
 session timeout 5
netconf-yang agent
interface MgmtEth0/RP0/CPU0/0
 no shutdown
 vrf MGMT
 ipv4 address dhcp

* Exit the configuration mode and disconnect from console (ctrl-] usually works).