Pages

Oct 17, 2013

Automating Cisco configuration tasks with perl and SNMP, or, I work smarter because I'm lazy

My job as a network engineer is one which lends itself to automating repetitive tasks. I was also, for some period of time, reporting to a manager whose approach to IT expenditure was to ignore our pleas to spend money to avert a spectacular disaster until that disaster occurred, either because he didn't understand the problems we told him would occur, or because after it blew up it was an easier sell to the business. Due to the poor funding of everything, engineer toolsets were the last thing that got any money, and due to that paucity I have achieved some success in implementing complex control systems with some very simple tools using Linux shell and perl scripts. After successive generations of improvement, I wanted to share these with the engineer community.

One of the earliest toolsets I built utilized SNMP to back up the configuration of our Cisco routers and switches. From there it was a simple step to use this save running configurations to backup configurations, and to push out configuration changes. Note that these tools assume you have:
  • A Linux server with
    • a writable TFTP directory
    • SNMP tools using a default SNMP string
    • Perl installed
    • The necessary Cisco MIBs installed, though you could go look up the numeric equivalent OIDs and substitute them. 

Just copy these into a directory in your path and make them executable.