Switches, Hubs, and Modems
1752781 Members
5863 Online
108789 Solutions
New Discussion юеВ

Re: Use SSH to power cycle PoE ports

 
SOLVED
Go to solution
Meastaugh1
Advisor

Use SSH to power cycle PoE ports

I need to reset a couple of PoE devices attached to a 2600-8PWR switch. I believe the route to do this is via SSH. Because I need to get to the config menu I'll need to use the manager mode user. Presumably as a result, I can't use keys, but instead will need to use the local switch user database. So, I've enabled SSH access with the local accounts:
config
aaa auth ssh enable local

I'm using plink as the windows client.
I can run the command and get a telnet interface as follows:
plink -ssh -l admin -pw switchpassword 192.168.0.123

but if I try any of the below I get this error: FATAL ERROR: Server refused to start a shell/command
plink -ssh -l admin -pw switchpassword 192.168.0.123 "config"
plink -ssh -l admin -pw switchpassword -batch 192.168.0.123 "config"
plink -ssh -l admin -pw switchpassword -m readers.txt 192.168.0.123
plink -ssh -l admin -pw switchpassword -batch -m readers.txt 192.168.0.123

---readers.txt---
config
no interface 5 power
interface 5 power
no interface 6 power
interface 6 power
---readers.txt---

Any idea where I'm going wrong?
7 REPLIES 7
Mohammed Faiz
Honored Contributor

Re: Use SSH to power cycle PoE ports

Hi,

I've tried to get remote commands working via plink in the past and it's never worked for me. I don't think the switches support that type of interaction.
In the end I used a perl script to enter commands as if it was a normal interactive SSH session (but it wasn't bullet-proof).
A better option for you would probably be to find the relevant SNMP oid to power cycle the ports. I don't know what is is but I'll try and have a look for you.
Meastaugh1
Advisor

Re: Use SSH to power cycle PoE ports

Thanks Mohammed, I look forward to any further advice you can offer.
Mohammed Faiz
Honored Contributor

Re: Use SSH to power cycle PoE ports

OK, so the OID I think you want is:

pethPsePortAdminEnable.

(1.3.6.1.2.1.105.1.1.1.3 which is powerEthernetMIB.1.1.3)

And a value of "1" is 'true' which enables power delivery on the port and "2" is 'false'.
Meastaugh1
Advisor

Re: Use SSH to power cycle PoE ports

Thanks for the reply. I haven't really used SNMP before so would appreciate some guidance.

I've downloaded netsnmp and ran this command to see all available OIDs and dumped to a file:
snmpwalk -v 2c -c public -m all -Os 192.168.1.1 iso > snmp.txt

I've then searched the file for 1.3.6.1.2.1.105.1 and wasn't able to find it. Should I have been able to?

If 1.3.6.1.2.1.105.1 = pethPsePortAdminEnable, what do the remaining digits equate to (1.1.3)? Is the second digit the port, and the third the power state? Thanks
Mohammed Faiz
Honored Contributor
Solution

Re: Use SSH to power cycle PoE ports

Hi,

It will depend upon what access your public community has ("show snmp-server"). I suspect if it's "restricted" it won't be able to see that oid. If that's the case you should create a new community with "unrestricted" access to use.

1.3.6.1.2.1.105.1 isn't pethPsePortAdminEnable, it's powerEthernetMIB. The 1.1.3 refers to pethPsePortAdminEnable then the port number would be on the end of that (e.g. 1.3.6.1.2.1.105.1.1.1.3.25 for port 25)
Mohammed Faiz
Honored Contributor

Re: Use SSH to power cycle PoE ports

Sorry, scratch that, my mistake. I've just checked and you can see it on the public community (you just won't be able to change the value without the correct level of access on the community).
Also, you want to search for "pethPsePortAdminEnable" in that file rather than the numberical OID to find it in that snmpwalk command output.
Meastaugh1
Advisor

Re: Use SSH to power cycle PoE ports

Thanks, that helped, all working now with the following parameters:
snmpset.exe -v 2c -c hello 192.168.0.123 1.3.6.1.2.1.105.1.1.1.3.1.5 i "2"
snmpset.exe -v 2c -c hello 192.168.0.123 1.3.6.1.2.1.105.1.1.1.3.1.6 i "2"
snmpset.exe -v 2c -c hello 192.168.0.123 1.3.6.1.2.1.105.1.1.1.3.1.5 i "1"
snmpset.exe -v 2c -c hello 192.168.0.123 1.3.6.1.2.1.105.1.1.1.3.1.6 i "1"