Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

How do I telnet into a machine and then to a third one?

by smoss (Acolyte)
on May 16, 2002 at 13:07 UTC ( [id://166997]=perlquestion: print w/replies, xml ) Need Help??

smoss has asked for the wisdom of the Perl Monks concerning the following question:

I need to run a script using Net::Telnet which logs into one machine and then into a third machine (because of a firewall) and pull info of the third server. My script always fails after the login to the second machine.

How should I initiate the telnet session on the second machine correctly?

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: How do I telnet into a machine and then to a third one?
by loosifer (Novice) on May 21, 2002 at 02:07 UTC
    Use Expect.pm or expect (the separate binary). Either should work for your purposes. Expect (the binary) is a strange language to use, so you might as well use Expect.pm if it will do everything you want.

    As I recall, it works fine for telnet, but it can have problems with SSH. I have used it for doing nested telnets, and once you get past the initial barrier of how it works, it's pretty easy to use.

Re: How do I telnet into a machine and then to a third one?
by Marza (Vicar) on May 16, 2002 at 21:25 UTC

    I don't think this is possible. You are expecting the second telnet session to be handled by Net::Telnet. It won't.

    The reason is that you are running telnet as a command line tool over Net::Telnet's telnet session. Net::Telnet doesn't know that the second telnet session exists. All it knows is that you sent some keystrokes to the remote server. The remote server is the one initiating and managing the telnet session.

Re: How do I telnet into a machine and then to a third one?
by skno010 (Initiate) on Dec 17, 2010 at 05:48 UTC
    The firewall could not close?

    Originally posted as a Categorized Answer.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://166997]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-28 20:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found