[PR #4085] [MERGED] [client] Support random wireguard port on client #19463

Closed
opened 2026-08-05 05:06:02 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/4085
Author: @mlsmaycon
Created: 7/1/2025
Status: Merged
Merged: 7/2/2025
Merged by: @mlsmaycon

Base: mainHead: support-random-port-with-port0


📝 Commits (2)

  • 3ff9c15 Support random wireguard port on client
  • 96ea846 return used port to handle initPort equals to 0

📊 Changes

3 files changed (+15 additions, -16 deletions)

View changed files

📝 client/internal/config.go (+0 -4)
📝 client/internal/connect.go (+3 -8)
📝 client/internal/connect_test.go (+12 -4)

📄 Description

Describe your changes

Support for random WireGuard ports has been added. You can now run:

netbird up --wireguard-port 0

to let the system automatically select a random available port.

This option can be helpful when running multiple devices in some NATed networks to achieve P2P connections.

Note: When upgrading from clients older than v0.25.4, the WireGuard connection port will be replaced with a randomly assigned port.

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/4085 **Author:** [@mlsmaycon](https://github.com/mlsmaycon) **Created:** 7/1/2025 **Status:** ✅ Merged **Merged:** 7/2/2025 **Merged by:** [@mlsmaycon](https://github.com/mlsmaycon) **Base:** `main` ← **Head:** `support-random-port-with-port0` --- ### 📝 Commits (2) - [`3ff9c15`](https://github.com/netbirdio/netbird/commit/3ff9c15e3b3dee00e537802546ae8167926dcb28) Support random wireguard port on client - [`96ea846`](https://github.com/netbirdio/netbird/commit/96ea8468afaeb05aa79afee1f4b027ffdb4bbaf4) return used port to handle initPort equals to 0 ### 📊 Changes **3 files changed** (+15 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/config.go` (+0 -4) 📝 `client/internal/connect.go` (+3 -8) 📝 `client/internal/connect_test.go` (+12 -4) </details> ### 📄 Description ## Describe your changes Support for random WireGuard ports has been added. You can now run: ```shell netbird up --wireguard-port 0 ``` to let the system automatically select a random available port. This option can be helpful when running multiple devices in some NATed networks to achieve P2P connections. Note: When upgrading from clients older than [v0.25.4](https://github.com/netbirdio/netbird/releases/tag/v0.25.4), the WireGuard connection port will be replaced with a randomly assigned port. ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 05:06:02 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#19463