[GH-ISSUE #5629] Link-quality-aware path selection and failover for degraded P2P connections #10863

Open
opened 2026-08-05 01:27:31 -04:00 by saavagebueno · 0 comments
Owner

Originally created by @nealzh on GitHub (Mar 19, 2026).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/5629

Hi NetBird team,

First, thank you for building NetBird. We have been evaluating it for self-hosted deployments in complex network environments, and we think it has a strong connectivity model overall.

We would like to suggest an improvement around path selection and failover behavior.

Background

From the public documentation, NetBird’s current connection model is clearly connectivity-driven:

  • prefer direct P2P first
  • fall back to relay when direct is not possible
  • on relay, prefer QUIC and fall back to WebSocket/TCP when needed

This works well for hard failure cases, such as blocked UDP or impossible NAT traversal.

However, in many real-world networks, especially ISP or enterprise networks, UDP is often not fully blocked. Instead, it is degraded by QoS, shaping, packet loss, or jitter. In such cases:

  • direct P2P may still technically remain established
  • but the link becomes practically unusable for real workloads
  • latency increases significantly
  • packet loss becomes high
  • throughput becomes very poor
  • application requests may timeout even though the path is still shown as direct/P2P

Problem

It is currently unclear from the public docs whether NetBird performs any direct-link quality evaluation beyond basic connectivity state.

What seems to be missing is a documented mechanism for:

  • detecting degraded-but-still-alive direct P2P links
  • migrating traffic from degraded direct P2P to relay
  • switching back to direct once the path quality recovers

In practice, this matters a lot in networks where UDP is not dead, but unstable.

Suggested improvement

We would like to suggest adding link-quality-aware path selection, not only connectivity-aware fallback.

Possible improvements:

  1. Continuous direct-link quality measurement

    • packet loss
    • RTT
    • jitter
    • effective throughput
    • handshake or path-health anomalies
  2. Automatic migration from degraded direct P2P to relay

    • not only when direct is impossible
    • but also when direct quality falls below a configurable threshold
  3. Automatic recovery back to direct

    • once direct becomes healthy again
    • with hysteresis/cooldown to avoid path flapping
  4. Configurable policy modes
    For example:

    • prefer_direct_always
    • prefer_direct_unless_degraded
    • prefer_relay_for_selected_peers
    • direct-to-relay thresholds
    • relay-to-direct recovery thresholds
    • probe interval / cooldown tuning
  5. Better observability
    It would be very helpful if netbird status --detail could expose more quality-related data, such as:

    • current path quality score
    • recent packet loss
    • recent jitter / RTT trend
    • current switch reason
    • last direct→relay or relay→direct event reason
  6. Support for critical traffic profiles
    Some environments need stable low-timeout connectivity more than optimal direct performance. A policy option to prefer relay for selected peers/groups/routes would be very useful.

Why this matters

This would significantly improve NetBird’s behavior in “gray failure” environments where:

  • direct UDP is not fully broken
  • but quality is too poor for stable application traffic
  • relay over TCP/WebSocket may actually provide better real-world reliability

We believe this would make NetBird much stronger for self-hosted deployments in unstable ISP environments, enterprise networks, and mobile/CGNAT-heavy scenarios.

Thanks again for your work.

Best regards

Originally created by @nealzh on GitHub (Mar 19, 2026). Original GitHub issue: https://github.com/netbirdio/netbird/issues/5629 Hi NetBird team, First, thank you for building NetBird. We have been evaluating it for self-hosted deployments in complex network environments, and we think it has a strong connectivity model overall. We would like to suggest an improvement around path selection and failover behavior. ## Background From the public documentation, NetBird’s current connection model is clearly connectivity-driven: * prefer direct P2P first * fall back to relay when direct is not possible * on relay, prefer QUIC and fall back to WebSocket/TCP when needed This works well for hard failure cases, such as blocked UDP or impossible NAT traversal. However, in many real-world networks, especially ISP or enterprise networks, UDP is often not fully blocked. Instead, it is degraded by QoS, shaping, packet loss, or jitter. In such cases: * direct P2P may still technically remain established * but the link becomes practically unusable for real workloads * latency increases significantly * packet loss becomes high * throughput becomes very poor * application requests may timeout even though the path is still shown as direct/P2P ## Problem It is currently unclear from the public docs whether NetBird performs any direct-link quality evaluation beyond basic connectivity state. What seems to be missing is a documented mechanism for: * detecting degraded-but-still-alive direct P2P links * migrating traffic from degraded direct P2P to relay * switching back to direct once the path quality recovers In practice, this matters a lot in networks where UDP is not dead, but unstable. ## Suggested improvement We would like to suggest adding link-quality-aware path selection, not only connectivity-aware fallback. Possible improvements: 1. Continuous direct-link quality measurement * packet loss * RTT * jitter * effective throughput * handshake or path-health anomalies 2. Automatic migration from degraded direct P2P to relay * not only when direct is impossible * but also when direct quality falls below a configurable threshold 3. Automatic recovery back to direct * once direct becomes healthy again * with hysteresis/cooldown to avoid path flapping 4. Configurable policy modes For example: * prefer_direct_always * prefer_direct_unless_degraded * prefer_relay_for_selected_peers * direct-to-relay thresholds * relay-to-direct recovery thresholds * probe interval / cooldown tuning 5. Better observability It would be very helpful if `netbird status --detail` could expose more quality-related data, such as: * current path quality score * recent packet loss * recent jitter / RTT trend * current switch reason * last direct→relay or relay→direct event reason 6. Support for critical traffic profiles Some environments need stable low-timeout connectivity more than optimal direct performance. A policy option to prefer relay for selected peers/groups/routes would be very useful. ## Why this matters This would significantly improve NetBird’s behavior in “gray failure” environments where: * direct UDP is not fully broken * but quality is too poor for stable application traffic * relay over TCP/WebSocket may actually provide better real-world reliability We believe this would make NetBird much stronger for self-hosted deployments in unstable ISP environments, enterprise networks, and mobile/CGNAT-heavy scenarios. Thanks again for your work. Best regards
saavagebueno added the feature-request label 2026-08-05 01:27:31 -04:00
Sign in to join this conversation.
No Label feature-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#10863