diff --git a/src/server/utils/WireGuard.ts b/src/server/utils/WireGuard.ts index e2d3af9c..7d1be6a1 100644 --- a/src/server/utils/WireGuard.ts +++ b/src/server/utils/WireGuard.ts @@ -19,6 +19,9 @@ class WireGuard { async #saveWireguardConfig() { const system = await Database.getSystem(); const clients = await Database.getClients(); + const cidrBlock = ip.cidrSubnet( + system.userConfig.addressRange + ).subnetMaskLength; let result = ` # Note: Do not edit this file directly. # Your changes will be overwritten! @@ -26,7 +29,7 @@ class WireGuard { # Server [Interface] PrivateKey = ${system.interface.privateKey} -Address = ${system.interface.address} +Address = ${system.interface.address}/${cidrBlock} ListenPort = ${system.wgPort} PreUp = ${system.iptables.PreUp} PostUp = ${system.iptables.PostUp}