skip to content

Which transports can RD Gateway use to carry RDP, and what do TCP 443, UDP 3391 and port 3388 each do?

level: middleimportance: should knowfreq 12%

answer

  1. three ways to carry RDP
  2. HTTPS tunnel on one port
  3. UDP side channel with DTLS
  4. one port is the server's RPC listener

basics

~20 s

RD Gateway carries RDP over RPC over HTTP, over an HTTPS tunnel (443 by default), or over a DTLS-secured UDP channel on 3391. The RPC transport's specification also lists 80 and 3388, the gateway's own RPC listener.

solid answer

~50 s

MS-TSGU defines three transports. RPC over HTTP uses ports 80 and 443 as the HTTP and HTTPS carriers, and 3388 is where the gateway server itself listens for RPC method calls; 3388 and at least one of 80 and 443 must be supported. The HTTP transport is a plain HTTPS connection, listening on 443 by default but configurable. The UDP transport listens on 3391 and uses DTLS; it works only beside a main channel already built over the HTTP transport. For a perimeter firewall, Microsoft's role guidance names inbound TCP 443 and inbound UDP 3391. The target host's 3389 is never a gateway listener: the gateway connects to it from inside. A keep-alive packet, 15 minutes by default on the HTTP transport, stops quiet sessions from dropping, but a middlebox with a shorter idle timeout can still cut them.

go deeper

for a junior

Remember 443 for HTTPS and 3391 for the gateway's UDP, and that 3389 stays the host's internal listener.

for a middle

Name the three transports and the roles of 80, 443, 3388 and 3391, and explain that UDP is a side channel to an existing HTTP main channel.

for a senior

Turn it into a firewall review: which ports to allow, which to refuse, the reverse-proxy HTTP leg, and what a blocked 3391 costs.

for a principal

Decide whether the UDP channel and any plain-HTTP proxy leg are worth their added surface for your users' networks.

## Three transports, one gateway The Terminal Services Gateway Server Protocol, **MS-TSGU** (pinned here at v20240423), is the specification behind RD Gateway. It describes the RDP client reaching the gateway (the RDG client reaching the RDG server) over three transports, each with its own protocol name. | Transport | Specification name | Ports | Notes | |---|---|---|---| | RPC over HTTP | RDGSP | 80, 443, 3388 | 3388 plus at least one of 80 and 443 must be supported | | HTTP | RDGHTTP | 443 by default | a plain HTTPS connection; the port can be configured | | UDP | RDGUDP | 3391 | DTLS; added beside an existing main channel | ## Reading the ports correctly - **Port 80 and port 443** are the endpoints the RPC-over-HTTP protocol uses as its underlying transport, on plain HTTP and on HTTPS respectively. - **Port 3388** is the endpoint on which the gateway server itself listens for incoming RPC method calls. It is the gateway's RPC call listener, not a desktop port. - **Port 3391** is where the gateway listens for incoming UDP packets. - **Port 3389** does not appear as a gateway endpoint at all. It is the target server's RDP listener, reached by the gateway on the client's behalf. The HTTP transport can also run behind a reverse proxy. The proxy terminates the client's connection and opens another to the gateway, and the leg between them may be plain HTTP without SSL. That choice trades the proxy's inspection for an unencrypted internal segment, so it is a design decision, not a default. ## How the HTTP transport behaves The client opens an HTTP 1.1 connection for outbound data from the gateway. When both sides support WebSocket, that one connection carries both directions; otherwise a second connection is opened for inbound data. After the user is authenticated the client creates a tunnel, which is where the connection authorization check is passed, and then a channel to the target server, which is where the resource authorization check is passed. ## The UDP channel is a side channel The UDP transport is described as designed for tunneling graphics, audio and video data for clients coming from the internet to servers behind a firewall. Three conditions shape how you operate it: 1. The client first establishes a **main channel** to the target through the gateway over the HTTP transport; the UDP channel is created afterwards as a side channel. 2. The client obtains a UDP authentication cookie on the main channel. The gateway verifies its signature and compares its expiry time with the current time before accepting UDP traffic. 3. The DTLS handshake secures the UDP leg, as TLS secures the HTTP leg. By construction, a firewall that passes only TCP 443 still lets the main channel exist; what is lost is the optional UDP side channel. How the protocol's own UDP transport behaves between a client and a host is a separate subject, covered with graphics and compression. ## Keep-alives, capacity and quiet sessions The HTTP transport sends a keep-alive packet from both ends so that the HTTP connection is not lost when no RDP data is flowing. The specification gives 15 minutes as the default period and says it can be set independently on the client and on the gateway. Any device between users and the gateway with a shorter idle timeout can still cut a session that is merely quiet, and the symptom looks like a gateway fault. The gateway can also cap how many connections it serves. Past the configured maximum it returns the code `E_PROXY_MAXCONNECTIONSREACHED` (0x000059E6), which is the thing to look for when only the busiest hour fails. ## What to put in a firewall review - Inbound TCP 443 to the gateway, and inbound UDP 3391 if the UDP channel is wanted, as the role guidance states. - No inbound 3389 to the session hosts. - A certificate on the gateway that the client trusts, because both HTTPS and DTLS depend on it. - A written reason for any use of port 80 or of a reverse proxy that carries plain HTTP. Report these as each source states them: the role page gives the perimeter requirement and the specification gives the endpoint roles, so do not infer from the specification that 3388 must be reachable from the internet.

  • Why can a firewall that blocks UDP 3391 still allow remote desktops through the gateway?
    The UDP channel is a side channel created only after the main channel to the target exists over the HTTP transport. Blocking 3391 removes the optional UDP path for graphics and audio, not the session, because the HTTPS main channel on 443 is already carrying it.
  • What can you say about what 3388 means when a vendor questionnaire asks whether it is exposed?
    MS-TSGU defines it as the port where the gateway server listens for RPC calls under the RPC transport, and requires it with 80 or 443. The role guidance lists only TCP 443 and UDP 3391 as inbound requirements, so answer from the guidance and confirm your own deployment's listeners.

  • Says the gateway tunnels RDP over TCP 3389 from the internet.
  • Thinks UDP 3391 is the gateway's primary tunnel and HTTPS is the fallback.
  • Claims 3388 is the port clients connect to for desktops.
  • Believes HTTPS 443 is fixed and cannot be configured on the HTTP transport.
  • Treats the gateway's UDP listener as the same thing as the protocol's own UDP transport.