cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1609
Views
0
Helpful
1
Replies

Disabling ports on SG300 Switch Using SNMP

jim.irwin1
Level 1
Level 1

We use the SG300 to communicate with 24 devices for testing.  I was asked to create an application to disable a port if that position is failing chronically.

My investigation led me to the following webpage posting ...
http://stackoverflow.com/questions/9170644/how-can-i-enable-disable-ports-in-cisco-catalyst-2960-with-c

First, I setup the switch by enabling the SNMP service and then added public (RO) and private (RW) communities.

Then I used NET-SNMP to disable port 1 as shown:
snmpset.exe -c private -v2c -m IF-MIB 192.168.0.2 1.3.6.1.2.1.2.2.1.7.1 i 1
Get the following error ...
Error in packet.
Reason: notWritable (That object does not support modification)
Failed object: IF-MIB::ifAdminStatus.1

By the way, you can find info on NET-SNMP at http://www.net-snmp.org/

Then I decided to try the code at stackoverflow that uses SnmpSharpNet API. It also returns an error.

Can you help me find out how to succesfully disable a port on an SG300 switch?

Jim

1 Reply 1

Brendan Kearney
Level 1
Level 1

i would suggest you look into something like iReasoning's MiB Browser.  the OID you are using may not be the designation for any port on your switch.

the index of all interfaces is .1.3.6.1.2.1.2.2.1.1

you need to find and map the index values, so that you can set .1.3.6.1.2.1.2.2.1.7.<index_value>. to 2, to disable the port.

my switch (sg300-28) uses 49 as the start of the index and goes to 76, for all physical ports.  VLANs, Port Channels, etc have different values.  i would need to set .1.3.6.1.2.1.2.2.1.7.49 to 2, to disable gi1/1.