mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-02 01:17:52 +03:00
64 lines
2.0 KiB
Plaintext
64 lines
2.0 KiB
Plaintext
/**
|
|
@page forwarding Chapter 7: Forwarding connections
|
|
@section forwarding_connections Forwarding connections
|
|
|
|
Port forwarding comes in SSH protocol in two different flavours:
|
|
direct or reverse port forwarding. Direct port forwarding is also
|
|
named local port forwardind, and reverse port forwarding is also called
|
|
remote port forwarding.
|
|
|
|
|
|
|
|
@subsection forwarding_direct Direct port forwarding
|
|
|
|
Direct port forwarding is from client to server. The client opens a tunnel,
|
|
and forwards whatever data to the server. Then, the server connects to an
|
|
end point. The end point can reside on another machine or on the SSH
|
|
server itself.
|
|
|
|
Example of use of direct port forwarding:
|
|
@verbatim
|
|
Mail client application Google Mail
|
|
| ^
|
|
5555 (arbitrary) |
|
|
| 143 (IMAP2)
|
|
V |
|
|
SSH client =====> SSH server
|
|
|
|
Legend:
|
|
--P-->: port connexion through port P
|
|
=====>: SSH tunnel
|
|
@endverbatim
|
|
A mail client connects to port 5555 of a client. An encrypted tunnel is
|
|
established to the server. The server connects to port 143 of Google Mail (the
|
|
end point). Now the local mail client can retreive mail.
|
|
|
|
|
|
@subsection forwarding_reverse Reverse port forwarding
|
|
|
|
The reverse forwarding is slightly different. It goes from server to client,
|
|
even though the client has the initiative of establishing the tunnel.
|
|
Once the tunnel is established, the server will listen on a port. Whenever
|
|
a connection to this port is made, the server forwards the data to the client.
|
|
|
|
Example of use of reverse port forwarding:
|
|
@verbatim
|
|
Local mail server Mail client application
|
|
^ |
|
|
| 5555 (arbitrary)
|
|
143 (IMAP2) |
|
|
| V
|
|
SSH client <===== SSH server
|
|
|
|
Legend:
|
|
--P-->: port connexion through port P
|
|
=====>: SSH tunnel
|
|
@endverbatim
|
|
In this example, the SSH client establishes the tunnel,
|
|
but it is used to forward the connections established at
|
|
the server to the client.
|
|
|
|
*** To be written ***
|
|
|
|
*/
|