Turning interfaces on and off via SNMP command

3 posts · Closed

r1993r Guest
27 Oct 2020

With the newly added features, I now have the Port Mapper turning interfaces on and off, achieved by a single SNMP command:

snmpset -r:%0 -v:3 -sn:SNMPNAME -ap:SHA -aw:AUTHPW -pp:DES -pw:PRIVPW -O:.1.3.6.1.2.1.2.2.1.7.[Port ID] -val:1 -tp:int
snmpset -r:%0 -v:3 -sn:SNMPNAME -ap:SHA -aw:AUTHPW -pp:DES -pw:PRIVPW -O:.1.3.6.1.2.1.2.2.1.7.[Port ID] -val:2 -tp:int

-val:1 being UP
-val:2 being DOWN

SnmpSet.exe [-q] -r:host [-p:port] [-t:timeout] [-v:version] [-c:community]
[-ei:engine_id] [-sn:sec_name] [-ap:auth_proto] [-aw:auth_passwd]
[-pp:priv_proto] [-pw:priv_passwd] [-ce:cont_engine] [-cn:cont_name]
-o:var_oid -val:value [-tp:type]

Now to figuring out how to change the port status in Port Mapper to match... lol... Only joking!!! :)
VLAN change next.

r1993r
28 Oct 2020

In addition to the above I wanted to point out that the config is specific to Cisco switches and used the external SNMPSET (free) command line program for pushing the SNMP command to the switch. It makes use of the recently added feature whereby you can parse Column headers from the app into the command making the insertion of the [Port ID] possible and also the IP of the switch "%0". You must also have a writeable SNMP configuration on your switch.

The above command can be used via the File>Settings>Applications menu to create a right-click "Open Switch" option when selecting the interface.

I haven't really thought of other possibilities for this as I was mainly focused on changing the port state and also changing the vlan for the port, which is my next bit of research and hopefully just as simple once I know the OID. The only limit being is that it must be done from a single one-line command.

Would be good to see if this is of any use to any one else, or if they can come up with other use cases!

Would be interesting to hear if after running a command the app could trigger another read for that particular interface to update the change that was made... but I've burdened the dev team with many feature requests over the last few weeks, and just want to say a huge thanks to everyone for making my job more efficient by offering this app!

Andrew SoftPerfect
28 Oct 2020

r1993r wrote:
Would be interesting to hear if after running a command the app could trigger another read for that particular interface to update the change that was made...

The problem with this is that we don't really know what a specific external command does and what bits of information must be updated.

I guess at some point we might implement simple built-in commands (like enable/disable port) and in this case it should be possible to update the data without a complete rescan.

This topic is closed. It has had no new posts for over a year, so the software versions it talks about may be out of date. Start a new topic in Switch Port Mapper if you have a similar question.