I've seen telnet take a while to respond before login if there are no DNS 
resolvers programmed in the unit.

Just curious, but have you thought about using the API?

http://forum.mikrotik.com/viewtopic.php?f=9&t=22744

--
Blake Covarrubias

On Jun 30, 2010, at 11:16, "Justin Marshall" <just...@pdmnet.net> wrote:

> Hi,
> 
> I'm trying to write a simple perl script to automate things on our
> network.  I'm using Net::Telnet and (in this case) i would like it just
> to disable ports 2-5 & re-enable them.  The script does what i would
> like, but i could literally do it manually much quicker.  The other
> devices i've used Net::Telnet on in the past seem to have no issues,
> only on Mikrotik's.  From what i can tell it's taking almost 6-8 seconds
> to logon to each device ... It takes that long before i see it disable
> them...
> 
> #!/usr/bin/perl
> use Net::Telnet;
> @Hosts[0] = '10.10.10.2';
> @Hosts[1] = '10.10.10.3';
> @Hosts[2] = '10.10.10.4';
> my $mt = new Net::Telnet;
> my $prompt = "/.*> /";
> $username = "admin";
> $password = "";
> foreach $host(@Hosts) {
>   $mt->input_log("log.txt");
>   print "Opening Host".$host."\n";
>   $mt->open(Host=>$host);
>   $mt->login($username,$password);
>   $mt->cmd('/interface disable ether2');
>   $mt->cmd('/interface disable ether3');
>   $mt->cmd('/interface disable ether4');
>   $mt->cmd('/interface disable ether5');
>   sleep 1;
>   $mt->cmd('/interface enable ether2');
>   $mt->cmd('/interface enable ether3');
>   $mt->cmd('/interface enable ether4');
>   $mt->cmd('/interface enable ether5');
>   $mt->close;
>   }
> 
> I've tried changing out 'cmd' with 'print'.  Tried using 'waitfor',
> 'prompt' and even manually logging in with 'waitfor('/password:.*$/i')
> ..etc.  
> 
> Is there anything that I may do to speed this up, or am I just missing
> something?
> 
> Thanks,
> Justin
> just...@pdmnet.net 
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: 
> <http://www.butchevans.com/pipermail/mikrotik/attachments/20100630/a6a9b6ce/attachment.html>
> _______________________________________________
> Mikrotik mailing list
> Mikrotik@mail.butchevans.com
> http://www.butchevans.com/mailman/listinfo/mikrotik
> 
> Visit http://blog.butchevans.com/ for tutorials related to Mikrotik RouterOS

_______________________________________________
Mikrotik mailing list
Mikrotik@mail.butchevans.com
http://www.butchevans.com/mailman/listinfo/mikrotik

Visit http://blog.butchevans.com/ for tutorials related to Mikrotik RouterOS

Reply via email to