Examples of Local Tunneling
When ssh2
is used to create secure tunnels using local port
forwarding, the TCP applications to be tunneled are configured to
connect to a localhost port instead of the application server port.
Example 1:
Example application, clientapp1
, by default connects to a Unix
server unix.example.com
using TCP port 2345.
> clientapp1 --username user1 --server unix.example.com --port 2345
For securing this TCP application using Secure Shell, use the following
commands:
> ssh2 -L 2345:localhost:2345 user1@unix.example.com -S -fo &
> clientapp1 --username user1 --server localhost --port 2345
The above ssh2
command connects to remote Secure Shell server
unix.example.com
, creates a local listener on port 2345,
instructs the remote Secure Shell server to forward the incoming traffic
to localhost:2345
, and goes to background in single-shot-mode.
A similar command can also be run from JCL:
BPXBATCH PGM /usr/lpp/ssh2/bin/ssh2 -S -fo +
-L 2345:localhost:2345 +
user1@unix.example.com
|