ssh -D some-port-number remote-server-url
.socks5://localhost:that-port-number-metioned-above
).So how are these concepts -- SOCKS5 proxying
, ssh tunneling
, reverse ssh tunneling
related with each other?
Transporting arbitrary data streams over SSH sessions is also known as SSH tunneling. OpenSSH, a popular open-source SSH server, supports three types of tunneling features- local port forwarding, remote port forwarding, and dynamic port forwarding.
The ssh command provides the -D option in order to create a proxy. The default proxy type is Sock5. Socks5 is a type of HTTP proxy. Also, the local port number should be specified which is listened to on the client system.
SSH tunneling, or SSH port forwarding, is a method of transporting arbitrary data over an encrypted SSH connection. SSH tunnels allow connections made to a local port (that is, to a port on your own desktop) to be forwarded to a remote machine via a secure channel.
A special case of the forward TCP tunnels is the Socks proxy capability. Using these options, the SSH client listens on a specified binding port and acts as a SOCKS 4 or 5 proxy server. Note that we don't even need to specify the destination host and port for the forwarding in this case.
What you describe is a SOCKS proxy. It is standalone protocol used by various tools. What openssh
does it to tunnel this protocol encrypted from one point to the other. But more precisely, it is called TCP port forwarding (it forwards one port from client through the secure tunnel to the server).
There are other possibilities to use TCP port forwarding in openssh
using -L
and -R
switches that are correctly named Local ("brings" remote service to local host) and Remote (makes local service accessible from remote host).
As you can see, there are similarities, but they are implemented in different way. All of them are TCP port forwarding (through secure tunnel). The Dynamic (-D
) special, because the server have to understand the SOCKS protocol.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With