[PR #1101] [CLOSED] Custom MTU value for wireguard interface #13313

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/1101
Author: @reimarstier
Created: 8/22/2023
Status: Closed

Base: mainHead: configure-mtu


📝 Commits (3)

  • 17e69e5 Add configuration field to use a custom MTU value for the wireguard interface
  • e8901f4 Add MTU configuration option to cli parameters
  • 8de14ad Fix protobuf

📊 Changes

13 files changed (+171 additions, -41 deletions)

View changed files

📝 client/cmd/login.go (+9 -0)
📝 client/cmd/login_test.go (+40 -0)
📝 client/cmd/root.go (+3 -0)
📝 client/cmd/up.go (+1 -0)
📝 client/cmd/up_daemon_test.go (+12 -0)
📝 client/internal/config.go (+20 -0)
📝 client/internal/connect.go (+1 -0)
📝 client/internal/engine.go (+3 -1)
📝 client/internal/engine_test.go (+7 -1)
📝 client/proto/daemon.pb.go (+43 -33)
📝 client/proto/daemon.proto (+2 -0)
📝 client/server/server.go (+6 -0)
📝 iface/tun_linux.go (+24 -6)

📄 Description

The default maximum transmission unit (MTU) for a ethernet network interface is 1500 bytes. By default the wireguard interface is created with a lower MTU value, e.g. 1420 bytes. In case of netbird it is created with a MTU value of 1280 bytes because there is some overhead for tunnel communication accounted for.
To run some custom applications it might be necessary to have the full 1500 bytes of an ethernet frame. For such use cases I would like to configure a higher MTU than the default value. This will have a negative performance impact to the network communication but it is the lesser of two evil if the other option is that the application won't work.

This PR adds the field WgIfaceMtu to the netbird configuration config.json to pass a custom MTU value for the wireguard interface. The value may be passed as a command line parameter to the login command as follows:

netbird login --mtu 1500 --management-url https://netbird.local:443 --setup-key xxx
netbird up

# to check the MTU value
root@peer1:/etc/netbird# ip a show dev wt0
5: wt0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 [...]

Describe your changes

This allows to pass another MTU value for the wireguard interface.

See issue #743

Checklist

  • Is a feature enhancement
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

🔄 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/1101 **Author:** [@reimarstier](https://github.com/reimarstier) **Created:** 8/22/2023 **Status:** ❌ Closed **Base:** `main` ← **Head:** `configure-mtu` --- ### 📝 Commits (3) - [`17e69e5`](https://github.com/netbirdio/netbird/commit/17e69e5badf0aa4e338c37d6fd92213282c68ce9) Add configuration field to use a custom MTU value for the wireguard interface - [`e8901f4`](https://github.com/netbirdio/netbird/commit/e8901f411ee3e85d86570585efc3aa57970a4a05) Add MTU configuration option to cli parameters - [`8de14ad`](https://github.com/netbirdio/netbird/commit/8de14adaba9154940ccf3078605b9465197c2095) Fix protobuf ### 📊 Changes **13 files changed** (+171 additions, -41 deletions) <details> <summary>View changed files</summary> 📝 `client/cmd/login.go` (+9 -0) 📝 `client/cmd/login_test.go` (+40 -0) 📝 `client/cmd/root.go` (+3 -0) 📝 `client/cmd/up.go` (+1 -0) 📝 `client/cmd/up_daemon_test.go` (+12 -0) 📝 `client/internal/config.go` (+20 -0) 📝 `client/internal/connect.go` (+1 -0) 📝 `client/internal/engine.go` (+3 -1) 📝 `client/internal/engine_test.go` (+7 -1) 📝 `client/proto/daemon.pb.go` (+43 -33) 📝 `client/proto/daemon.proto` (+2 -0) 📝 `client/server/server.go` (+6 -0) 📝 `iface/tun_linux.go` (+24 -6) </details> ### 📄 Description The default maximum transmission unit (MTU) for a ethernet network interface is 1500 bytes. By default the wireguard interface is created with a lower MTU value, e.g. 1420 bytes. In case of netbird it is created with a MTU value of 1280 bytes because there is some overhead for tunnel communication accounted for. To run some custom applications it might be necessary to have the full 1500 bytes of an ethernet frame. For such use cases I would like to configure a higher MTU than the default value. This will have a negative performance impact to the network communication but it is the lesser of two evil if the other option is that the application won't work. This PR adds the field `WgIfaceMtu` to the netbird configuration `config.json` to pass a custom MTU value for the wireguard interface. The value may be passed as a command line parameter to the login command as follows: ``` netbird login --mtu 1500 --management-url https://netbird.local:443 --setup-key xxx netbird up # to check the MTU value root@peer1:/etc/netbird# ip a show dev wt0 5: wt0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 [...] ``` ## Describe your changes This allows to pass another [MTU](https://en.wikipedia.org/wiki/Maximum_transmission_unit) value for the wireguard interface. ## Issue ticket number and link See issue #743 ### Checklist - [x] Is a feature enhancement - [x] Created tests that fail without the change (if possible) - [x] Extended the README / documentation, if necessary --- <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 02:08:04 -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#13313