RustDesk is an open-source remote desktop software that can be used as an alternative to TeamViewer or AnyDesk. This article covers the differences between using the official servers and self-hosting your own server on a VPS.
Using Only the Official Servers
RustDesk provides free relay servers that you can use right away. The main advantage is that no configuration is required - just install and start using it.
However, official servers are located overseas (mainly in Germany and the US), so if you’re connecting from another country, you’ll inevitably experience latency. In practice, you might see delays of 100-200ms, which can be frustrating for tasks that require responsive remote desktop operations.
Additionally, since the official servers are shared among many users, bandwidth may be limited during peak hours. Evening and weekend usage can feel noticeably slower.
When using the official servers, no client configuration is needed. It works immediately after installation.
Self-Hosting on a VPS
Setting up RustDesk servers (hbbs/hbbr) on a VPS offers several benefits.
- Using a VPS in your region shortens the communication path between clients, significantly reducing latency. Domestic connections can drop to 10-30ms
- You have a dedicated server, so you’re not affected by other users
- Communication doesn’t pass through third-party servers, providing better security
- For corporate or organizational use, you can limit connections to your own server
Choosing a VPS
Regional VPS providers typically offer plans starting at a few dollars per month.
- DigitalOcean - Starting at $5/month. Easy to use interface
- Linode - Reliable with good performance. $5/month for basic plans
- Vultr - $5/month with datacenters in many locations
- Oracle Cloud Free Tier - Free Arm instances available. Sufficient for RustDesk server
RustDesk servers run fine with 512MB-1GB of memory. The cheapest plan is sufficient for personal use.
Docker Setup
Setting up with docker-compose is straightforward.
version: '3'
services:
hbbs:
image: rustdesk/rustdesk-server:latest
command: hbbs
ports:
- 21115:21115
- 21116:21116
- 21116:21116/udp
- 21118:21118
volumes:
- ./data:/root
hbbr:
image: rustdesk/rustdesk-server:latest
command: hbbr
ports:
- 21117:21117
- 21119:21119
volumes:
- ./data:/root
Run docker-compose up -d to start. On first launch, a public key is generated in the data folder, which needs to be configured on the client side.
On the client, enter the VPS IP address in “ID Server” and the public key content in “Key”.
Firewall Configuration
The following ports need to be opened on the VPS.
- 21115 TCP - NAT type test
- 21116 TCP/UDP - ID registration and heartbeat
- 21117 TCP - Relay
- 21118/21119 TCP - WebSocket (if needed)
If using ufw, open ports with these commands.
sudo ufw allow 21115:21119/tcp
sudo ufw allow 21116/udp
Where Speed and Latency Change
RustDesk communication is basically P2P, but when NAT traversal fails, it goes through the relay server.
For P2P connection to succeed, either side needs a global IP, or UDP hole punching must work. If both sides are behind CGNAT or strict firewalls, P2P connection is difficult and relay is used.
When relaying, the physical location of the relay server greatly affects connection speed. When users in the same region connect through an overseas relay server, round-trip distance increases and latency goes up. Setting up a local VPS server solves this problem.
You can check if a connection is P2P or relay in RustDesk’s connection info screen. “Direct” means P2P, “Relay” means going through the relay server.
When Do You Need a VPS
Self-hosting on a VPS is worth considering in these cases.
- Frequent remote connections within your region
- Business use requiring minimal latency
- Security policies prohibiting external server routing
- Managing multiple PCs and wanting unified connection settings
Conversely, if you only occasionally connect from overseas or don’t mind latency, the official servers are sufficient.
Summary
RustDesk works with just the official servers, but for comfortable regional use, self-hosting on a VPS is worth considering. Especially for business use or frequent remote connections, the benefits outweigh the VPS cost.
Self-hosting setup is easy with Docker, so if you’re familiar with VPS, you can build it in about 30 minutes. If a few dollars per month makes your remote desktop experience better, it’s worth trying.