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:
wget https://raw.githubusercontent.com/techahold/rustdeskinstall/master/install.sh
chmod +x install.sh
./install.sh
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/id_ed25519.pub
. 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:
noip.me
(I’ll use xxx.noip.me
here)
I entered the LAN IP 192.168.99.72
for Client 1 and xxx.noip.me
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
192.168.99.72
.
- Client 2, outside the LAN, can’t reach this address.
How I Fixed It
Reading the install.sh
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 xxx.noip.me
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 xxx.noip.me -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 xxx.noip.me
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
I have just registered to thank you. I am in a similar situation like you. I just installed the rustdesk server on a Pi 4. Works good for now.
1 Like