RustDesk Docs · Server OSS
RustDesk Server OSS Self-Hosting Guide
RustDesk Server OSS is the free, open-source backend for self-hosting RustDesk. Its two core services are hbbs, which handles device ID, rendezvous and signaling, and hbbr, which relays sessions when a direct connection cannot be established. This guide covers a basic Docker Compose deployment, required ports, the server public key, client configuration and connection testing.
How RustDesk Self-Hosting Works
hbbs and hbbr
A running RustDesk client registers its device ID and current network information with hbbs. When one device requests a connection to another, hbbs locates the remote endpoint and coordinates connection establishment.
- hbbs: the RustDesk ID, rendezvous and signaling server used for device registration, discovery, NAT testing and connection coordination.
- hbbr: the RustDesk Relay Server used when the two endpoints cannot establish a direct peer-to-peer connection.
- P2P: RustDesk first attempts NAT hole punching so the two devices can communicate directly.
- Relay fallback: if hole punching fails, communication can fall back to hbbr.
What this guide covers
By the end of this guide, you will have a basic RustDesk Server OSS environment and clients configured to use it.
- Prepare a server with Docker and Docker Compose.
- Run both hbbs and hbbr with persistent server data.
- Open the ports required for device registration, NAT traversal and relay traffic.
- Retrieve the public key generated by hbbs.
- Configure the RustDesk client with your ID Server and Key.
- Test device registration, direct connectivity and relay fallback.
Server OSS and Server Pro
This guide covers RustDesk Server OSS. Server OSS provides the core hbbs and hbbr services. Centralized features such as the Web Console, API, OIDC, LDAP, 2FA, device management and access control belong to RustDesk Server Pro and are not required for a basic OSS deployment.
Prepare the RustDesk Server
For most Linux deployments, Docker Compose with host networking is a straightforward way to run RustDesk Server OSS. The server must also be reachable by the RustDesk clients that will use it.
Check Docker and Docker Compose
Confirm that Docker and Docker Compose are installed before creating the RustDesk services.
docker --version docker compose version
Open the required ports
RustDesk uses several ports for device registration, NAT traversal, connection coordination and relay traffic.
21115/TCP— NAT type test.21116/TCP— TCP hole punching and connection service.21116/UDP— device ID registration and heartbeat.21117/TCP— hbbr relay service.
The broader RustDesk Server range is TCP 21114–21119 plus UDP 21116. TCP 21118 and 21119 are used for WebSocket connections when the Web Client is required, while 21114 is associated with Server Pro API / Web Console access.
Deploy hbbs and hbbr with Docker Compose
A basic RustDesk Server OSS deployment runs both services. hbbs provides ID, rendezvous and signaling, while hbbr provides relay traffic when direct connectivity is not possible.
Create compose.yml
The following Compose configuration follows the standard Linux host-networking setup. The shared ./data directory keeps the server data and generated keys persistent.
services:
hbbs:
container_name: hbbs
image: rustdesk/rustdesk-server:latest
command: hbbs
volumes:
- ./data:/root
network_mode: "host"
depends_on:
- hbbr
restart: unless-stopped
hbbr:
container_name: hbbr
image: rustdesk/rustdesk-server:latest
command: hbbr
volumes:
- ./data:/root
network_mode: "host"
restart: unless-stoppednetwork_mode: "host" is primarily intended for Linux. If host networking is unavailable or causes problems on your platform, remove it and expose the required RustDesk ports explicitly.
Start the services
Run Docker Compose in the directory containing compose.yml, then verify that both hbbs and hbbr are running.
docker compose up -d docker compose ps
Get the server public key
On its first run, hbbs generates the server key pair in the persistent data directory. RustDesk clients use the public key in id_ed25519.pub as the self-hosted server Key.
cat ./data/id_ed25519.pub
This public Key is used for encrypted connections to the self-hosted server. It is different from a RustDesk Server Pro license key.
Configure RustDesk Clients
Configure one client first
Install RustDesk from the Download page. In the RustDesk client, open the menu next to the device ID, go to Network, unlock the settings if required, and configure the self-hosted server.
- ID Server: required. Enter the hostname or IP address of the server running hbbs, for example
hbbs.example.comorhbbs.example.com:21116. - Key: required. Enter the contents of the server's
id_ed25519.pubpublic key. - Relay Server: often optional because RustDesk can infer it automatically. If you set it manually, it points to hbbr.
- API Server: used for Server Pro account login and Web Console features; it is not required for a basic Server OSS deployment.
Configure both endpoints
The controlling device and the remote device should be configured to use the same self-hosted RustDesk Server. Each device still receives its own RustDesk device ID; using the same server does not mean multiple devices share one ID.
Configuring more devices
For a small OSS deployment, manual configuration is usually enough. You can also export a working Server Config from one client and import it into another, or use deployment scripts and the --config command-line option for managed installations. RustDesk Server Pro additionally provides a Custom Client Generator for preconfigured and branded clients.
Test the Connection and Troubleshoot
Confirm client registration
Restart the RustDesk client after applying the server settings. If the client receives its device ID and the hbbs logs show registration activity, the client can reach your ID Server.
Test a remote session
Configure two RustDesk clients with the same self-hosted ID Server and Key. On one device, enter the RustDesk ID of the other device and start a connection. hbbs will coordinate the endpoints and first attempt a direct connection through NAT hole punching. If that fails, the session can be relayed through hbbr.
If the connection fails
- Confirm that both endpoints use the correct ID Server.
- Confirm that the configured Key matches
id_ed25519.pubfrom the server. - Check that TCP
21115, TCP/UDP21116and TCP21117are reachable. - Verify that both
hbbsandhbbrcontainers are running. - Check that the server hostname resolves to the expected public or private IP address.
- Check for firewall, double NAT or NAT loopback restrictions between clients and the server.
A successful self-hosted setup does not mean every session uses the relay
RustDesk normally prefers a direct P2P connection. When NAT traversal succeeds, the remote session does not pass through hbbr. The relay is used when the endpoints cannot connect directly. Self-hosting therefore means operating your own ID and relay infrastructure, not forcing every remote desktop session through your server.
For client packages, see Download RustDesk. For common connection, permission and deployment questions, see the RustDesk FAQ.
rustdesk