Skip to Content
Cisco IOS Cookbook, 2nd Edition
book

Cisco IOS Cookbook, 2nd Edition

by Kevin Dooley, Ian Brown
December 2006
Intermediate to advanced
1188 pages
72h 8m
English
O'Reilly Media, Inc.
Content preview from Cisco IOS Cookbook, 2nd Edition

Using SNMP to Perform Mass Configuration Changes

Problem

You want to automate the distribution of a set of configuration commands to a large number of routers.

Solution

The following Perl script will distribute configuration commands to a large number of routers. It works by using SNMP to trigger TFTP file transfers into the routers. In effect, this script lets you automatically distribute a series configuration commands to a list of routers. Automating routine changes like this saves time and effort, but more importantly, it virtually eliminates typographical mistakes.

Here’s some example output:

Freebsd% ./snmpcfg.pl
=================================== 
toronto - Update Successful
toronto - Wr Mem Successful
=================================== 
boston  - Update Successful
boston  - Wr Mem Successful
=================================== 
denver  - Update Successful
denver  - Wr Mem Successful
=================================== 
newyork - Update Successful
newyork - Wr Mem Successful
=================================== 
detroit - Update Failed
=================================== 
chicago - Update Successful
chicago - Wr Mem Successful
=================================== 
sanfran - Update Successful
sanfran - Wr Mem Successful
=================================== 
seattle - Update Successful
seattle - Wr Mem Successful
===================================
Freebsd%

The Perl code follows in Example 17-3.

Example 17-3. snmpcfg.pl

#!/usr/bin/perl -w # # snmpcfg.pl -- a script to perform mass configuration ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

IP Routing on Cisco IOS, IOS XE, and IOS XR: An Essential Guide to Understanding and Implementing IP Routing Protocols

IP Routing on Cisco IOS, IOS XE, and IOS XR: An Essential Guide to Understanding and Implementing IP Routing Protocols

Brad Edgeworth, Aaron Foss, Ramiro Garza Rios
Cisco Software-Defined Access

Cisco Software-Defined Access

Srilatha Vemula, Jason Gooley, Roddie Hasan

Publisher Resources

ISBN: 0596527225Supplemental ContentErrata Page