managing IOS and CatOS switch

Answered Question
Apr 6th, 2009

I have IOS using ssh V.2 and CatOS using SSH v.1 and I have perl cgi- ssh expect script to remote access those 2 switch. however, I am able to access the IOS switch but not the CatOs. anybody knows how can alter my script to handle both version or this not achievable.any help highly appreciated.

I have this problem too.
0 votes
Correct Answer by Joe Clarke about 7 years 7 months ago

"term len 0" is not valid for CatOS. The equivalent command is "set length 0".

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
Joe Clarke Mon, 04/06/2009 - 15:44

As long as your SSH client supports both versions of the protocol, no changes to expect is required. OpenSSH supports both protocols.

cisco24x7 Mon, 04/06/2009 - 16:17

just a wild guess on my part but when you ssh to the CatOS from the client where you initiate the perl-expect script, did you use something "spawn ssh -1 -l $username $remotehost". I have not used ssh on CatOS that much but I don't think CatOS support ssh version 2. Most unix ssh client default to version 2. That could be the issue.

eliaspaulos Tue, 04/07/2009 - 06:28

Thanks a lot for your response!I am using "spawn ssh -l $username $remotehost" not using force version -1 since the other switch using version 2.unfortunately all our CatOS using version 1.I have enabled both Version 1 and 2 on my unix server but still the expect script unable access the CatOS switch.

eliaspaulos Tue, 04/07/2009 - 06:39

my unix server enabled for both ssh Version 1 and version 2 but no luck so far, I have attached my expect script. if you guys see any error.thanks a lot

Attachment: 
Joe Clarke Tue, 04/07/2009 - 09:04

If you're using OpenSSH, protocol version 1 will print:

RSA1 key fingerprint ...

So you'll need to modify your regular expression:

expect {

-re "RSA1? key fingerprint" {send "yes\r"}

timeout {puts "RSA error -> $expect_out(buffer)";exit}

}

Of course, you didn't mention the specific error you're seeing, so it's impossible to know if this is the only problem (or a problem at all).

eliaspaulos Tue, 04/07/2009 - 10:04

thanks J. we are close too. after added as you suggested to expect RSA1" now the error I got is

"term len 0

Unknown command "term". Use 'help' for more info." so when add a comment on this line on my expect script

#expect {

-re "\[#>] ?$" {send "term len 0\r"}

timeout {puts "error reading prompt -> $expect_out(buffer)";exit}

}

my script able to access the switch but display only the the banner section when I run a script " as you know this CatOs display first the banner before going to device prompt. so it's hang on banner portion not going to actual switch123> (enable).

Thanks

Correct Answer
Joe Clarke Tue, 04/07/2009 - 10:10

"term len 0" is not valid for CatOS. The equivalent command is "set length 0".

Actions

This Discussion