-
install python dependency
python3 -m pip install -r req.txt
-
rename db.json.template to db.json
cp ./db.json.template ./db.json
-
change last_ip in db.json to your own network ip address.
For example in wireguard default network is 10.0.0.0/8 and server address is 10.0.0.1.
You should set "last_ip" as 10.0.0.1 and after that the script will increment ip addresses
- in main.py you have to set BASE_DIR
... BASE_DIR = "/etc/wireguard" ...
-
run key generator
python3 main.py --name <client-name>
-
copy output to wg0.conf
output look like
udwfMasdsadsadsddsasdkjasoidhughfasd= # <client-name> [Peer] PublicKey = udwfMasdsadsadsddsasdkjasoidhughfasd= AllowedIPs = 10.0.0.29/32 /<BASE_DIR>/confs/<client-name>_wg.conf
You have to copy
# <client-name> [Peer] PublicKey = udwfMasdsadsadsddsasdkjasoidhughfasd= AllowedIPs = 10.0.0.29/32
and paste it to wireguard config file (by default /etc/wireguard/wg0.conf)
-
send /<BASE_DIR>/confs/_wg.conf to client
-
restart wireguard service
systemctl restart wg-quick@wg0
Install wireguard https://www.wireguard.com/install
Connect to server
wg-quick up <client-name>_wg.conf
Drop connection
wg-quick down <client-name>_wg.conf