Change the same configuration command on multiple Cisco switches

Source: Internet
Author: User
Tags snmp switches

Q: Are there any simple tools and methods? Do a script, automatically execute on a script in N-around Cisco switches, and then return the results?

Method One, the switch configuration file download, modified and uploaded to the n-switch. Then restart or copy start run.

Method Two, under Windows to build a bat file, the contents and you telnet to the switch to modify the command used when the same, but the IP address needs the n times, more trouble. Then run the bat file.

Method Three, use Ciscoworks 2000 to configure once to fix, this method has certain restrictions, such as the first in each switch to the use of SNMP, if it is a newly enabled switch, or not with SNMP (certainly not), if each switch password is not the same, or can not be configured.

Method Four, write a small script in Perl, although it will take a day or a while for beginners. But it's definitely worth it.

#!/usr/bin/perl
Use strict;
Use Net::telnet::cisco;
My $infile = "input.txt"; # Cisco Device List
My $username = "user"; # login Username
My $passwd = "password"; # login Password
Open (INFILE, "$infile") | | Die "Can ' t open $infile $!";
while (my $ip =<infile>) {
Chomp $ip;
My $t = net::telnet::cisco->new (Timeout =>, Input_log => "Input.log");
$t->open ($IP);
$t->login ($username, $passwd);
$t->enable ($PASSWD);
$t->cmd (' term length 0 ');
$t->cmd (' sh ver '); # can change the command sh ver to your command
$t->close;
}
Close INFILE;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.