Routers with more than three interfaces? Not that uncommon!
It might be handy, if several devices are needed with more than three interfaces, to:
- not:
- deploy the devices with three interfaces first
- add the needed number of interfaces to the routers
- attache tne new interfaces to the correct vSphere-Portgroup
- but instead:
- create an OVA-Template with the correct number of interfaces (one time)
- deploy the routers and attach them during deployment to their portgroup
So using vNIC Hot-Add might be not the favourite way to work.
Common OVF Tool
COT lets you to deploy Cisco CSR1000v routers by easy to use (linux-)commands.
(Common OVF Tool (COT) – Automated Lab-Router Deployment
This is my original OVA-file already containing some basic configurations needed for NAPALM.
- it will build a virtual router with three GigabitEthernet-Interfaces
user@ubuntu-server:~$ cot info csr1000v-universalk9.16.03.05.napalm.ova | egrep "(Networks|Gigabit)" Networks: GigabitEthernet1 "Data network 1" GigabitEthernet2 "Data network 2" GigabitEthernet3 "Data network 3" NICs and Associated Networks: GigabitEthernet1 : GigabitEthernet1 GigabitEthernet2 : GigabitEthernet2 GigabitEthernet3 : GigabitEthernet3 Management Interface "GigabitEthernet1"
Add another Interface (long version)
Let’s use the prepared OVA and create another OVA with 4 interfaces:
user@ubuntu-server:~$ cot edit-hardware csr1000v-universalk9.16.03.05.napalm.ova -o csr1000v-universalk9.16.03.05.napalm.4IF.ova -n 4 --nic-type vmxnet3 --nic-networks "GigabitEthernet1" "GigabitEthernet2" "GigabitEthernet3" "GigabitEthernet4" --network-descriptions "Data network 1" "Data network 2" "Data network 3" "Data network 4" Network GigabitEthernet4 is not currently defined. Create it? [y] y
Result:
user@ubuntu-server:~$ cot info csr1000v-universalk9.16.03.05.napalm.4IF.ova | egrep "(Networks|Gigabit)" Networks: GigabitEthernet1 "Data network 1" GigabitEthernet2 "Data network 2" GigabitEthernet3 "Data network 3" GigabitEthernet4 "Data network 4" NICs and Associated Networks: GigabitEthernet1 : GigabitEthernet1 GigabitEthernet2 : GigabitEthernet2 GigabitEthernet3 : GigabitEthernet3 GigabitEthernet4 : GigabitEthernet4 Management Interface "GigabitEthernet1"
Add another Interface (short version)
It’s possible to replace the long enumerations („GigabitEthernet1“ „GigabitEthernet2“ „GigabitEthernet3“ „GigabitEthernet4“) by a macro „GigabitEthernet{1}“ => the Variable {1} will get expanded to 1…2…3…4…up to the number needed. This is much more flexible when sometimes 4, sometimes 5 NICs need to be added.
user@ubuntu-server:~$ cot edit-hardware csr1000v-universalk9.16.03.05.napalm.ova -o csr1000v-universalk9.16.03.05.napalm.4IFb.ova -n 4 --nic-type vmxnet3 --nic-networks "GigabitEthernet{1}" --network-descriptions "Data network {1}" Network GigabitEthernet4 is not currently defined. Create it? [y]
Same result as before:
user@ubuntu-server:~$ cot info csr1000v-universalk9.16.03.05.napalm.4IFb.ova | egrep "(Networks|Gigabit)" Networks: GigabitEthernet1 "Data network 1" GigabitEthernet2 "Data network 2" GigabitEthernet3 "Data network 3" GigabitEthernet4 "Data network 4" NICs and Associated Networks: GigabitEthernet1 : GigabitEthernet1 GigabitEthernet2 : GigabitEthernet2 GigabitEthernet3 : GigabitEthernet3 GigabitEthernet4 : GigabitEthernet4 Management Interface "GigabitEthernet1"
Deploy a new Router-VM using this OVA
user@ubuntu-server:~$ cot --verbose deploy csr1000v-universalk9.16.03.05.napalm.4IFb.ova esxi VCENTERIP/Datacenter/host/ESXiIP -u VCENTER-USER -p PASS -n CSR-4IF -d "DS-LAB" -S "telnet://:44444,server" -N GigabitEthernet1="Management" GigabitEthernet2=T24 GigabitEthernet3=T34 GigabitEthernet4=TBB -c 1CPU-4GB INFO : vm_description : Loading 'csr1000v-universalk9.16.03.05.napalm.4IFb.ova' as OVF INFO : ovf : OVF version is 1.x INFO : ovf : OVF product class com.cisco.csr1000v --> platform Cisco CSR1000V INFO : vm_description : Successfully loaded OVF from csr1000v-universalk9.16.03.05.napalm.4IFb.ova WARNING : deploy : No serial connectivity information is available for 1 serial port(s) - they will not be created or configured. INFO : deploy_esxi : Deploying VM... NOTICE : helper : Calling 'ovftool --deploymentOption=1CPU-4GB --net:GigabitEthernet1=Management --net:GigabitEthernet2=T24 --net:GigabitEthernet3=T34 --net:GigabitEthernet4=TBB --name=CSR-4IF --datastore=DS-LAB csr1000v-universalk9.16.03.05.napalm.4IFb.ova vi://administrator@lab.local:VMware1!@192.168.2.13/Datacenter/host/192.168.2.12'... Opening OVA source: csr1000v-universalk9.16.03.05.napalm.4IFb.ova The manifest validates Opening VI target: vi://administrator%40lab.local@192.168.2.13:443/Datacenter/host/192.168.2.12 Deploying to VI: vi://administrator%40lab.local@192.168.2.13:443/Datacenter/host/192.168.2.12 Transfer Completed Completed successfully NOTICE : helper : ...done INFO : deploy_esxi : FIXING up serial ports on deployed VM... INFO : deploy_esxi : Serial port will be a telnet server at :44444 INFO : deploy_esxi : Done with serial port fixup
Isn’t it beautiful?
Test the created CSR1000v-Router
The forth GigabitEthernet-Interface was detected during hardware-setup:
NAPALM-1#show ip int brief Interface IP-Address OK? Method Status Protocol GigabitEthernet1 192.168.2.244 YES DHCP up up GigabitEthernet2 unassigned YES unset administratively down down GigabitEthernet3 unassigned YES unset administratively down down GigabitEthernet4 unassigned YES unset administratively down down
The Interface works fine:
NAPALM-1#conf t Enter configuration commands, one per line. End with CNTL/Z. NAPALM-1(config)#int gig 4 NAPALM-1(config-if)#ip addr 192.168.64.99 255.255.255.0 NAPALM-1(config-if)#end NAPALM-1#ping 192.168.64.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.64.1, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 2/3/4 ms