I have a few routers and switches that were deployed to remote locations and the crypto key was not generated before they were shipped, they are working and I have SNMPv3 write access to them but I want to ssh to them without having to travel to site with console cable and laptop. Want to know snmpset oid to generate crypto key.

  • Can you list the IOS versions in use? Aug 27 '13 at 13:23
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can post and accept your own answer.
    – Ron Maupin
    Jan 5 at 1:20

You can use the below to just send a list of commands to the router the file has the actual commands

config t
crypto key generate rsa

Then ssh to the router and complete the config

or just enable telnet if you can get away with it

config t
vty 0 4 
transport input ssh telnet

I have a perl script that does this to reset enable passwords

The mib is

hostConfigSet . 

From the management station command line, with the use of the MIB object hostConfigSet, enter this:

% snmpset -t 60 \
    private . \
    s router-config


% snmpset -t 60 private \
  enterprises. = "router-config"
  • If OP wants to use SNMP to download config, it might be useful to read also networkengineering.stackexchange.com/questions/1789
    – ytti
    Aug 28 '13 at 7:28
  • Will this work with SCP file transfer? Aug 30 '13 at 5:15
  • I think only tftp there may be another OID for TFTP or one that allows you to send a URI format, but I can use tftp so that's what I do
    – fredpbaker
    Aug 31 '13 at 18:00

I don't know if you can fix the SSH directly through SNMP. However, a lot of Cisco's suppport SNMP triggered config downloading or uploading from/to a TFTP server. You should be able to upload a new config containing the SSH stuff.

You need the CISCO-CONFIG-COPY-MIB, available on IOS >= 12.0. If you have the device config, you can create a new version including the SSH stuff and upload it. If not, first download the running config from the device.

Important note: uploading to the running config merges your upload into the existing config, but uploading to the startup config overwrites what's already there.

Cisco's instructions can be found here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.