Trying to get Net::SSH::Perl to connect to a Cisco switch is a pain in the ass. Before, I used Net::Telnet::Cisco but since the customer decided to move everything to a new IOS version, we're stuck with adding support for Net::SSH::Perl. Initially, it seemed like there was nothing we could do but port the scripts to expect but as it turned out, there were some comments on CPAN Forum. Unfortunatly, the suggested patches only work if you want to run a single command.. and not if you have to run enable mode first. Looks like I'll have to get my Expect shoes out anyway :(
Re:Net:::Telnet and IOS
dhammans on 2006-08-20T12:59:29
I'm having the same problem. I have a bunch of Net::Telnet::Cisco scripts that need to be converted for SSH only use; the US DOD mandates that telnet never be used for switch management functions so we're having to convert everything.
Did you guys make any headway? I'm not a big fan of expect either...Re:Net:::Telnet and IOS
Beatnik on 2006-08-20T19:51:44
Expect worked fine for us.. but then a co-worker pointed out to me that he got stuck in a similar and got a way out by actually just RTFM. He found the solution in the Net::Telnet example. It included an example with forking SSH. I still have to implement this solution but it worked for him:) Re:Net:::Telnet and IOS
J73 on 2007-11-19T23:59:45
I had the same problem and cobbled online examples together into a script that works for my IOS routers. Tweak the regexps defining the prompts and change the commands to make it work for CatOS devices. Any ugliness is undoubtedly my fault, because I don't really know perl. http://rapidshare.com/files/70916304/Net-SSH-IOS.pl.html/Re:Net:::Telnet and IOS
oliver on 2007-01-29T00:08:17
I know this is an old thread... but automating Cisco things has popped to the top of some people's stacks with these recent IOS expliots being announced.
Anyway, check out my module for this, which is a wrapper around Net::Telnet and supports Telnet, SSH and Serial line scripted command sequences.
Net::Appliance::Session 0.09 (0.12 will be out this week, with some nice new features)