How to shutdown an interface using SNMP remotely

Publication Date:  2017-01-01 Views:  397 Downloads:  0
Issue Description

Let's consider a S5700 switch with version V200R005C00SPC500 for which we are trying to shutdown one of its interfaces remotely using SNMP. It's possible? Yes, let's see how to do it.


Firstly we will need a tool to generate SET request SNMP packets to query the switch. You will have to choose one from the many tools available on the internet.

Next, we will need to find a OID. This is the correct one.

What this string means: is the ifEntry table which describes different characteristics of an interface. Check below more relevant subtables:

• - ifIndex
• - ifDescr
• - ifType
• - ifMtu
• - ifSpeed
• - ifPhysAddress
• - ifAdminStatus
• - ifOperStatus
• - ifLastChange
• - ifInOctets
• - ifInUcastPkts
• - ifInNUcastPkts
• - ifInDiscards
• - ifInErrors
• - ifInUnknownProtos
• - ifOutOctets
• - ifOutUcastPkts
• - ifOutNUcastPkts
• - ifOutDiscards
• - ifOutErrors
• - ifOutQLen
• - ifSpecific

The one  we are interested it's subtable 7, ifAdminStatus [7] which defines the status of the interface.

The last number for the string is 14 and it defines the interface index. To see the index of the interface please insert the below command :
[sw]display ifnet index-map

then we can see that interface g0/0/10 has index 14 associated.

What value 2 of  ”ASN1_INT” represents?  it's the SET request integer value that it's used to trigger a specific interface state. It has 3 possible states {up (1),down (2),testing (3)}. We will pick 2 for this.

Finally this is how the set-request packet should look like.

The result:

Don't forget to enable write community rights in order for the switch to respond to set-request SNMP requests.