[GH-ISSUE #4103] Give clients easy way to force relay-only connections #8511

Closed
opened 2026-08-05 01:18:20 -04:00 by saavagebueno · 3 comments
Owner

Originally created by @willcipher on GitHub (Jul 4, 2025).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/4103

Is your feature request related to a problem? Please describe.
Though Netbird will fall back to using a relay when a P2P connection fails, there are some environments where it would be best to not even attempt P2P. (See Add support for Wireguard over TCP using mullvad's method of UDP tunneling over TCP, Achieving a Wireguard (P2P Netbird) connection when ISP censors Wireguard traffic | reddit) However, enabling the NB_FORCE_RELAY environment variable is cumbersome in some systems, impossible (?) in others.

Describe the solution you'd like
Exposing the NB_FORCE_RELAY setting via the CLI or user interface, rather than (or in addition to) an environment variable.

Describe alternatives you've considered
On a Mac, I've added an EnvironmentVariables key to /Library/LaunchDaemons/netbird.plist. Needless to say, that's not a terribly easy way to enable/disable this feature. I see that it's a bit onerous for Windows as well.

Additional context
On iOS/iPadOS, I'm not sure if there is a way to enable the NB_FORCE_RELAY setting.

Then again, I'm still new at Netbird—if there is an easier way to prompt a Netbird client to use only relays, please let me know, and feel free to close this feature request.

While I'm at it: Highest regards for the Netbird team! Thank you for this gem of a product. 😀

Originally created by @willcipher on GitHub (Jul 4, 2025). Original GitHub issue: https://github.com/netbirdio/netbird/issues/4103 **Is your feature request related to a problem? Please describe.** Though Netbird will fall back to using a relay when a P2P connection fails, there are some environments where it would be best to not even attempt P2P. \(See [Add support for Wireguard over TCP using mullvad's method of UDP tunneling over TCP](https://github.com/netbirdio/netbird/issues/2367), [Achieving a Wireguard \(P2P Netbird\) connection when ISP censors Wireguard traffic | reddit](https://www.reddit.com/r/netbird/comments/1kc037u/achieving_a_wireguard_p2p_netbird_connection_when)\) However, enabling the `NB_FORCE_RELAY` environment variable is cumbersome in some systems, impossible (?) in others. **Describe the solution you'd like** Exposing the `NB_FORCE_RELAY` setting via the CLI or user interface, rather than (or in addition to) an environment variable. **Describe alternatives you've considered** On a Mac, I've added an [EnvironmentVariables](https://github.com/netbirdio/netbird/issues/2367#issuecomment-3035881552) key to `/Library/LaunchDaemons/netbird.plist`. Needless to say, that's not a terribly easy way to enable/disable this feature. I see that it's a bit [onerous](https://github.com/netbirdio/netbird/issues/730#issuecomment-1679113925) for Windows as well. **Additional context** On iOS/iPadOS, I'm not sure if there is a way to enable the `NB_FORCE_RELAY` setting. Then again, I'm still new at Netbird—if there is an easier way to prompt a Netbird client to use only relays, please let me know, and feel free to close this feature request. While I'm at it: **_Highest regards for the Netbird team!_** Thank you for this gem of a product. 😀
saavagebueno added the feature-requestclientclient-ui labels 2026-08-05 01:18:20 -04:00
Author
Owner

@nazarewk commented on GitHub (Jul 4, 2025):

This will be (at least partially) addressed by https://github.com/netbirdio/netbird/pull/3975: setting any envvars on a service with a CLI command

<!-- gh-comment-id:3036123931 --> @nazarewk commented on GitHub (Jul 4, 2025): This will be (at least partially) addressed by https://github.com/netbirdio/netbird/pull/3975: setting any envvars on a service with a CLI command
Author
Owner

@MichaelUray commented on GitHub (Apr 25, 2026):

This is addressed by #5989 which proposes consolidating NB_FORCE_RELAY and NB_ENABLE_EXPERIMENTAL_LAZY_CONN into a single connection-mode enum (relay-forced / p2p / p2p-lazy / p2p-dynamic / p2p-dynamic-lazy) exposed via:

  • CLI flag: --connection-mode=relay-forced (replaces the env-var requirement)
  • Desktop UI systray: mode picker (extending the existing "Enable Lazy Connections" entry in client/ui/client_ui.go:1043)
  • Mobile UI: dropdown in Advanced Settings on Android and iOS (replacing today's "Force relay connection" toggle)

Existing NB_FORCE_RELAY env var continues to work as a backwards-compat alias for connection-mode=relay-forced so existing automation doesn't break, but the env var becomes deprecated in favor of the explicit mode setting.

Cross-platform UI exposure was specifically called out as a goal — your iOS/Mac/Windows pain points should all be addressed.

If you think this captures your use case, you may want to consider closing this issue in favor of the new proposal.

<!-- gh-comment-id:4318535568 --> @MichaelUray commented on GitHub (Apr 25, 2026): This is addressed by #5989 which proposes consolidating `NB_FORCE_RELAY` and `NB_ENABLE_EXPERIMENTAL_LAZY_CONN` into a single `connection-mode` enum (`relay-forced` / `p2p` / `p2p-lazy` / `p2p-dynamic` / `p2p-dynamic-lazy`) exposed via: - CLI flag: `--connection-mode=relay-forced` (replaces the env-var requirement) - Desktop UI systray: mode picker (extending the existing "Enable Lazy Connections" entry in `client/ui/client_ui.go:1043`) - Mobile UI: dropdown in Advanced Settings on Android and iOS (replacing today's "Force relay connection" toggle) Existing `NB_FORCE_RELAY` env var continues to work as a backwards-compat alias for `connection-mode=relay-forced` so existing automation doesn't break, but the env var becomes deprecated in favor of the explicit mode setting. Cross-platform UI exposure was specifically called out as a goal — your iOS/Mac/Windows pain points should all be addressed. If you think this captures your use case, you may want to consider closing this issue in favor of the new proposal.
Author
Owner

@willcipher commented on GitHub (Apr 25, 2026):

That sounds like that would resolve this issue. Thank you so much!

<!-- gh-comment-id:4319426446 --> @willcipher commented on GitHub (Apr 25, 2026): That sounds like that would resolve this issue. Thank you so much!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#8511