What does SSH use UDP for?

42

13

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.

alex

Posted 2014-04-16T08:09:12.497

Reputation: 649

2Why 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 – 2014-04-16T08:54:19.673

1

Well, Wikipedia tells as much https://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 – 2014-04-16T08:57:42.270

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 – 2014-04-16T09:10:45.090

Huh. Didn't expect that. Well, write that up as an answer, you deserve some points. – alex – 2014-04-16T09:34:31.530

Answers

45

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.

mtak

Posted 2014-04-16T08:09:12.497

Reputation: 11 805

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.

The Root User

Posted 2014-04-16T08:09:12.497

Reputation: 61