in reply to Net::Telnet::Cisco - command timed-out error

Given the line number, it's the login that's failing. This suggests that it's not seeing the login prompt that it's expecting and timing out. That's a difference between devices you might not notice with Putty. Add: Dump_Log => 'cisco.log' to your new() parameters and see what is going over the network.

Replies are listed 'Best First'.
Re^2: Net::Telnet::Cisco - command timed-out error
by ArifS (Beadle) on Oct 21, 2014 at 14:40 UTC
    I have modified the code as following-
    use Net::Telnet::Cisco; my $cs = Net::Telnet::Cisco->new( Host => '10.10.1.1', Port => '7012', Prompt => '/(?m:^\W?[\w\/\d.:-]+[>#])/', Dump_Log => 'cisco.log', ); $username = "user"; $password = "pass"; $cs->waitfor_pause(1); $cs->print($username); print "user logged\n"; $cs->waitfor_pause(1); $cs->print($password); print "went thru\n"; # Execute a command my @cmd_output = $cs->cmd( 'show ver | inc Configuration' ); print @cmd_output; $cs->close;
    Getting error:-
    user logged went thru command timed-out at c:\temp\dirA9AB.tmp\telnet-2-port-test.pl line 23 Press any key to continue . . .
    line 23: my @cmd_output = $cs->cmd( 'show ver | inc Configuration' );
    Please let me know.
      print "user logged\n";
      actually, that is a lie, that should read
      print "username sent without checking if the Cisco wanted it at all";
      and likewise for
      print "went thru\n";

      You did set dump_log, so Net::Telnet::Cisco should have logged what the remote device sent. What does cisco.log contain?

      Update/explanation: despite its name, waitfor_pause does not wait for anything, just sets a time for ->waitfor()

        Thank you for your reply. I think I can see the problem. When I try with working devices, it prompts for "Username: " and the script works. But the device that having the issue, require
        1) an Enter 1st and then
        2) prompt for "login: ".

        That's where the device is timing out.
        Any suggestion? Please let me know.