[PR #3219] feat: add MTU configuration field to server settings for AWG and WireGuard #3137

Open
opened 2026-10-14 21:07:45 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amnezia-client/pull/3219
Author: @HugoFiermein
Created: 9/26/2026
Status: 🔄 Open

Base: dev ← Head: feat-server-mtu-setting


📝 Commits (1)

  • f610e09 feat: add MTU configuration to AWG and WireGuard server settings

📊 Changes

22 files changed (+110 additions, -8 deletions)

View changed files

📝 client/core/configurators/awgConfigurator.cpp (+3 -0)
📝 client/core/configurators/wireguardConfigurator.cpp (+11 -5)
📝 client/core/installers/awgInstaller.cpp (+2 -0)
📝 client/core/installers/installerBase.cpp (+2 -0)
📝 client/core/installers/wireguardInstaller.cpp (+1 -0)
📝 client/core/models/protocols/awgProtocolConfig.cpp (+5 -1)
📝 client/core/models/protocols/awgProtocolConfig.h (+1 -0)
📝 client/core/models/protocols/wireGuardProtocolConfig.cpp (+5 -1)
📝 client/core/models/protocols/wireGuardProtocolConfig.h (+1 -0)
📝 client/core/utils/selfhosted/scriptsRegistry.cpp (+2 -0)
📝 client/server_scripts/awg/configure_container.sh (+1 -0)
📝 client/server_scripts/awg/template.conf (+1 -0)
📝 client/server_scripts/awg_legacy/configure_container.sh (+3 -0)
📝 client/server_scripts/awg_legacy/template.conf (+1 -0)
📝 client/server_scripts/wireguard/configure_container.sh (+3 -0)
📝 client/server_scripts/wireguard/template.conf (+1 -0)
📝 client/ui/models/protocols/awgConfigModel.cpp (+6 -0)
📝 client/ui/models/protocols/awgConfigModel.h (+1 -0)
📝 client/ui/models/protocols/wireguardConfigModel.cpp (+6 -0)
📝 client/ui/models/protocols/wireguardConfigModel.h (+1 -0)

...and 2 more files

📄 Description

Summary

This PR adds the ability to configure MTU on the server side for AmneziaWG (AWG) and WireGuard protocols in the AmneziaVPN desktop client.

Problem

Previously, MTU could only be customized on the client side per connection. However, on networks with smaller MTUs (such as PPPoE with 1492 MTU, or cellular 3G/4G/5G carriers with 1360-1420 MTU), AmneziaWG's obfuscation parameters (specifically ContentPaddingAddition, which appends up to 64 bytes to transport packets) frequently cause packet fragmentation and drops when the default MTU (1376) is used.
Setting lower MTU on every client device manually (iOS, Android, Windows, macOS) is inconvenient and impractical when sharing connections with multiple users.

Furthermore, when an admin changes MTU, it should be reflected on the server-side interface (awg0 / wg0), saved in the server container configuration, and automatically inherited when generating or exporting client configurations.

Changes

  1. Protocol Models & Serialization (AwgProtocolConfig, WireGuardProtocolConfig):

    • Added QString mtu; to AwgServerConfig and WireGuardServerConfig.
    • Added JSON serialization and deserialization for configKey::mtu.
    • Included mtu in hasEqualServerSettings so changes trigger server container reconfiguration.
  2. UI Models (AwgConfigModel, WireGuardConfigModel):

    • Added ServerMtuRole (serverMtu) to expose the server MTU to QML.
    • Applied defaults (protocols::awg::defaultMtu / protocols::wireguard::defaultMtu) when initializing or updating the model.
  3. UI QML Pages (PageProtocolAwgSettings.qml, PageProtocolWireGuardSettings.qml):

    • Added MTU text input field (headerText: qsTr("MTU")) bounded by IntValidator { bottom: 576; top: 65535 }.
    • Added validation check to the Save button.
  4. Configurators & Installers (awgConfigurator, wireguardConfigurator, awgInstaller, installerBase, wireguardInstaller):

    • In AwgConfigurator::createConfig and WireguardConfigurator::createConfig, client configurations inherit the server's configured MTU unless explicitly overridden on the client side.
    • Initialized default MTU in InstallerBase::createBaseConfig and AwgInstaller::generateAwgParameters.
    • Extracted server MTU in AwgInstaller::extractConfigFromContainer and WireguardInstaller::extractConfigFromContainer.
  5. Server Scripts (scriptsRegistry, awg/configure_container.sh, wireguard/configure_container.sh, template configs):

    • Passed $MTU variable into container scripts via genAwgVars and genWireGuardVars.
    • Added MTU = $MTU to awg0.conf / wg0.conf and cleanup for empty lines.

🔄 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/amnezia-vpn/amnezia-client/pull/3219 **Author:** [@HugoFiermein](https://github.com/HugoFiermein) **Created:** 9/26/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `feat-server-mtu-setting` --- ### 📝 Commits (1) - [`f610e09`](https://github.com/amnezia-vpn/amnezia-client/commit/f610e099b8279f7087081e00c3ac245583e232a8) feat: add MTU configuration to AWG and WireGuard server settings ### 📊 Changes **22 files changed** (+110 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `client/core/configurators/awgConfigurator.cpp` (+3 -0) 📝 `client/core/configurators/wireguardConfigurator.cpp` (+11 -5) 📝 `client/core/installers/awgInstaller.cpp` (+2 -0) 📝 `client/core/installers/installerBase.cpp` (+2 -0) 📝 `client/core/installers/wireguardInstaller.cpp` (+1 -0) 📝 `client/core/models/protocols/awgProtocolConfig.cpp` (+5 -1) 📝 `client/core/models/protocols/awgProtocolConfig.h` (+1 -0) 📝 `client/core/models/protocols/wireGuardProtocolConfig.cpp` (+5 -1) 📝 `client/core/models/protocols/wireGuardProtocolConfig.h` (+1 -0) 📝 `client/core/utils/selfhosted/scriptsRegistry.cpp` (+2 -0) 📝 `client/server_scripts/awg/configure_container.sh` (+1 -0) 📝 `client/server_scripts/awg/template.conf` (+1 -0) 📝 `client/server_scripts/awg_legacy/configure_container.sh` (+3 -0) 📝 `client/server_scripts/awg_legacy/template.conf` (+1 -0) 📝 `client/server_scripts/wireguard/configure_container.sh` (+3 -0) 📝 `client/server_scripts/wireguard/template.conf` (+1 -0) 📝 `client/ui/models/protocols/awgConfigModel.cpp` (+6 -0) 📝 `client/ui/models/protocols/awgConfigModel.h` (+1 -0) 📝 `client/ui/models/protocols/wireguardConfigModel.cpp` (+6 -0) 📝 `client/ui/models/protocols/wireguardConfigModel.h` (+1 -0) _...and 2 more files_ </details> ### 📄 Description ### Summary This PR adds the ability to configure MTU on the server side for **AmneziaWG** (AWG) and **WireGuard** protocols in the AmneziaVPN desktop client. ### Problem Previously, MTU could only be customized on the client side per connection. However, on networks with smaller MTUs (such as PPPoE with 1492 MTU, or cellular 3G/4G/5G carriers with 1360-1420 MTU), AmneziaWG's obfuscation parameters (specifically `ContentPaddingAddition`, which appends up to 64 bytes to transport packets) frequently cause packet fragmentation and drops when the default MTU (1376) is used. Setting lower MTU on every client device manually (iOS, Android, Windows, macOS) is inconvenient and impractical when sharing connections with multiple users. Furthermore, when an admin changes MTU, it should be reflected on the server-side interface (`awg0` / `wg0`), saved in the server container configuration, and automatically inherited when generating or exporting client configurations. ### Changes 1. **Protocol Models & Serialization (`AwgProtocolConfig`, `WireGuardProtocolConfig`):** - Added `QString mtu;` to `AwgServerConfig` and `WireGuardServerConfig`. - Added JSON serialization and deserialization for `configKey::mtu`. - Included `mtu` in `hasEqualServerSettings` so changes trigger server container reconfiguration. 2. **UI Models (`AwgConfigModel`, `WireGuardConfigModel`):** - Added `ServerMtuRole` (`serverMtu`) to expose the server MTU to QML. - Applied defaults (`protocols::awg::defaultMtu` / `protocols::wireguard::defaultMtu`) when initializing or updating the model. 3. **UI QML Pages (`PageProtocolAwgSettings.qml`, `PageProtocolWireGuardSettings.qml`):** - Added MTU text input field (`headerText: qsTr("MTU")`) bounded by `IntValidator { bottom: 576; top: 65535 }`. - Added validation check to the Save button. 4. **Configurators & Installers (`awgConfigurator`, `wireguardConfigurator`, `awgInstaller`, `installerBase`, `wireguardInstaller`):** - In `AwgConfigurator::createConfig` and `WireguardConfigurator::createConfig`, client configurations inherit the server's configured MTU unless explicitly overridden on the client side. - Initialized default MTU in `InstallerBase::createBaseConfig` and `AwgInstaller::generateAwgParameters`. - Extracted server MTU in `AwgInstaller::extractConfigFromContainer` and `WireguardInstaller::extractConfigFromContainer`. 5. **Server Scripts (`scriptsRegistry`, `awg/configure_container.sh`, `wireguard/configure_container.sh`, template configs):** - Passed `$MTU` variable into container scripts via `genAwgVars` and `genWireGuardVars`. - Added `MTU = $MTU` to `awg0.conf` / `wg0.conf` and cleanup for empty lines. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amnezia-client#3137
No description provided.