Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^5: Changing a script from Net::Telnet to Net::SSH2

by dasgar (Priest)
on Mar 03, 2016 at 23:31 UTC ( [id://1156782]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Changing a script from Net::Telnet to Net::SSH2
in thread Changing a script from Net::Telnet to Net::SSH2

The basic idea of an SSH tunnel is that the SSH client connects to an SSH server and it will map a local port to a remote port. That means that anything that connects to the local port will get forwarded to a remote system and port. For example, you have an SSH server at 192.168.1.1 and a telnet server at 192.168.2.1. You can use an SSH client to connect to the SSH server and configure a tunnel that will map local port 23 (i.e. 127.0.0.1:23) to port 23 on the telnet server (i.e. 192.168.2.1:23). Then you can use a telnet client and tell it to connect to local port 23 (127.0.0.1:23) and the SSH client will route that to 192.168.2.1:23 via the SSH server.

You can go to this Wikipedia page (click here) to get some more information. Unfortunately, the example near the end of the page is not the type of port that you would need to setup. Click here for an example of how to do this from a Linux environment. From a Windows system, you can use putty as an SSH client. See here for instructions on how to setup a tunnel using the GUI interface for putty or you can look here for information on how to setup a tunnel via command line parameters.

In your case, you can manually use an SSH client to establish a connection to your SSH server and to create the needed tunnel. Going that route means that you probably don't need to change your code - if I understand your situation correctly. Alternatively, you can use Net::SSH2 (or other appropriate SSH related modules) to connect to the SSH server and create the tunnel within your code.

  • Comment on Re^5: Changing a script from Net::Telnet to Net::SSH2

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-24 16:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found