Date created: Thursday, November 24, 2016 9:27:30 AM. Last modified: Wednesday, March 17, 2021 3:45:36 PM
CSR1000v 3.x Install
References:
www.cisco.com/c/en/us/td/docs/routers/csr1000/software/configuration/csr1000Vswcfg/installkvm.html
http://www.cisco.com/c/en/us/td/docs/routers/csr1000/software/configuration/b_CSR1000v_Configuration_Guide/b_CSR1000v_Configuration_Guide_chapter_01010.html
http://www.cisco.com/c/en/us/td/docs/routers/csr1000/software/configuration/b_CSR1000v_Configuration_Guide/b_CSR1000v_Configuration_Guide_chapter_0111.html#task_1308659
This is using CSR1000v (codename: 'Ultra') with IOS-XE 3.16.4Sa.
Less Preferred Method
Create up the KVM guest VM and boot from an ISO:
sudo -u qemu qemu-img create -f qcow2 /home/VMs/vcpe-001.qcow2 10G virt-install \ --connect=qemu:///system \ --name=vcpe-001-3.16.4Sa \ --description "vCPE-001 CSR1000v IOS-XE-3.16.4Sa" \ --os-type=linux \ --os-variant=rhel4 \ --arch=x86_64 \ --cpu host-model \ --vcpus=4,sockets=4,cores=1,threads=1 \ --hvm \ --ram=4096 \ --cdrom=/home/VMs/ISOs/csr1000v-universalk9.03.16.04a.S.155-3.S4a-ext.iso \ --disk path=/home/VMs/vcpe-001.qcow2,bus=virtio,size=8,sparse=false,cache=none,format=qcow2 \ --network bridge=virbr0,model=virtio \ --boot cdrom,hd \ --graphics none \ --serial pty \ -d [user@lsrv-kvm-001 home]$ virsh --connect qemu:///system start vcpe-001-3.16.4Sa Domain vcpe-001-3.16.04Sa started [user@lsrv-kvm-001 home]$ virsh --connect qemu:///system list --all Id Name State ---------------------------------------------------- 2 vcpe-001-3.16.04Sa running virsh --connect qemu:///system console vcpe-001-3.16.4Sa
If this needs to be done regularly the VM can be stopped and deleted using the following:
virsh --connect qemu:///system destroy vcpe-001-3.16.4Sa && virsh --connect qemu:///system undefine vcpe-001-3.16.4Sa && virsh --connect qemu:///system list --all [user@lsrv-kvm-001 home]$ virsh --connect qemu:///system destroy vcpe-001-3.16.4Sa Domain vcpe-001-3.16.4Sa destroyed [user@lsrv-kvm-001 home]$ virsh --connect qemu:///system undefine vcpe-001-3.16.4Sa Domain vcpe-001-3.16.4Sa has been undefined [user@lsrv-kvm-001 home]$ virsh --connect qemu:///system list --all Id Name State ----------------------------------------------------
Initially the VM boots and it "does something" and then the VM shutdowns (speculation: it runs a partial install that maybe formats the disk and copies the install files):
[users@localhost VMs]$ virt-install \ > --connect=qemu:///system \ > --name=vcpe-001-3.16.4Sa \ > --description "vCPE-001 CSR1000v IOS-XE-3.16.4Sa" \ > --os-type=linux \ > --os-variant=rhel4 \ > --arch=x86_64 \ > --cpu host-model \ > --vcpus=4,sockets=4,cores=1,threads=1 \ > --hvm \ > --ram=4096 \ > --cdrom=/home/VMs/ISOs/csr1000v-universalk9.03.16.04a.S.155-3.S4a-ext.iso \ > --disk path=/home/VMs/vcpe-001.qcow2,bus=virtio,size=8,sparse=false,cache=none,format=qcow2 \ > --network bridge=virbr0,model=virtio \ > --graphics none \ > --boot cdrom \ > --serial pty \ > --noreboot \ > -d [Mon, 28 Nov 2016 15:01:04 virt-install 4880] DEBUG (cli:246) Launched with command line: /usr/share/virt-manager/virt-install --connect=qemu:///system --name=vcpe-001-3.16.4Sa --description vCPE-001 CSR1000v IOS-XE-3.16.4Sa --os-type=linux --os-variant=rhel4 --arch=x86_64 --cpu host-model --vcpus=4,sockets=4,cores=1,threads=1 --hvm --ram=4096 --cdrom=/home/VMs/ISOs/csr1000v-universalk9.03.16.04a.S.155-3.S4a-ext.iso --disk path=/home/VMs/vcpe-001.qcow2,bus=virtio,size=8,sparse=false,cache=none,format=qcow2 --network bridge=virbr0,model=virtio --graphics none --boot cdrom --serial pty --noreboot -d [Mon, 28 Nov 2016 15:01:04 virt-install 4880] DEBUG (cli:256) Requesting libvirt URI qemu:///system [Mon, 28 Nov 2016 15:01:04 virt-install 4880] DEBUG (cli:260) Received libvirt URI qemu:///system [Mon, 28 Nov 2016 15:01:04 virt-install 4880] DEBUG (virt-install:357) Requesting virt method 'hvm', hv type 'default'. [Mon, 28 Nov 2016 15:01:04 virt-install 4880] DEBUG (virt-install:591) Received virt method 'kvm' [Mon, 28 Nov 2016 15:01:04 virt-install 4880] DEBUG (virt-install:592) Hypervisor name is 'hvm' [Mon, 28 Nov 2016 15:01:04 virt-install 4880] DEBUG (virt-install:269) Distilled --network options: ['bridge=virbr0,model=virtio'] [Mon, 28 Nov 2016 15:01:04 virt-install 4880] DEBUG (virt-install:182) Distilled --disk options: ['path=/home/VMs/vcpe-001.qcow2,bus=virtio,size=8,sparse=false,cache=none,format=qcow2'] [Mon, 28 Nov 2016 15:01:05 virt-install 4880] DEBUG (guest:238) Setting Guest.os_variant to 'rhel4' [Mon, 28 Nov 2016 15:01:05 virt-install 4880] WARNING (virt-install:500) CDROM media does not print to the text console by default, so you likely will not see text install output. You might want to use --location. See the man page for examples of using --location with CDROM media [Mon, 28 Nov 2016 15:01:05 virt-install 4880] DEBUG (virt-install:746) Guest.has_install_phase: True Starting install... [Mon, 28 Nov 2016 15:01:05 virt-install 4880] DEBUG (cli:426) Connecting to text console [Mon, 28 Nov 2016 15:01:05 virt-install 4880] DEBUG (cli:402) Running: virsh --connect qemu:///system console vcpe-001-3.16.4Sa Connected to domain vcpe-001-3.16.4Sa Escape character is ^] Press any key to continue. Press any key to continue. GNU GRUB version 0.97 (639K lower / 3144696K upper memory) +-------------------------------------------------------------------------+ | CSR 1000V Virtual (VGA) Console -- Tue-04-Oct-16-07:24 | | CSR 1000V Autodetect (Serial, VGA) Console -- Tue-04-Oct-16-07:24 | | CSR 1000V Serial Console -- Tue-04-Oct-16-07:24 | | | | | | | | | | | | | | | | | | | +-------------------------------------------------------------------------+ Use the ^ and v keys to select which entry is highlighted. Press enter to boot the selected OS, or 'c' for a command-line. Booting 'CSR 1000V Virtual (VGA) Console -- Tue-04-Oct-16-07:24' root (cd) Filesystem type is iso9660, using whole disk kernel /boot/csr1000v-universalk9.03.16.04a.S.155-3.S4a-ext.SPA.bin rw root=/de v/ram quiet console= max_loop=64 VMCONSOLE HARDWARE=virtual SR_BOOT=cdrom:csr10 00v-universalk9.03.16.04a.S.155-3.S4a-ext.iso package header rev 1 structure detected Calculating SHA-1 hash...done SHA-1 hash: calculated 13661404:aa3de3e3:4dd1c702:2ca2bcc:8bda46b8 expected 13661404:aa3de3e3:4dd1c702:2ca2bcc:8bda46b8 Package type:0x7530, flags:0x0 [Linux-bzImage, setup=0x2e00, size=0x15768900] [isord @ 0x6be45000, 0x141aa000 bytes] Domain creation completed. You can restart your domain by running: virsh --connect qemu:///system start vcpe-001-3.16.4Sa [users@localhost VMs]$
If the VM is started now the serial line drops into the ROMMON console. It seems that by default CSR1000v images direct console output to a VGA interface (even if one isn't configured in KVM, and a serial port is. The console output thus goes "no where" and connecting to the serial port configured in KVM simply connects the user to the AUX port, dropping them into ROMMON mode which is useless.
Add the following to allow password-less VNC access to the KVM guest:
<graphics type='vnc' port='5900' autoport='yes' listen='10.1.1.80' keymap='en-gb'>
<listen type='address' address='10.1.1.80'/>
</graphics>
<video>
<model type='cirrus' vram='16384' heads='1' primary='yes'/>
<alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
Once connected to the console via VNC one can enter the global configuration command "platform console serial", save and reboot the VM. Now the console output from the CSR1000v will be connected to the KVM console device and the VNC and graphics/VGA options can be removed.
More Preferred Method
So far using the Cisco provided QCOW2 file and cloning seems "best". They just boot up and work although there is still the problem of the router console being directed to VGA by default.
Router Console via TCP
The only way this seems to work with KVM is by using a TCP redirect, otherwise any attempt results in connecting to the router AUX port which only provides access to ROMMON mode. Add the following in the VM XML definition (assuming the CSR1000v guest is configured with "platform console serial"):
<serial type='tcp'>
<source mode='bind' host='127.0.0.1' service='4555'/>
<protocol type='telnet'/>
<target port='0'/>
<alias name='serial0'/>
</serial>
<console type='tcp'>
<source mode='bind' host='127.0.0.1' service='4555'/>
<protocol type='telnet'/>
<target type='serial' port='0'/>
<alias name='serial0'/>
</console>
Once the CSR1000v is up the bindings between vNICs and hypervisor can be observed (these are all set to use the Virtio driver in KVM):
vcpe-001#show platform software vnic-if interface-mapping ------------------------------------------------------------- Interface Name Driver Name Mac Addr ------------------------------------------------------------- GigabitEthernet4 virtio 5254.0046.dce6 GigabitEthernet3 virtio 5254.001e.2c07 GigabitEthernet2 virtio 5254.00e1.842c GigabitEthernet1 virtio 5254.00e0.64c4 ------------------------------------------------------------- ! This doesn't tell us anything which the below doesn't tell us though vcpe-001#show int | i Ethernet|CSR GigabitEthernet1 is administratively down, line protocol is down Hardware is CSR vNIC, address is 5254.00e0.64c4 (bia 5254.00e0.64c4) GigabitEthernet2 is administratively down, line protocol is down Hardware is CSR vNIC, address is 5254.00e1.842c (bia 5254.00e1.842c) GigabitEthernet3 is up, line protocol is up Hardware is CSR vNIC, address is 5254.001e.2c07 (bia 5254.001e.2c07) GigabitEthernet4 is administratively down, line protocol is down Hardware is CSR vNIC, address is 5254.0046.dce6 (bia 5254.0046.dce6) ! So the vNIC MAC addresses must be used to see which vNIC each guest interface is bound to: $ ip link | egrep "vnet|ether" 39: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UNKNOWN mode DEFAULT qlen 500 link/ether fe:54:00:e0:64:c4 brd ff:ff:ff:ff:ff:ff 40: vnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br1 state UNKNOWN mode DEFAULT qlen 500 link/ether fe:54:00:e1:84:2c brd ff:ff:ff:ff:ff:ff 41: vnet2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br501 state UNKNOWN mode DEFAULT qlen 500 link/ether fe:54:00:1e:2c:07 brd ff:ff:ff:ff:ff:ff 42: vnet3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br502 state UNKNOWN mode DEFAULT qlen 500 link/ether fe:54:00:46:dc:e6 brd ff:ff:ff:ff:ff:ff
Previous page: Cisco Switch Matrix
Next page: CSR1000v 16.x Install