netbirdio / netbird

Connect your devices into a secure WireGuard®-based overlay network with SSO, MFA and granular access controls.
https://netbird.io
BSD 3-Clause "New" or "Revised" License
10.65k stars 475 forks source link

Unable to connect via P2P even public IPv4 is available #2563

Open Integral-Tech opened 1 week ago

Integral-Tech commented 1 week ago

Describe the problem

I am pretty sure that one of my peers has public IPv4 address, however I fail to connect two peers via P2P.

To Reproduce

Steps to reproduce the behavior:

  1. Start Netbird service on two peers (one of them has public IPv4 address)
  2. Run netbird status -d

Expected behavior

  Status: Connected
  -- detail --
  Connection type: P2P
  Direct: true

Are you using NetBird Cloud?

Yes

NetBird version

0.28.9

NetBird status -dA output:

Peers detail:
 *.netbird.cloud:
  NetBird IP: *
  Public key: *
  Status: Connected
  -- detail --
  Connection type: Relayed
  Direct: true
  ICE candidate (Local/Remote): host/relay
  ICE candidate endpoints (Local/Remote): *
  Last connection update: 14 seconds ago
  Last WireGuard handshake: -
  Transfer status (received/sent) 444 B/424 B
  Quantum resistance: false
  Routes: 192.168.0.0/16
  Latency: 426.126669ms

OS: linux/amd64
Daemon version: 0.28.9
CLI version: 0.28.9
Management: Connected to https://api.netbird.io:443
Signal: Connected to https://signal.netbird.io:443
Relays: 
  [stun:stun.netbird.io:5555] is Available
  [turns:turn.netbird.io:443?transport=tcp] is Available
Nameservers: 
FQDN: *.netbird.cloud
NetBird IP: *
Interface type: Kernel
Quantum resistance: false
Routes: -
Peers count: 1/1 Connected
pascal-fischer commented 1 week ago

Hi @Integral-Tech, to have a full P2P connection both peers need to be reachable directly. In your status output you see ICE candidate (Local/Remote): host/relay so one way is connected on host level (due to the public IP) which would allow P2P but the opposite direction is relayed. Thats why overall the connection type is listed as Relayed

Marcus1Pierce commented 1 week ago

@Integral-Tech From what I know, if you want both peers to communicate via P2P, both peers must be on the same IP segment, or both peers must have a public IP and be accessible from outside.

CMIIW