When I configure onto a router, the configurations are stored in running configuration and it requires for me to run "wr" command to store running configurations onto startup configuration. Thus, this enables the configurations to be retained even after router restart.
Is there any mechanism, wherein any configuration that I do on the router, should by default be written onto startup configuration, without me explicitly invoking the "wr" command every time.
you have several ways of saving your config on the tftp server on a timely basis. You ask if for saving the config everytime you run a command on the router.
kindly run the following clis on the router to have this executed:
event manager applet MANAGEWRITE
event cli pattern ".*" sync no skip no
action 1.0 cli command "wr mem"
action 2.0 cli command "do wr mem"
action 3.0 cli command "enable"
action 4.0 cli command "wr mem"
The term MANAGEWRITE here highlighted in GREEN is just a name. You can name it whatever you wish.
Hope this answers your query. Let me know if you have any doubts....
The whole idea of not doing a write automatically is to make sure that changes that might cause issues to the working condition of the router can be avoided and in the worst case when they reload the router, it should come up with the good old config that was available in the start-up config.
In your case you wanted every line of config to be written in the startup, which is not a good idea.
What you can do is, you can do a periodical write on the tftp server. This could be every day or every week.
Could the write be scheduled, say once in 5 hours or so, the running config to be copied to startup config? If yes, can you please share the updated solution?
As mentioned, there are several ways to do a periodic backup. You have commands that range from two lines to several lines. I use the following to do a write mem every 6 hours daily.
kron occurrence daily1 at 00:00 recurring
kron occurrence daily2 at 06:00 recurring
kron occurrence daily3 at 12:00 recurring
kron occurrence daily4 at 18:00 recurring
kron policy-list save-config
cli write memory
If you want to do a write mem every one hour, You can use the following commands
event manager applet WR_Conf
event timer cron name WR_Conf cron-entry " 25 * * * *"
action 1.0 cli command "enable"
action 1.1 cli command "wr"
action 1.2 syslog msg "Config has been saved by EEM script"
DO not worry about the number 25 in the entry " event timer cron name WR_Conf cron-entry " 25 * * * *" "
This can be anything between 0 and 59. it will repeat it every 60 minutes as the clock strikes the same number in the minutes field every 60 minutes.