in reply to copy run tftp on cisco router using net::snmp

I know this isn't your question, but you can accomplish the same task with Net::Telnet. Here's a script:
#!/usr/bin/perl use Net::Telnet; my $dow = `date '+%w' --date '1 days ago'`; my $router = "IP_OF_ROUTER"; my $user = "username"; my $pass = "password"; my $enable = "enable_password"; my $tftp_server = "IP_OF_SERVER"; my $t = new Net::Telnet(Timeout => 10); $t->open( $router ); $t->waitfor( '/Username:/' ); $t->print( "$user" ); sleep 2; $t->waitfor( '/Password:/' ); $t->print( "$pass" ); sleep 2; $t->print( "enable" ); $t->waitfor( '/Password:/' ); $t->print( "$enable" ); sleep 2; $t->print( "copy startup-config tftp" ); sleep 2; $t->print( "$tftp_server" ); sleep 2; $t->print( "router.$dow" ); sleep 3; $t->print( "quit" ); exit( 0 );

Replies are listed 'Best First'.
Re: Re: copy run tftp on cisco router using net::snmp
by c (Hermit) on Aug 09, 2001 at 16:47 UTC
    Thanks, however, I will not have access to the router via telnet. Our environment uses tacacs, and the systems group will not add a generic user that can be used via the script for login purposes to perform the wr net. Which leaves me with my only alternative. Taking advantage of the RW snmp string on the routers and getting the information through that method. I could certainly use my login/password pair for access, however, I'd like this script to survive whether or not I am with the company of not.
    Thanks for the suggestion and your time spent writing the alternative script, however I'm locked into using net::snmp.

    humbly -c