Open candlerb opened 4 years ago
In my opinion the right way to do this is via ZTP ... GNS3 needs a management network and a DHCP/TFTP server for that Having that allows ZTP for many other classes of devices not just for CSR1000v
Here is another option. Have the ISO config:iosxe_config.txt generated dynamically and give the user a box to put commands in. These commands would then be put in a registered in a event manger applet that would kick off 10 seconds after boot, deploy initial config then reload. This could do any number of things. Here are the example commands from the OPs initial post (untested).
event manager applet on-boot authorization bypass
event timer countdown time 10
action 100 cli command "enable"
action 110 cli command "conf t"
action 120 cli command "boot config bootflash:config.txt nvbypass"
action 130 cli command "end"
action 140 cli command "copy bootflash:config.txt running-config"
action 150 cli command "running-config"
action 160 cli command "reload"
(This is a companion issue to https://github.com/GNS3/gns3-server/issues/1315 for IOSv)
I would like to be able to export, import, and edit-in-place the NVRAM config for CSRv.
Unfortunately, CSRv stores its NVRAM in an encrypted partition, but I have found a way which works.
Firstly, create an ISO image containing
iosxe_config.txt
(or the XML form,ovf-env.xml
)Attach this as a CD-ROM when the device boots.
During first boot, this config is read in. The
boot config
command tells IOS to store the config as a plain text file on the main (first) partition, which appears asflash:
andbootflash:
and is not encrypted.There's just one small problem, which is if you've installed a
config.txt
prior to the first boot: after running the config from the ISO image, the router does the equivalent of a "write mem" which overwrites the config you had put there. (Subsequent boots are fine; the ISO image is ignored)I have a workaround for this, and it's to put the following in
iosxe_config.txt
:Running
do copy .... running-config
in config mode is explicitly rejected; and using "end" instead of "exit" ignores the rest of the file. So this is arguably exploiting a bug in the config parsing:-)
. However it does work: it reads in the initial config you provided, and then writes it back out again. You need to put explicit "no shutdown" under each interface though.Anyway, once this is done you can extract the text config easily, e.g.
FYI, the CSR1000v image has the following partitions:
I believe the NVRAM is likely partition 2, because there's a log file entry in the base which says