Self-hosting
RustDesk Server Ports and Network Requirements
RustDesk default ports for a native client are TCP 21115, TCP 21116, UDP 21116, and TCP 21117. TCP 21114 is the Server Pro web console and HTTP API, and it is not required for the open-source server. TCP 21118 and TCP 21119 serve the web client over WebSocket. Port forwarding is the firewall and NAT work that makes the ports you actually use reachable, and it is also the work that should leave the rest closed.
Port numbers on this page match the OSS and Pro documentation reviewed on November 30, 2026. rasdesc.com does not operate a relay and cannot see your firewall.
The minimum set, then the optional set
Most “which RustDesk ports” questions come from a router page with a handful of empty forwarding rows. Fill the minimum for the clients you really have. Native clients, meaning the Windows, macOS, Linux, Android, and iOS apps, need the ID service and the relay. They do not need the web console, and they do not need the web client sockets.
| Port | Transport | Process | Role | Expose? |
|---|---|---|---|---|
| 21114 | TCP | Pro API and web console | Admin site and Pro client API. Not used by OSS. | Only for operators, or not at all if HTTPS 443 already fronts the console. |
| 21115 | TCP | hbbs | NAT type test. | Yes for native clients. |
| 21116 | TCP and UDP | hbbs | Registration and heartbeat on UDP. TCP hole punching and the connection service on TCP. | Yes, both protocols. UDP alone or TCP alone is incomplete. |
| 21117 | TCP | hbbr | Relay when a direct path fails. | Yes for native clients, unless you have deliberately removed relay. |
| 21118 | TCP | hbbs | WebSocket for the web client. | No direct public exposure. Reverse proxy only, or closed. |
| 21119 | TCP | hbbr | WebSocket for the web client. | No direct public exposure. Reverse proxy only, or closed. |
If you do not use the web client, disable 21118 and 21119. That sentence is in the Docker documentation, and it is the right default. A mode also exists in which the only public TCP port is 443 and sessions are forced through a WebSocket relay, with no direct peer-to-peer path. That mode is a designed narrowing. It is not a reason to forward every port in the table “temporarily.”
What each port is doing during a session
A client starts by finding hbbs. UDP 21116 carries registration and heartbeat, so the server knows the client is online and where NAT thinks it lives. TCP 21116 carries TCP hole punching and the connection service. TCP 21115 is the NAT type test that helps the two sides decide whether a direct attempt is realistic. Documentation says hole punching works in the majority of cases. When it does, media for that session goes between the endpoints and does not stay on your relay. When it does not, TCP 21117 on hbbr carries the session.
That split is why a firewall that forwards only TCP 21116 looks half-working. Clients may flap, fail the NAT test, or never complete a hole punch, while a TCP-only check from a laptop still “connects.” Forward UDP 21116 to the same host. Then forward TCP 21117 to hbbr, which on a normal single-host install is the same machine. The architecture page follows the packet through rendezvous, punch, and relay. This page stops at the sockets.
TCP 21114 does not carry the remote desktop. It carries the Pro HTTP API and the web console. Pointing a browser at 21117 will not load a dashboard. Pointing a client’s API server field at 21116 will not log anyone into Pro. The API server value is the console address, 21114 or an HTTPS URL, and it is separate from both the license key and the key in id_ed25519.pub.
Prerequisites
You need administrative access to the host firewall and, if the host sits behind a router, to that router’s forwarding rules. You need hbbs and hbbr already bound on the host. Host networking in Docker on Linux makes the processes listen on the host’s own addresses, so the firewall rules point at the host, not at a container IP. You need a DNS name if clients will not memorize an address. You need to know whether you are running OSS or Pro, because 21114 is a Pro port. You need to know whether anyone will use the web client, because that is the only reason 21118 and 21119 exist.
Pro needs outbound HTTPS for its license check even when you publish nothing inbound except the session ports. OSS has no license check and needs no outbound license call. Neither fact changes the inbound minimum.
Supported environment
The port list is the same whether you start the processes with the official docker run lines or with Compose. On Linux, the documented network mode is host networking, so you do not also publish ports with Docker -p flags. The official page says that when --net=host works, the -p options are not used. Docker Desktop on Windows and macOS does not implement that Linux behavior. The official Docker page says to remove --net=host when it causes trouble, and it tells Windows users to leave out sudo and --net=host. If you remove host networking, Docker’s own port publications have to match the table above, and you should take that publication list from the current official page rather than from a guess. The container recipe itself is on the Docker page.
Clients behind carrier-grade NAT, symmetric NAT, or a strict corporate firewall are why 21117 exists. The server cannot fix a client network that blocks all outbound UDP. It can only offer the relay when the punch fails. A Tailscale-only deployment, described on the Tailscale page, can keep this entire inbound list off the public router, because clients reach hbbs and hbbr over the tailnet. The port numbers do not change. The place they must be reachable changes.
Steps to publish the right listeners
- Install the server with the setup steps. Confirm both processes stay up.
docker logs hbbsis the documented log command after a detached container start. - On the host firewall, allow TCP 21115, TCP 21116, UDP 21116, and TCP 21117 from the client networks that should connect. On a home router, forward those same sockets to the host.
- If this is Pro and operators need the console from those networks, allow TCP 21114, or publish the console only through HTTPS on 443 and leave 21114 private.
- Leave TCP 21118 and TCP 21119 closed. Open them only on an interface a reverse proxy can reach, and only if you run the web client.
- Restart nothing unless a process failed. Recheck from a client that is not on the same LAN as the server, so you are not fooled by a local allow rule.
- Enter the ID server and the public key on that client. Add the relay only if it is not the same host. Add the API server only for Pro.
The Linux container start that binds through host networking, from the official Docker page, is:
sudo docker image pull rustdesk/rustdesk-server
sudo docker run --name hbbs -v ./data:/root -td --net=host --restart unless-stopped rustdesk/rustdesk-server hbbs
sudo docker run --name hbbr -v ./data:/root -td --net=host --restart unless-stopped rustdesk/rustdesk-server hbbr
Compose users start the official file, which sets network_mode: "host", the volume ./data:/root, and the commands hbbs and hbbr, with:
docker compose up -d
The homepage quick start fetches that style of file first. Use wget rustdesk.com/oss.yml -O compose.yml for the open-source stack or wget rustdesk.com/pro.yml -O compose.yml for Pro, then read the file and run docker compose up -d. The publisher also offers a quick start that pipes a remote shell script into a shell. Read the script before you run it. This page does not add firewall command lines, because the correct tool is whichever one your distribution actually uses, and inventing one would be worse than pointing at the port table.
If policy says every session must relay, the Docker documentation’s optional environment example is ALWAYS_USE_RELAY=Y on hbbs. You would still expose TCP 21117. You would not, merely by setting the variable, close 21116. Clients still have to register.
What you should see
From outside the host, TCP connections to 21115, 21116, and 21117 should reach the processes, and UDP 21116 should not be filtered. A client configured with the ID server and id_ed25519.pub should show Ready. Ready means registration worked, which exercises the ID path, especially UDP and TCP 21116. It is weaker evidence for 21117. Prove the relay by opening a session between two networks that cannot punch a direct hole, or by temporarily forcing relay with the environment variable above and confirming the session still comes up.
“Not ready, please check your connection” after a careful forward almost always means 21116 is still wrong: UDP missing, the forward pointed at a different machine, or the DNS name aimed at an old address. A wrong key and a stopped process look the same on the client. Read docker logs hbbs before you forward additional ports. The console, if you are on Pro and 21114 is open to you, should load in a browser. A connection to 21118 or 21119 is not a successful test. Those ports should not answer on the public address.
Troubleshooting forwarding
Symptom by symptom. Clients on the same LAN work, and clients on the internet stay Not ready: the process is fine and the forward or the public firewall is not. Forward both protocols on 21116, then 21115 and 21117. Clients register and the session hangs at connect: 21117 is the first suspect, then the NAT types of the two ends. The NAT traversal explanation covers why some pairs always relay. Pro console times out while sessions work: 21114 is closed or you are probing the wrong port. Web client fails while the native client works: 21118 and 21119 are closed, which is correct unless you have a reverse proxy in place, or the plan does not meet the web-client size rule.
Hairpin NAT makes a confusing special case. A client on the same LAN as the server, using the public DNS name, may fail even though an outside client works, because the router does not loop the connection back in. Test from a phone on cellular before you rewrite the firewall. Clock sync remains on the checklist. A host with a drifted clock can reject traffic that the firewall is passing correctly.
Docker Desktop adds its own failure. If network_mode: "host" was copied onto a Windows or Mac Docker Desktop host, the processes may not listen where the firewall expects. Remove host networking when the official page’s warning applies, and retest. Do not “fix” that by forwarding all six ports to be safe.
Security notes
Close 21118 and 21119 unless a reverse proxy is the only client of those ports. When WebSocket is enabled, hbbs and hbbr trust X-Real-IP and X-Forwarded-For to learn the client address behind a proxy. The headers are not validated. Anyone who can reach 21118 or 21119 directly can spoof an address, slip past IP rate limits and blocks, and plant false addresses in logs. The safe patterns are: web client off and both ports closed, or web client on and both ports reachable only from the proxy that sets the headers.
The minimum public set for native clients is TCP 21115–21117 and UDP 21116. Shrink it further only with a design you understand, such as a tailnet where nothing is public, or the documented 443-only WebSocket relay mode with no direct peer-to-peer path. Do not shrink it by closing UDP 21116 and hoping TCP will cover registration.
21114 is an admin surface. Leave it unpublished when an HTTPS reverse proxy on 443 is how operators reach the console. Pro still needs outbound HTTPS for the license check. That outbound call is not an excuse to open inbound 443 for everything else on the host. OSS does not make the call.
Port forwarding is not authorization. A reachable ID server will register a client that has the public key. The session still requires a password or an approval click on a computer you are allowed to administer. An ID whitelist is not authentication, because the connecting client reports the ID. Direct IP access, which can use port 21118 when direct-server is enabled, is optional, off by default, and documented with an unencrypted path. Leave it off while you are sorting the main forwards. The security guide states the encryption boundary in full: NaCl end-to-end encryption is the documented property of the normal ID-based connection model, not of every mode the client can turn on.
Frequently Asked Questions
Which RustDesk ports do I forward for the ordinary client?
TCP 21115, TCP 21116, UDP 21116, and TCP 21117. Add TCP 21114 only if operators reach the Pro console directly. Leave TCP 21118 and 21119 closed unless a reverse proxy is the only system that connects to them for the web client.
Do I forward both TCP and UDP on 21116?
Yes. UDP 21116 is registration and heartbeat. TCP 21116 is TCP hole punching and the connection service. Forwarding one protocol and not the other leaves clients unable to complete normal ID behavior.
Can I expose only port 443?
A documented mode does that: only TCP 443 is public, and sessions are forced through a WebSocket relay, with no direct peer-to-peer path. That is a specific deployment, not the default forward list. Setting ALWAYS_USE_RELAY=Y forces relay use and still expects the usual registration ports unless you have also built that 443 front.
Is 21114 required for RustDesk Server OSS?
No. TCP 21114 is the Pro HTTP API and web console. The open-source server does not use it and does not check a license. Native OSS clients need TCP 21115–21117 and UDP 21116.