Script to run on a router

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to run on a router
# 1  
Old 12-05-2007
Script to run on a router

I want to make a Perl script to telnet to a router and apply commands, and get the output of the commands in a file.

Can any one help me in that?
# 2  
Old 12-05-2007
Can't any one help me, I find the script to login to router but the issue is to redirect the output of commands to a file.


use Net::Telnet ();

$machine = '';
$logfile = "cisco.log";

$t = new Net::Telnet (Timeout => 10);
print "Connected to $machine\n";
$t->waitfor('/Username: $/');
$t->waitfor('/Password: $/');
$t->waitfor('/Password: $/');

$t->cmd("show run");

????????????????????? This is what I don't know ?????????????????

print "Logged in successfully.\n";
print "Collecting informations";
print "done.\n";
print "Most heavy connection/s :\n" ;
# 3  
Old 12-06-2007
I have the script now running on cisco routers, but on Juniper routers, it time out and not continue.

Can Any one help me important , PLZ ???
Login or Register to Ask a Question

Previous Thread | Next Thread

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl telnet to router run commands from file

I have a perl script that is called with a router name command list file and output file. The command file can be very large, up to 3k of commands. At first I dumped the command list file to an array and ran the entire file on the router and captured the output. It worked ok for a command list in... (1 Reply)
Discussion started by: numele
1 Replies

2. Shell Programming and Scripting

Expect script help needed- script failing if router unavailable

Hey all. Sometimes I'm tasked to change some router configs for the entire network (over 3,000 Cisco routers). Most of the time its a global config parameter so its done with a loop and an IP list as its the same configuration change for all routers. This is working OK. However, sometimes an... (3 Replies)
Discussion started by: mrkz1974
3 Replies

3. UNIX for Dummies Questions & Answers

Remote Unix printing to my WinXP works with no router. How can I make it work through my router?

I set up remote printing on a clients Unix server to my Windows XP USB printer. My USB printer is connected directly to my PC (no print server and no network input on printer). With my Win XP PC connected to my cable modem (without the router), i can do lp -dhp842c /etc/hosts and it prints. I... (7 Replies)
Discussion started by: jmhohne
7 Replies
Login or Register to Ask a Question