I wonder, whether the whole traffic is redirected through port 22, if I create a SSH tunnel?
For example if I create a tunnel to a remote pc joes-pc, will it be enough to open port 22 on joes-pc?
ssh -R 5900:localhost:5900 guest@joes-pc
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityI wonder, whether the whole traffic is redirected through port 22, if I create a SSH tunnel?
For example if I create a tunnel to a remote pc joes-pc, will it be enough to open port 22 on joes-pc?
ssh -R 5900:localhost:5900 guest@joes-pc
In summary, yes, ssh tunnels send all data across the port ssh is using (which is usually port 22).
However, it only sends traffic specifically sent over the port you specify (5900 in your example above).
The classic example of this is tunnelling web traffic, so that a local web browser uses the tunnel to reach destination web sites. In this instance, the local machine will do DNS lookups which do not go over the tunnel, before sending web traffic over the tunnel.
In your example, yes, only port 22 is required, but just keep in mind that it relies on the application only using the specific port (5900) for all traffic, and if it does other stuff (like DNS lookups) they may go out from the localhost network, not the tunnel.