Closed grossmj closed 1 year ago
It depends on what you want to keep track of...
If you're only interested in the startup-config
and private-config
files then just get them and compare?
Don't know the specifics, but the "Load config from nvram" button in the "Startup-config" router dialog is an example of getting the first file.
If you're interested in more than that... It depends... NVRAM can contain other files that get changed during the normal operation of the router so getting the checksum of the whole filesystem isn't very useful. The NVRAM filesystem doesn't use timestamps anywhere so no modification dates either. Basically, I need more details if you want to track other stuff.
You are right, simple is better. I can just grab startup-config/private-config, do a diff in GNS3 and warn the user if there is a difference.
Thanks for the input anyway :)
You're welcome. Feel free to make more issues like this, with stuff you want from dynamips. =)
Actually I may have closed this issue too quickly...
The thing I want to know is if there is any unsaved changes, i.e. the running-configuration differs with the startup-configuration. However, the running-configuration is just stored within the RAM, not on the NVRAM... so my question is there any way to know about unsaved changes? Because getting the startup-config and doing a diff with the config stored by GNS3 isn't gonna help...
Another strategy would be for instance to use SNMP (configured in the default startup-config) and not something implemented within Dynamips.
https://github.com/Packetslave/nagios/blob/master/check_snmp_cisco_unsaved/check_snmp_cisco_unsaved
Any comment is welcome :-)
Not sure how hard it is to get running-config from RAM, will need to check the filesystem format being used. But I feel uneasy about adding this... dynamips should be about hardware, and not IOS-dependant stuff (software).
The SNMP alternative seems interesting, but in that case I would like more advanced control over what configuration to use in each project. Use case: I might want a blank start, or no SNMP stuff, or something else in a particular project. Not sure how this would look, a very rough idea would be to have project settings and be able choose which config plugins would generate the startup config of new routers (current base config, SNMP checks, vlan commands of EtherSwitch, other custom config plugins)
Another alternative is adding support for scripting. (my favorite! :wink:) Example: Have a script that telnets to aux port, runs commands to compare both files, and sees if it changed from the feedback. It could be set up to run before stopping the server, or when saving, or other events.
I agree the SNMP alternative should be optional and need to be tested too. As for scripting I feel uneasy because it can be easily broken and it depends a lot of the state/mode IOS is at.
It needs more research for the best approach (least intrusive or complicated) but I definitely think that knowing in one way or another if the running-config has been saved would help a lot.
GNS3 should have a way to check if a user issued a "wr" or "copy running-config startup-config" in IOS (in other words if the NVRAM has been modified), thus preventing the user to close GNS3 before he has saved the config.
Don't really know how to implement something like that, my idea is that GNS3 could send a command e.g. "check nvram R1" and Dynamips would reply something like "nvram R1 checksum". Based on the returned checksum, GNS3 would know if the NVRAM has been modified since last time it checked.
Now the big question, is it possible to know if the NVRAM has changed in Dynamips?