December 2006
Intermediate to advanced
1188 pages
72h 8m
English
You want to automate the distribution of a set of configuration commands to a large number of routers.
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 ...