Consider these 2 scenarios.

(1) Let's say I login into an SSH server named A normally using

ssh [username] @ [IP address of A].

And now I connected to another server named B which is accepting telnet connections using

telnet [IP address of B]

from that SSH session.

(2) And I set up a tunnel using SSH from my machine to B using ssh -L 9000:[IP address of B]:23 [username]@[IP address of A].

And I opened another terminal and executed telnet localhost 9000.

Is there any difference between these two? In particular, can someone explain what happens under the hood in these 2 scenarios? (I mean how the packets travel from source to destination and whether they are encrypted or not)

1 Answer 1


From a security perspective (and only this is relevant here):

  • In both cases the connection between the local client and A is encrypted (via SSH).
  • In both cases the connection between A and B is not encrypted (plain telnet).
  • Additionally the second case opens a listener on port 9000 on localhost which allows every local user on this machine to connect to B (via the SSH tunnel to A) without further authentication at A.
  • Can we say that both scenarios are using tunneling? If they use tunneling, the message will be like [IP header destined to SSH server] [IP header destined to telnet server] [IP data]. Is this what happens in both cases or something other than this? Apr 18, 2019 at 9:11
  • @abhijithpogiri: SSH does no IP tunneling so your message description does not fit. And while the second case does tunneling (SSH tunneling) the first one does not. All what you can say that in both cases the data are transferred encrypted between the local client and host A and not encrypted between A and B. How the messages are transferred exactly through SSH is different though. Apr 18, 2019 at 9:28

You must log in to answer this question.

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