mirror of
https://github.com/flynx/proxmox-utils.git
synced 2025-10-29 11:10:09 +00:00
added ip generation...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
15bd2978e7
commit
e27df50ee3
@ -21,6 +21,10 @@ ALLOWED_IPS ?= 0.0.0.0/0
|
|||||||
CLIENT_IP ?= 10.42.0.1/32
|
CLIENT_IP ?= 10.42.0.1/32
|
||||||
|
|
||||||
|
|
||||||
|
test:
|
||||||
|
$(call newIP)
|
||||||
|
|
||||||
|
|
||||||
%_id:
|
%_id:
|
||||||
@ mkdir -p $$(dirname $@)
|
@ mkdir -p $$(dirname $@)
|
||||||
wg genkey 2> /dev/null > $@
|
wg genkey 2> /dev/null > $@
|
||||||
|
|||||||
19
wireguard/templates/root/getFreeClientIP
Executable file
19
wireguard/templates/root/getFreeClientIP
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
CLIENT_IPS=${CLIENT_IPS}
|
||||||
|
|
||||||
|
BASE_IP=${CLIENT_IPS/0\/*}
|
||||||
|
IPs=($(cat /etc/wireguard/clients/* \
|
||||||
|
| grep Address \
|
||||||
|
| cut -d'.' -f 4 \
|
||||||
|
| cut -d '/' -f 1 \
|
||||||
|
| sort))
|
||||||
|
IPs=${IPs[@]}
|
||||||
|
|
||||||
|
i=1
|
||||||
|
while [ "$( echo $IPs | fgrep -w $i )" ] ; do
|
||||||
|
i=$(( i + 1 ))
|
||||||
|
done
|
||||||
|
|
||||||
|
echo $BASE_IP.$i
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user