To enable immediate remote-access to brandnew deployed virtual Cisco CSR1000V-Routers by scripts, ansible etc. it’s necessary to predeploy the startup-config at least with public-rsa-keys etc.
- Prepare
- Prepare
- Modify the existing script
- Mount this ISO to the VM
- Run the VM
- the config-file gets applied
- access the router
- note the automatically changed hostname 😉
Download and install the nice tool http://CDBurnerXP. This will install a companion cli-tool cdbxpcmd.exe
along with the GUI-Version.
It’ll be used to prepare an ISO-„CDROM“ containing the prepared „startup-config“-file.
Prepare an IOS-XE Configuration file…
! hostname HOSTNAME ! ... ! ! platform console serial ! crypto key generate rsa modulus 2048 label RSA_SSH ! ! username labuser privilege 15 ! ip ssh pubkey-chain ! username labuser key-string ... exit exit ! exit ! ... ! ip ssh rsa keypair-name RSA_SSH ! ip ssh server algorithm authentication publickey ! ... ! line vty 0 15 login local transport input ssh access-class ACL_NMM in vrf-also ! end
These commands create the ISO-File in the %LOC%
-Path.
set VM=CSR1000vX ... : Create ISO containing slipstreamed config-file : use UNXTOOLS "sed" to customize the "hostname"-Command : set CFGISO=%LOC%\config.iso set CFGSRC=C:\RH\LAB\VM\iosxe_config.txt set CFGTXT=%LOC%\iosxe_config.txt cat %CFGSRC% | sed "s/HOSTNAME/%VM%/g" > %CFGTXT% "%ProgramFiles(x86)%"\CDBurnerXP\cdbxpcmd.exe --burn-data -file:%CFGTXT% -iso:%CFGISO% -format:iso
The contained config-file will get automatically applied when the router boots the first time.
VBoxManage storageattach %VM% --storagectl IDE-CTL --port 1 --device 1 --type dvddrive --medium %CFGISO%
This depends of the configuration-file, of course.