RE: snmpset to recover router VTY password

From: Larry Roberts (groupstudy@american-hero.com)
Date: Sat Jun 19 2004 - 01:43:21 GMT-3


Just thought I would share this script that I used.

I have a file named routers.list, which is oddly enough, a list of routers
:)
The script creates a folder of today's date, and moves all the tftp'd
configs to that directory.
Its called from a cron job.
Maybe not the most efficient, and most certainly not the most elegant, but
it worked.
You would need to adjust some paths to use the script, but I suspect your
just after the MIB.

Short story long, , you can see the MIB I used below.
This was running on a RedHat linux box, 9.0 I believe.

#!/bin/sh
#
SNMPC=AREADWRITECOMMUNITY
DATESTMP=`date +%m-%d-%y`
for DEVICE in `more ../routers.list` ;
do
SITEID=$DEVICE
snmpset -v1 -c $SNMPC $SITEID .1.3.6.1.4.1.9.2.1.55.IP.OF.TFTP.SERVER s
$SITEID\-$DATESTMP
done
sleep 30
mkdir /path/to/backups/$DATESTMP
mv ../tftp/*rt* /path/to/backup/$DATESTMP/

-----Original Message-----
From: nobody@groupstudy.com [mailto:nobody@groupstudy.com] On Behalf Of
Mathew
Sent: Friday, June 18, 2004 10:15 AM
To: ccielab@groupstudy.com
Subject: snmpset to recover router VTY password

Hi

I have a remote router, R1 that I can not access because VTY password is not
known. The SNMP with Write access is configured on the router R1.

R1 ----------- R2
         |
        |
        Linux server with "SNMPSET" command

I can not send a config file to R1 with a VTY password using the "SNMPSET"
command from my linux server as the TFTP source IP is not correctly set on
the R1 (command "ip tftp source-interface" is not configured). I can ping R1
from my linux server, SNMPwalk works and I can telnet to R1 (I can not login
as the VTY password is not known).

There is full IP connectivity between R1 & R2 and I know for sure that
R1 can get a config file, stored in flash of R2 via TFTP if I make the
R2 TFTP server with the command, "tftp-server".

I need to know how to use the SNMPset command on my linux server to instruct
the R2 to send the config file to R1.

Is this possible?

I have tried the below command but it did not work.

snmpset -c <RW community> <routerIP> 1.3.6.1.4.1.9.2.1.53.#.#.#.# s conf

#.#.#.# <- TFTP server IP = R2
<routerIP> = R1

Can you please help on this?

Thanks

Mathew



This archive was generated by hypermail 2.1.4 : Sat Jul 03 2004 - 19:40:44 GMT-3