Detect existing Wireguard tunnels and choose a different port #222

Open
opened 2025-11-20 05:08:17 -05:00 by saavagebueno · 6 comments
Owner

Originally created by @timwsuqld on GitHub (Nov 7, 2022).

When installing on a Linux machine that has existing Wireguard tunnels, Netbird still tires to use port 51820. Editing the config.json to a new port gets things running, but having it automatically detect that port 51820 is in use at first "up" would be great, as it could then pick an unused port

Originally created by @timwsuqld on GitHub (Nov 7, 2022). When installing on a Linux machine that has existing Wireguard tunnels, Netbird still tires to use port 51820. Editing the config.json to a new port gets things running, but having it automatically detect that port 51820 is in use at first "up" would be great, as it could then pick an unused port
saavagebueno added the feature-requestgood first issuetriage-needed labels 2025-11-20 05:08:17 -05:00
Author
Owner

@mlsmaycon commented on GitHub (Nov 16, 2022):

Thanks, @timwsuqld, for the suggestion. This makes sense, and we have initial support for custom ports by editing the config file at /etc/netbird/config.json and changing the value of WgPort.

relates to #566

@mlsmaycon commented on GitHub (Nov 16, 2022): Thanks, @timwsuqld, for the suggestion. This makes sense, and we have initial support for custom ports by editing the config file at /etc/netbird/config.json and changing the value of WgPort. relates to #566
Author
Owner

@nazarewk commented on GitHub (Apr 17, 2025):

will need to review whether this is still happening

@nazarewk commented on GitHub (Apr 17, 2025): will need to review whether this is still happening
Author
Owner

@Anjas2005 commented on GitHub (Jun 6, 2025):

is this still happening if yes can i contribute (I am a beginner)

@Anjas2005 commented on GitHub (Jun 6, 2025): is this still happening if yes can i contribute (I am a beginner)
Author
Owner

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

cross-linking issues related to WireGuard Port selection so they're easier to discover:

@nazarewk commented on GitHub (Jun 6, 2025): cross-linking issues related to WireGuard Port selection so they're easier to discover: - https://github.com/netbirdio/netbird/issues/2703 - https://github.com/netbirdio/netbird/issues/1378 - https://github.com/netbirdio/netbird/issues/546 - https://github.com/netbirdio/netbird/issues/1679
Author
Owner

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

FYI: we're veering towards removing the uint validation on the --wireguard-port argument, allowing it to be -1 (meaning it would be randomly picked by the operating system) and maybe even defaulting to this behavior. It would be another way to address the original issue in this feature request.

@nazarewk commented on GitHub (Jun 6, 2025): FYI: we're veering towards removing the `uint` validation on the `--wireguard-port` argument, allowing it to be `-1` (meaning it would be randomly picked by the operating system) and maybe even defaulting to this behavior. It would be another way to address the original issue in this feature request.
Author
Owner

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

random port selection is implemented in https://github.com/netbirdio/netbird/pull/4085

@nazarewk commented on GitHub (Jul 2, 2025): random port selection is implemented in https://github.com/netbirdio/netbird/pull/4085
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#222