mirror of
https://github.com/angristan/wireguard-install.git
synced 2024-11-01 03:02:35 +00:00
Auto increment the suggested client IP
This commit is contained in:
parent
59570c786b
commit
8c0dd0f1a6
@ -12,10 +12,12 @@ function addClient() {
|
|||||||
ENDPOINT="$SERVER_PUB_IP:$SERVER_PORT"
|
ENDPOINT="$SERVER_PUB_IP:$SERVER_PORT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CLIENT_WG_IPV4="10.66.66.2"
|
# count peers and increment the suggested client IP
|
||||||
|
peersCount=$(grep -c 'Peer' /etc/wireguard/"$SERVER_WG_NIC".conf)
|
||||||
|
CLIENT_WG_IPV4="10.66.66.$((peersCount+2))"
|
||||||
read -rp "Client's WireGuard IPv4 " -e -i "$CLIENT_WG_IPV4" CLIENT_WG_IPV4
|
read -rp "Client's WireGuard IPv4 " -e -i "$CLIENT_WG_IPV4" CLIENT_WG_IPV4
|
||||||
|
|
||||||
CLIENT_WG_IPV6="fd42:42:42::2"
|
CLIENT_WG_IPV6="fd42:42:42::$((peersCount+2))"
|
||||||
read -rp "Client's WireGuard IPv6 " -e -i "$CLIENT_WG_IPV6" CLIENT_WG_IPV6
|
read -rp "Client's WireGuard IPv6 " -e -i "$CLIENT_WG_IPV6" CLIENT_WG_IPV6
|
||||||
|
|
||||||
# Adguard DNS by default
|
# Adguard DNS by default
|
||||||
|
Loading…
Reference in New Issue
Block a user