Reset VTY lines via SNMP

All credit to Gregg Sietsema.  I have shamelessly lifted his example as I have used it several times and I didn’t want to lose it were his site to go offline.

Often times the idle timeout on an IOS device has been disabled and all vty lines are full. This leaves no way to access the device other than console\auxiliary.  If console access isn’t readily available and you have SNMP Read/Write access to the device here is a quick method that may save you some driving. You will need to download NET-SNMP here.


For the purpose of this example

IOS Device: 10.1.10.250

Read\Write Community: private

  1. First find all the available lines and identify which are vty lines. To do this go to the command prompt and change your directory to c:\usr\bin

snmpwalk -v 2c -c private 10.1.10.250 1.3.6.1.4.1.9.2.9.2.1.2

The results of the command will display all lines on the device.

Integer values

1 = unknown
2 = console
3 = terminal
4 = line-printer
5 = virtual-terminal
6 = auxiliary

2.  Now check to see if these lines are active.

snmpwalk -v 2c -c private 10.1.10.250 1.3.6.1.4.1.9.2.9.2.1.1

The results of the command will display the status of the lines.

Integer values

0 = Idle Line
1= Active Line

3.  Pick one of the active vty lines to clear.  Below command clears line 2.  (The number 2 after the keyword integer is the line number to be cleared)

snmpset -v2c -c private 10.1.10.250 .1.3.6.1.4.1.9.2.9.10.0 integer 2

Example

C:\usr\bin>snmpwalk -v 2c -c private 10.1.10.250 1.3.6.1.4.1.9.2.9.2.1.2

SNMPv2-SMI::enterprises.9.2.9.2.1.2.0 = INTEGER: 2
SNMPv2-SMI::enterprises.9.2.9.2.1.2.1 = INTEGER: 5
SNMPv2-SMI::enterprises.9.2.9.2.1.2.2 = INTEGER: 5
SNMPv2-SMI::enterprises.9.2.9.2.1.2.3 = INTEGER: 5
SNMPv2-SMI::enterprises.9.2.9.2.1.2.4 = INTEGER: 5
SNMPv2-SMI::enterprises.9.2.9.2.1.2.5 = INTEGER: 5
SNMPv2-SMI::enterprises.9.2.9.2.1.2.6 = INTEGER: 5
SNMPv2-SMI::enterprises.9.2.9.2.1.2.7 = INTEGER: 5
SNMPv2-SMI::enterprises.9.2.9.2.1.2.8 = INTEGER: 5
SNMPv2-SMI::enterprises.9.2.9.2.1.2.9 = INTEGER: 5
SNMPv2-SMI::enterprises.9.2.9.2.1.2.10 = INTEGER: 5
SNMPv2-SMI::enterprises.9.2.9.2.1.2.11 = INTEGER: 5
SNMPv2-SMI::enterprises.9.2.9.2.1.2.12 = INTEGER: 5
SNMPv2-SMI::enterprises.9.2.9.2.1.2.13 = INTEGER: 5
SNMPv2-SMI::enterprises.9.2.9.2.1.2.14 = INTEGER: 5
SNMPv2-SMI::enterprises.9.2.9.2.1.2.15 = INTEGER: 5
SNMPv2-SMI::enterprises.9.2.9.2.1.2.16 = INTEGER: 5

From the output above you can see that lines 1 – 16 are vty lines. 

C:\usr\bin>snmpwalk -v 2c -c private 10.1.10.250 1.3.6.1.4.1.9.2.9.2.1.1

SNMPv2-SMI::enterprises.9.2.9.2.1.1.0 = INTEGER: 0
SNMPv2-SMI::enterprises.9.2.9.2.1.1.1 = INTEGER: 1
SNMPv2-SMI::enterprises.9.2.9.2.1.1.2 = INTEGER: 1
SNMPv2-SMI::enterprises.9.2.9.2.1.1.3 = INTEGER: 0
SNMPv2-SMI::enterprises.9.2.9.2.1.1.4 = INTEGER: 0
SNMPv2-SMI::enterprises.9.2.9.2.1.1.5 = INTEGER: 0
SNMPv2-SMI::enterprises.9.2.9.2.1.1.6 = INTEGER: 0
SNMPv2-SMI::enterprises.9.2.9.2.1.1.7 = INTEGER: 0
SNMPv2-SMI::enterprises.9.2.9.2.1.1.8 = INTEGER: 0
SNMPv2-SMI::enterprises.9.2.9.2.1.1.9 = INTEGER: 0
SNMPv2-SMI::enterprises.9.2.9.2.1.1.10 = INTEGER: 0
SNMPv2-SMI::enterprises.9.2.9.2.1.1.11 = INTEGER: 0

From the output above you can see that lines 1 – 2 are active lines. 

C:\usr\bin>snmpset -v2c -c private 10.1.10.250 .1.3.6.1.4.1.9.2.9.10.0 integer 2

SNMPv2-SMI::enterprises.9.2.9.10.0 = INTEGER: 2

From the output above you can see that line 2 has been cleared.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.