Network configuration archiving

R. Scott Evans nanog at rsle.net
Fri Oct 25 18:17:24 UTC 2013


On 10/25/13 07:59, Matthew Newton wrote:
> For the last ~8 years we've used a very simple in-house bash
> script that uses SNMP to tell the switch to write its config using
> tftp, and then does a wr mem. It then checks the configs into a
> subversion repository and e-mails out any diffs.
>
> One criteria we had was that our config backup system wasn't going
> to get CLI access to any routers if at all possible, and this
> turned out to be a good alternative. I can't think of many times
> when it's failed to work; occasionally the odd switch might not
> respond, but that's rare.
>
> The only possible issue being that we're 100% Cisco, so I don't
> know if other vendors support the same MIBs.
>
> I'll try and post the script (250 lines) somewhere if anyone's
> interested.
>
> Cheers,
>
> Matthew

I have a very similar home-grown script, however I did need a mix of 
tftp and telnet/CLI depending on the particular platform (for instance 
recently I couldn't get the tftp approach to work with remote devices 
running IOS-XR or IOS-XE).

An overly simplified telnet module might look like:
-----------------------
#!/bin/sh
login=""
passwd=""
router=""
timeout=1		# increase this for larger configs

(sleep 1;
         echo $login;            sleep 1;
         echo $passwd;           sleep 1;
         echo term leng 0;       sleep 1;
         echo "sh run";          sleep $timeout;
         echo exit;              sleep 1;
) | telnet $router 2>&1
-----------------------

-Scott





More information about the NANOG mailing list