rustdesk / rustdesk/rustdesk-server

Peer 2 Peer not working if IPv6 is used

Open
#544 11 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
10.4k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
The issue occurs when I assign both an IPv4 and an IPv6 to the DNS entry for RustDesk. In this case, the complete communication between the clients and the server happens via IPv6 and the punch through never succeeds. All connections over IPv6 are established with the relais server.

Describe the environment

  • Install environment: docker on internet cloud server (Hetzner)
  • Clients: Two local machines in my private LAN
  • If available, the docker-compose.yaml file:
services:
  rustdesk-server:
    image: 'rustdesk/rustdesk-server-s6:latest'
    restart: unless-stopped
    network_mode: host
    env_file:
      - ./.env
    volumes:
      - './data:/data'

./env:

RELAY=rustdesk.example.com:21117
ENCRYPTED_ONLY=1
LIMIT_SPEED=10
RUST_LOG=debug

How to Reproduce the bug
The issue occurs when I assign both an IPv4 and an IPv6 to the DNS entry for RustDesk. In this case, the complete communication between the clients and the server happens via IPv6.
In the log, I can see the two actual IPv6 addresses of the clients and the attempt to punch through. However, this punch does not succeed.
As long as communication occurs via IPv6, all connections are routed exclusively through the relay, and no peer-to-peer connection is established.
As soon as I change the DNS entry and assign only an IPv4 address to the RustDesk address, everything in the log looks exactly the same, except that, naturally, IPv4 addresses appear instead of IPv6 addresses, and the punch-through works without any issues.

Expected behavior
I would expect, that IPv6 works just the same as IPv4 in case of P2P. So if the clients are connecting via IPv6 they should also be able to establish a P2P connection. Only if the P2P connection fails due to some other reasons, the relais should be used.

Additional context
I am unfortunately unsure whether the issue lies with the client or the host, or whether there is something in my infrastructure that specifically needs to be configured to enable clean usage of IPv6. However, since the issue can be worked around on the server side, I am submitting a report here. Apologies if I am mistaken here or if the issue lies elsewhere; unfortunately, I am not a professional when it comes to networking.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the dual-stack setup in docker-compose.yaml and .env, then reproduce the connection while comparing the IPv6 and IPv4 debug logs. Trace the client/server peer-to-peer punch-through attempt and relay fallback to determine where IPv6 behavior diverges. Done means IPv6 clients establish P2P connections when possible and use the relay only after P2P failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, rust
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.