Rustdesk new installation and configuration

I’ll start by saying this isn’t necessarily a guide to follow, and you might find an error that caused my own problem. I’m documenting it here in case it helps anyone else deploy Rustdesk on their DietPi installation. I’ll break it into a few posts due to the length.
Step 1: Installation

The installation is straightforward, but I missed something. Follow the steps in the Rustdesk installation guide.

For me, it was a fresh install of DietPi behind a Unifi USG Pro 4. I didn’t install ufw and opened the required ports on the USG. Then, I ran:

chmod +x

It installed prerequisites, downloaded the hbbs and hbbr server files, and configured the system to start the services automatically.

Step 2: Client Configuration

At the end of Step 1, you’ll see the public key, also available in /opt/rustdesk/ Enter the ID server in the client, and paste the key into the “Key” field.

This is where things went wrong for me:

System Description:

  • Client 1: Win 11 desktop on LAN
  • Client 2: Win 11 laptop, on LAN at home, off LAN away
  • DDNS: (I’ll use here)

I entered the LAN IP for Client 1 and for Client 2 in the ID Server field.

At home, both clients connected flawlessly. However, Rustdesk bypasses the relay server for direct IP connections on the same LAN, meaning I didn’t actually test the relay server.

Outside the LAN, Client 2 showed Client 1 as green (indicating relay connection), but couldn’t connect. Here’s what happened:

  • Client 2 requests a connection from Client 1
  • Client 1 asks the signal server for a relay, and it replies to use
  • Client 2, outside the LAN, can’t reach this address.

How I Fixed It

Reading the on GitHub, I found options for defining the relay server. Running the script without arguments sets the server to ExecStart=/opt/rustdesk/hbbs -k _, not specifying a relay server. Even adding in the client, it still tries the LAN address.

Instead of re-running the script, I edited /etc/systemd/system/rustdesksignal.service to ExecStart=/opt/rustdesk/hbbs -r -k _. After sudo systemctl daemon-reload and sudo systemctl restart rustdesksignal.service, Client 2 connected successfully.

Final Discussion: NAT Loopback

Rustdesk suggests setting up NAT Loopback so Client 1 redirects to the LAN IP. This isn’t suitable for me due to multiple servers needing external access. Some servers, like Home Assistant, allow configuration with both LAN and WAN addresses, which automatically switch as needed.

1 Like