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


  • 1
    Yes, that's exactly what happens.
    – larsks
    Commented Apr 27, 2016 at 12:25

1 Answer 1


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .