Troubleshooting Frozen (Disconnected) Remote Desktop (RDP) Sessions in Windows
In Windows 10/11 and Windows Server versions 2022, 2019, and 2016, a Remote Desktop Services (RDS) connection utilizes both the UDP port 3389 alongside the standard RDP port TCP/3389. Upon establishing a connection to the server via an RDP client, various sessions come into play. The TCP (HTTP) session primarily handles the transmission of keyboard and mouse inputs, while multiple UDP sessions are dedicated to transferring the visuals of the Remote Desktop.
Check your MSTSC client is using UDP transport mode by clicking the Connection Info icon in the top RDP connection bar. The UDP protocol is used in our case.
The quality of the connection to the remote computer is excellent 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.
Remote Desktop (RDP) Session Hangs During UDP Protocol Use
In certain scenarios, employing UDP protocol for RDP connections might lead to several issues: occasional freezing of the screen, unexpected terminations of an RDP session, or users encountering a black screen instead of their intended Remote Desktop view, among others. Re-establishing the RDP connection often serves as a temporary fix. Such disruptions can occur with enough frequency to significantly impede the user’s regular activities.
These issues with RDP session interruptions are observed in the following situations:
When RDP sessions are conducted over VPN tunnels, a situation frequently seen with OpenVPN Servers. The underlying issue here involves the fragmentation of UDP packets, which occurs due to differing MTU settings as the packets navigate through the VPN tunnel;
Following an upgrade to the 22H2/22H2 build in Windows 11/10;
During the utilization of a Remote Desktop Gateway on Windows Server 2022, especially when port 3391 is designated for UDP traffic.
How to Disable the UDP Protocol over RDP
To address the freezing of RDP sessions associated with VPN tunnel usage, consider turning off the UDP transport protocol for RDP.
Here’s how you can disable UDP for RDP through Group Policy:
- Launch the Group Policy Editor by typing
gpedit.msc
into the run dialog (Windows Key + R). - Navigate through the tree: Computer Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Session Host -> Connections.
- Find and enable the policy named “Select RDP transport protocols.” Then, within this policy, set the “Select Transport Type” to “Use only TCP.”
- Restart the RDS/RDP server for the settings to take effect;
- Reconnect to the RDP server and click the Connection Information icon. The following message should appear here
The quality of the connection to the remote computer is good.
By implementing this adjustment, the RDP connection will exclusively utilize the TCP protocol.
This technique facilitates the deactivation of the UDP transport protocol on the server side of RDP/RDS. If your objective is to disable UDP for Remote Desktop on the client side, you should activate the “Turn off UDP on Client” setting. This is located within the Group Policy Editor at 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 "HKLM\software\policies\microsoft\windows nt\Terminal Services\Client" /v fClientDisableUDP /d 1 /t REG_DWORD