52

Wile doing research I noticed that SSH both uses TCP and UDP. I completely understand the use of TCP, but UDP seems a bit strange. Why would I use an "unreliable" transport protocol with minimal handshaking for secure shell access?

The only use I can think of is for SCP, so (big) file transmission. But again, wouldn't TCP be more useful because of the handshaking stuff?

In fact, I am considering only opening TCP for SSH, but not knowing the implications of that would be quite detrimental.


EDIT

Turns out that there's not only a thesis about ssh over UDP, but also a fully fledged ssh-implementation, called mosh. However, the classic ssh still only uses TCP, as specified in its RFCs.

5
  • 2
    Why do you think SSH uses UDP? I tried it with several SSH connections from Windows to Unix and Unix to Unix and I don't get a single UDP packet on port 22. Also the server only listens on TCP.
    – mtak
    Apr 16, 2014 at 8:54
  • 1
    Well, Wikipedia tells as much en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers Also, users on the web seem to tunnel some things through a ssh-udp combo, but it just wasn't clear why they'd use UDP and not TCP. Hence my question.
    – alex
    Apr 16, 2014 at 8:57
  • 1
    In this thesis they tried to implement UDP for SSH transport, but they also mention that the default only uses TCP: ". OpenSSH is using TCP consistently for all its network connections and thus for its VPN feature.". The Wikipedia page might say it's UDP because the SSH developers made an initial request for UDP & TCP assignments, but the related RFC makes no mention of it. But I have to agree, an interesting question.
    – mtak
    Apr 16, 2014 at 9:10
  • Huh. Didn't expect that. Well, write that up as an answer, you deserve some points.
    – alex
    Apr 16, 2014 at 9:34
  • SSH works over TCP only if I forward only TCP ports. Is there any benefit of opening the UDP ports as well? May 5, 2020 at 17:21

2 Answers 2

50

I tried it with several SSH connections from Windows to Unix and Unix to Unix and I don't get a single UDP packet on port 22. Also the server only listens on TCP.

In this thesis they tried to implement UDP for SSH transport, but they also mention that the default only uses TCP: ". OpenSSH is using TCP consistently for all its network connections and thus for its VPN feature.". The Wikipedia page might say it's UDP because the SSH developers made an initial request for UDP & TCP assignments, but the related RFC makes no mention of it.

5

... The SSH protocol uses or has used 22/UDP for tunneling control through TCP. If decoded properly via Wireshark and you are tunneling a connection through via either ssh-agent or tunneling remotely or locally you would notice that UDP is encapsulated within the TCP segments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.