Solving the Problem: Remote Desktop Session Freezes and Disconnects on Windows

In Windows 10/11 and Windows Server 2022/2019/2016, when connecting to a Remote Desktop (RDS) server, UDP port 3389 is used along with the default RDP port TCP/3389. Your RDP client, when connecting to the server, initiates multiple sessions. The keyboard and mouse commands are transmitted using the TCP (HTTP) control session, whereas the Remote Desktop images are sent through various UDP sessions.

Ensure your MSTSC client uses the UDP transport mode by clicking the Connection Info icon located in the top RDP connection bar. In our situation, the UDP protocol is deployed.

The connection quality to the remote computer is outstanding, and UDP is enabled.

According to Microsoft, the use of the UDP protocol can significantly improve the responsiveness of the Remote Desktop session by reducing the number of retransmissions and the ability to work over unstable, high-latency connections.

RDP Connection Freezes When Using UDP Protocol

In some cases, using the UDP protocol for an RDP connection can cause problems: periodic image freezing, random disconnection of an RDP session, users seeing a black screen instead of the Remote Desktop, etc. Reconnecting to the RDP session usually helps in these cases. Sometimes this problem occurs frequently and affects the user’s normal functioning.

The problem with RDP sessions freezing occurs:

  • If you are using RDP sessions within VPN tunnels (commonly encountered when using an OpenVPN Server). The cause of this is a fragmentation of UDP packets. This is caused by fragmentation of UDP packets as they are sent through the VPN tunnel (caused by different MTU settings);
  • After updating Windows 11/10 to 22H2/22H2 build;
  • When using the Remote Desktop Gateway on Windows Server 2022 and port 3391 for UDP traffic.

Furthermore, the problem is not related to poor performance of the RDS host. This can be seen from the fact that the server has enough free resources, memory, and CPU are not being used at a high rate.

How to Disable the UDP Protocol over RDP

To address the issue of frozen RDP sessions while using VPN tunnels, a possible remedy could be to turn off the UDP transport protocol.

You can turn off UDP over RDP via Group Policy.

  1. Access the local GPO editor console (gpedit.msc);
  2. Navigate to Computer Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Session Host -> Connections;
  3. Activate the policy Select RDP transport protocols and assign Select Transport Type = Use only TCP;
  4. Restart your RDS/RDP server for the changes to take effect;
  5. Establish a new connection with your RDP server and select the Connection Information symbol. The following statement should be displayed:
The quality of the connection to the remote PC is good.

This means that only TCP is used for the RDP connection.

This method allows you to disable the use of the UDP transport protocol on the RDP/RDS server side. Suppose you want to disable UDP for Remote Desktop on the client side. In that case, you need to enable the Turn off UDP on Client option under Computer Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Connection Client.

After making changes, update the local policy settings using the gpupdate /force command and restart the mstsc.exe client.

You can also enable this option in the registry (the GPO policy mentioned above corresponds to the fClientDisableUDP registry parameter):

reg add "HKLMsoftwarepoliciesmicrosoftwindows ntTerminal ServicesClient" /v fClientDisableUDP /d 1 /t REG_DWORD

To disable UDP over RDP on computers joined to an Active Directory domain, you must configure a GPO using the domain Group Policy Management console (gpmc.msc).


Tags: