Default value for Wireguard port is 0 but help says 51820 #2323

Open
opened 2025-11-20 07:07:43 -05:00 by saavagebueno · 4 comments
Owner

Originally created by @saule1508 on GitHub (Sep 30, 2025).

Describe the problem

When you install netbird, it creates a config file with a value of "WgPort" set to 0. When you do netbird up --help it says the default value for WireguardPort is 51820.

To Reproduce
Install netbird on linux then look at the generated config:

grep WgPort /var/lib/netbird/default.json
    "WgPort": 0,

type netbird up --help, it says

--wireguard-port uint16 WireGuard interface listening port (default 51820)

Expected behavior

I think after a first install of netbird the value should be 51820. But it takes this value of ConfigInput in client/internal/profilemanager/config.go which is a pointer to an Int and default to nil. It should probably initialize with the value of DefaultWgPort in client/iface/iface.go

Are you using NetBird Cloud?

no

NetBird version

58.0.2

Is any other VPN software installed?

no
Debug output

To help us resolve the problem, please attach the following anonymized status output

netbird status -dA

Create and upload a debug bundle, and share the returned file key:

netbird debug for 1m -AS -U

Uploaded files are automatically deleted after 30 days.

Alternatively, create the file only and attach it here manually:

netbird debug for 1m -AS

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

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 @saule1508 on GitHub (Sep 30, 2025). **Describe the problem** When you install netbird, it creates a config file with a value of "WgPort" set to 0. When you do netbird up --help it says the default value for WireguardPort is 51820. **To Reproduce** Install netbird on linux then look at the generated config: ``` grep WgPort /var/lib/netbird/default.json "WgPort": 0, ``` type netbird up --help, it says --wireguard-port uint16 WireGuard interface listening port (default 51820) **Expected behavior** I think after a first install of netbird the value should be 51820. But it takes this value of ConfigInput in client/internal/profilemanager/config.go which is a pointer to an Int and default to nil. It should probably initialize with the value of DefaultWgPort in client/iface/iface.go **Are you using NetBird Cloud?** no **NetBird version** 58.0.2 **Is any other VPN software installed?** no **Debug output** To help us resolve the problem, please attach the following anonymized status output netbird status -dA Create and upload a debug bundle, and share the returned file key: netbird debug for 1m -AS -U *Uploaded files are automatically deleted after 30 days.* Alternatively, create the file only and attach it here manually: netbird debug for 1m -AS **Screenshots** If applicable, add screenshots to help explain your problem. **Additional context** Add any other context about the problem here. **Have you tried these troubleshooting steps?** - [ ] Reviewed [client troubleshooting](https://docs.netbird.io/how-to/troubleshooting-client) (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
saavagebueno added the bugclient labels 2025-11-20 07:07:43 -05:00
Author
Owner

@nazarewk commented on GitHub (Sep 30, 2025):

this is a bug introduced with the profiles feature that we're tracking internally, I'll make a note to update/close this issue when it's addressed

@nazarewk commented on GitHub (Sep 30, 2025): this is a bug introduced with the profiles feature that we're tracking internally, I'll make a note to update/close this issue when it's addressed
Author
Owner

@saule1508 commented on GitHub (Oct 18, 2025):

this should fix it, will try next week: https://github.com/netbirdio/netbird/pull/4650

@saule1508 commented on GitHub (Oct 18, 2025): this should fix it, will try next week: https://github.com/netbirdio/netbird/pull/4650
Author
Owner

@NiklasRosenstein commented on GitHub (Nov 5, 2025):

I don't see this explicitly stated in the issue, but it seems to me this causes WG to listen on another port. One of my nodes is having trouble after enabling a firewall that only permits ingress traffic on UDP/51820, and it is the node with "WgPort": 0.

Interestingly, both of my nodes run Netbird v0.59.11 and only one has "WgPort": 0 set in /var/lib/netbird/default.json. Presumably that is because this file was initialized with some buggy version of Netbird on one node and a not-buggy version on the other?

What is the recommended way to fix this?

@NiklasRosenstein commented on GitHub (Nov 5, 2025): I don't see this explicitly stated in the issue, but it seems to me this causes WG to listen on another port. One of my nodes is having trouble after enabling a firewall that only permits ingress traffic on `UDP/51820`, and it is the node with `"WgPort": 0`. Interestingly, both of my nodes run Netbird v0.59.11 and only one has `"WgPort": 0` set in `/var/lib/netbird/default.json`. Presumably that is because this file was initialized with some buggy version of Netbird on one node and a not-buggy version on the other? What is the recommended way to fix this?
Author
Owner

@lixmal commented on GitHub (Nov 5, 2025):

@NiklasRosenstein you're probably right about that.
You can correct the port directly in the config file or with

netbird down
netbird up --wireguard-port 51820
@lixmal commented on GitHub (Nov 5, 2025): @NiklasRosenstein you're probably right about that. You can correct the port directly in the config file or with ``` netbird down netbird up --wireguard-port 51820 ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#2323