In order to prevent the loss of connection due to misconfiguration, how to restore to the previous configuration after a given time (for example, 5 minutes)
Thanks for any advice given!
To start with the most obvious: there is a back-up / restore mechanism for the configuration.
If you want to restore within 5 minutes of a misconfiguration, you probably are still near the web-interface or a shell, and can manually revert to the previously saved config.
There is a menu item to make this convenient: go to system > configuration > history
I didn't notice you asking how to do this automatically; if that is what you want to know then I don't know.