04-11-2002 09:41 AM - edited 03-01-2019 09:15 PM
Hi,
I would like to be able to setup a script file that would remote into 20 or so switches, and make a few configuration changes. Does anyone know if I can create a batch/script file that would telnet to the switch and run a command on the switch, say the clear counters command, and then telnet to another switch?
thanks for any ideas,
Dave
04-11-2002 04:33 PM
You can write your own perl/expect scripts for this purpose.
04-11-2002 10:32 PM
You could also use RME's Netconfig application, if you have CiscoWorks2000. It lets you make same config changes on a number of devices.
-Ganesh.
04-24-2002 03:02 AM
Dave,
I have been using a free package called Expect running on Redhat Linux. This package performs the functions of an interactive telnet session giving responses based on if / then types of interactions.
Joseph
04-24-2002 04:29 AM
Dave,
I found the netconfig under RME/configuration managment is the best way to change router or switch configs.
But if you just what to see certain show commands, for instance frame PVC's active on a router. This is the script I have been using just a simple shell script. Run this script via ./do-telnet | telnet > output.file
#!/bin/ksh
# As of 4/5/02 08:40am
# This script is test a telnet and produce a file on the output.
host=router.your.domain.com
port=23
login=tacacs
passwd=tacacs
cmd1="term length 0"
cmd2="sh frame pvc"
echo open ${host} ${port}
sleep 1
echo ${login}
sleep 1
echo ${passwd}
sleep 1
echo ${cmd1}
sleep 1
echo ${cmd2}
sleep 1
echo exit
Bill
04-24-2002 04:55 AM
If you want quick and dirty try CatTools by Kiwi software (shareware)
-Jeff
04-24-2002 08:52 AM
I like Expect for tasks like these. I am not a programmer, I am not very good at scripting, and I have managed to script some tasks that we usually use interactive CLIs for.
It runs on UNIX or Window. I prefer to run it from a Solaris box.
04-29-2002 09:46 PM
Here is a little snippet of Perl to try (it works for me):
use Net::Telnet ();
$switch_ip = "ip address of switch";
$password1 = "your line password";
$password2 = "your enable password";
$t = Net::Telnet->new( Timeout => 10);
$t->open($switch_ip);
$t->waitfor('/:/');
$t->print($password1);
$t->waitfor('/>/');
$t->print("enable\n");
$t->waitfor('/:/');
$t->print($password2);
$t->waitfor('/#/');
$t->print("term length 0\n");
$t->waitfor('/#/');
...continue using waitfor() function to interact with telnet host...
I hope it helps.
04-30-2002 08:59 AM
I too wrote something using Perl's Net::Telnet module, but rather than writing a new script each time I designed a very simplistic "language" that's interpreted by the script. For example, you can turn debugging on and off, and output on and off (sometimes you only want to capture the output from one of a series of IOS command). So, all you need to do is write a bunch of command scripts rather than a new Perl program each time.
Drop me a line if you'd like a copy. I'm happy to share it.
05-30-2002 09:10 AM
Hi,
You might check out the jakarta.org website about ANT
which can be used from both PC's and linux/Unix.
I had this bet with a person that a 1 year development
project written in C++ to address things like global
commuunity string re-setting, (their _older_ nodes only have telnet, no SNMP), and SNMP-less status polling
could easily be completed in three or four months...
Ok, I admit it, I_WAS_WRONG....
Using ANT try 3 WEEKS!
While network management may not look like config mgmt, you'll be hard pressed to point out the differences
between a multi-OS software release and multi-vendor
topolology (re)configuration.
The real bang is that you can extend ANT using java
and (whatever they don't already have, you add on
yourself). See Taskdef.
I can envision ANT calling JMX (Sun tm.) to do the
SNMP things, and calling telnet to do the others..
(or JMX calling an SMNP trap to an ANT Task MLET)
SweeeeeeeeeeeeeeeT! (I'm working on it).
Goto the ANT Documentation page,
http://jakarta.apache.org/ant/manual
then look at Builtin Tasks and Optional tasks.
Then being an engineer... download it and enjoy
over the weekend... You'll be happy happy joy joy....
Sincerely,
RobV.
AdsAlive Inc.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide