[GH-ISSUE #4063] Force relay connection not working #8006

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

Originally created by @himekifee on GitHub (Jun 27, 2025).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/4063

Describe the problem

When NB_ICE_FORCE_RELAY_CONN is set to true, the agent still advertises p2p over relay. I suspect the issue is on this line. I had switched the if else, and the result seems to be optimistic. The client properly advertises the relay candidate rather than p2p. However, I'm not sure if it is the desired condition.

Expected behavior

ICE candidate (Local/Remote): srflx/relay instead of ICE candidate (Local/Remote): srflx/srflx when NB_ICE_FORCE_RELAY_CONN is set on the remote peer.

Are you using NetBird Cloud?

No

NetBird version

0.49.0

Is any other VPN software installed?

No

Have you tried these troubleshooting steps?

  • Reviewed client troubleshooting (if applicable)
  • Checked for newer NetBird versions
  • Searched for similar issues on GitHub (including closed ones)
  • Restarted the NetBird client
  • Disabled other VPN software
  • Checked firewall settings
Originally created by @himekifee on GitHub (Jun 27, 2025). Original GitHub issue: https://github.com/netbirdio/netbird/issues/4063 **Describe the problem** When `NB_ICE_FORCE_RELAY_CONN` is set to true, the agent still advertises p2p over relay. I suspect the issue is on this [line](https://github.com/netbirdio/netbird/blob/34ac4e4b5a8ec6d6868623efb3ac602822f9f76d/client/internal/peer/worker_ice.go#L93). I had switched the if else, and the result seems to be optimistic. The client properly advertises the relay candidate rather than p2p. However, I'm not sure if it is the desired condition. **Expected behavior** `ICE candidate (Local/Remote): srflx/relay` instead of `ICE candidate (Local/Remote): srflx/srflx` when `NB_ICE_FORCE_RELAY_CONN` is set on the remote peer. **Are you using NetBird Cloud?** No **NetBird version** `0.49.0` **Is any other VPN software installed?** No **Have you tried these troubleshooting steps?** - [x] Reviewed [client troubleshooting](https://docs.netbird.io/how-to/troubleshooting-client) (if applicable) - [x] Checked for newer NetBird versions - [x] Searched for similar issues on GitHub (including closed ones) - [x] Restarted the NetBird client - [x] Disabled other VPN software - [x] Checked firewall settings
saavagebueno added the triage-needed label 2026-08-05 01:15:35 -04:00
Author
Owner

@nazarewk commented on GitHub (Jun 27, 2025):

@himekifee I think you might be searching for 34ac4e4b5a/client/internal/peer/conn.go (L184)

I'm not sure what NB_ICE_FORCE_RELAY_CONN does, maybe @lixmal could give some insights?

<!-- gh-comment-id:3013511609 --> @nazarewk commented on GitHub (Jun 27, 2025): @himekifee I think you might be searching for https://github.com/netbirdio/netbird/blob/34ac4e4b5a8ec6d6868623efb3ac602822f9f76d/client/internal/peer/conn.go#L184 I'm not sure what `NB_ICE_FORCE_RELAY_CONN` does, maybe @lixmal could give some insights?
Author
Owner

@himekifee commented on GitHub (Jun 27, 2025):

@himekifee I think you might be searching for

netbird/client/internal/peer/conn.go

Line 184 in 34ac4e4
if os.Getenv("NB_FORCE_RELAY") != "true" {

I'm not sure what NB_ICE_FORCE_RELAY_CONN does, maybe @lixmal could give some insights?

Ya, that seems to be working. I got NB_ICE_FORCE_RELAY_CONN from some old issue suggestion, maybe there are some new changes in between.

<!-- gh-comment-id:3013537555 --> @himekifee commented on GitHub (Jun 27, 2025): > [@himekifee](https://github.com/himekifee) I think you might be searching for > > [netbird/client/internal/peer/conn.go](https://github.com/netbirdio/netbird/blob/34ac4e4b5a8ec6d6868623efb3ac602822f9f76d/client/internal/peer/conn.go#L184) > > Line 184 in [34ac4e4](/netbirdio/netbird/commit/34ac4e4b5a8ec6d6868623efb3ac602822f9f76d) > if os.Getenv("NB_FORCE_RELAY") != "true" { > > I'm not sure what `NB_ICE_FORCE_RELAY_CONN` does, maybe [@lixmal](https://github.com/lixmal) could give some insights? Ya, that seems to be working. I got `NB_ICE_FORCE_RELAY_CONN` from some old issue suggestion, maybe there are some new changes in between.
Author
Owner

@lixmal commented on GitHub (Jun 27, 2025):

NB_ICE_FORCE_RELAY_CONN is for TURN only, as you can see in the linked code there is a dependency on the (netbird) relay availability. So yeah, nowadays NB_FORCE_RELAY is the one to use

<!-- gh-comment-id:3013544805 --> @lixmal commented on GitHub (Jun 27, 2025): `NB_ICE_FORCE_RELAY_CONN` is for TURN only, as you can see in the linked code there is a dependency on the (netbird) relay availability. So yeah, nowadays `NB_FORCE_RELAY` is the one to use
Sign in to join this conversation.
No Label triage-needed
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#8006