rustdesk-server icon indicating copy to clipboard operation
rustdesk-server copied to clipboard

Peer 2 Peer not working if IPv6 is used

Open Ahadoron opened this issue 7 months ago • 1 comments
trafficstars

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.

Ahadoron avatar Apr 17 '25 23:04 Ahadoron