feature: improved increase of the last octet of the address for wireguard
This commit is contained in:
parent
61f229b5df
commit
e74d607a52
3 changed files with 7 additions and 3 deletions
|
|
@ -124,6 +124,7 @@ WireguardConfigurator::ConnectionData WireguardConfigurator::prepareWireguardCon
|
|||
.toObject()
|
||||
.value(config_key::subnet_address)
|
||||
.toString(protocols::wireguard::defaultSubnetAddress));
|
||||
lastIp.setAddress(lastIp.toIPv4Address() + 1);
|
||||
} else {
|
||||
lastIp = ips.last();
|
||||
}
|
||||
|
|
@ -131,7 +132,6 @@ WireguardConfigurator::ConnectionData WireguardConfigurator::prepareWireguardCon
|
|||
switch (lastOctet) {
|
||||
case 254: result.setAddress(lastIp.toIPv4Address() + 3); break;
|
||||
case 255: result.setAddress(lastIp.toIPv4Address() + 2); break;
|
||||
case 0: result.setAddress(lastIp.toIPv4Address() + 2); break;
|
||||
default: result.setAddress(lastIp.toIPv4Address() + 1); break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ echo $WIREGUARD_SERVER_PUBLIC_KEY > /opt/amnezia/awg/wireguard_server_public_key
|
|||
WIREGUARD_PSK=$(wg genpsk)
|
||||
echo $WIREGUARD_PSK > /opt/amnezia/awg/wireguard_psk.key
|
||||
|
||||
AWG_SERVER_IP=$(echo $AWG_SUBNET_IP | sed 's/\.0$/\.1/')
|
||||
IFS='.' read -r a b c d <<< "$WIREGUARD_SUBNET_IP"
|
||||
((d++))
|
||||
WIREGUARD_SERVER_IP="${a}.${b}.${c}.${d}"
|
||||
|
||||
cat > /opt/amnezia/awg/wg0.conf <<EOF
|
||||
[Interface]
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ echo $WIREGUARD_SERVER_PUBLIC_KEY > /opt/amnezia/wireguard/wireguard_server_publ
|
|||
WIREGUARD_PSK=$(wg genpsk)
|
||||
echo $WIREGUARD_PSK > /opt/amnezia/wireguard/wireguard_psk.key
|
||||
|
||||
WIREGUARD_SERVER_IP=$(echo $WIREGUARD_SUBNET_IP | sed 's/\.0$/\.1/')
|
||||
IFS='.' read -r a b c d <<< "$WIREGUARD_SUBNET_IP"
|
||||
((d++))
|
||||
WIREGUARD_SERVER_IP="${a}.${b}.${c}.${d}"
|
||||
|
||||
cat > /opt/amnezia/wireguard/wg0.conf <<EOF
|
||||
[Interface]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue