|
Backups, not just for computers anymore... One day I was thinking about the number of routers and switches I have in my network. The thought came to mind, “If one of these devices quit working, how quickly could I obtain a new device, and how easily could I rebuild the device's configuration?”
I knew how to manually copy the current running configuration on the Cisco routers to a TFTP server (copy running-config tftp). If I could automate the procedure, and schedule it to run periodically, I could be assured that I would have the most recent config written on my backup server. And if I ever needed to replace a router or switch, I could easily copy the most recent backup to the new device. All of the routers (and most of the switches) in my network accept telnet connections. Most often, when I need to telnet to a device, I use a program called Tera Term Professional. It comes with a macro program that allows you to build scripts to automate tasks. I figured that if I could build a macro in Tera Term Professional to log into the router, copy the running configuration to a TFTP server, then log out of the router, I could automatically back up the configs of my routers (with the help of a scheduling program, a batch file, a text file that contains the IP addresses of my routers, and a TFTP server). I have a Windows 2003 server that acts as my backup server. I loaded a command-line TFTP program on that server and configured it so that it ran as a service (that way the TFTP program would run even if no one is logged in), as well as a freeware scheduling program. I then created a text file that contained a list of router loopback addresses, and a batch file that parsed the list of IP addresses and launched the Tera Term Professional macro. The macro logs into the router, copies the running configuration to my backup server, names the configuration with a timestamp and the name of the router, then logs out. Since the configurations of my routers change infrequently, I have the macro set to run once a week. Overall, this method works well. The macro is not super-complex, and it does not have error-checking capabilities (if a router was offline while the backup program ran, the macro would hang, and I would need to manually intervene). This type of error-checking could be programmed into the macro, but I have not developed this yet. I have used my network device backups on several occasions. - When implementing a new router, I will often refer to the configuration of an existing router (many times I simply copy-and-paste the config and tweak it as necessary).
- If something would happen to a router and it would not function like it did, I can look at a previous config and compare it with the current config to see if anything was changed (in my network, several people have access to my routers).
- If I needed to redeploy a network device, I could make a copy of the config, tweak it, and then load it into the device.
|