This is a set of Bash scripts to easily manage a set of WireGuard servers and clients.
This configuration allows you to add a number of servers that are mesh connected.
This allows you to configure clients to access particular server.
git clone https://github.com/ayufan/easy-wireguardOr
git clone https://gitlab.com/ayufan/easy-wireguard./init homecd home/
../add-server scaleway scaleway.remote.hostname 192.168.60.1/24 192.168.60.2 192.168.60.127The:
scalewayis a name of serverscaleway.remote.hostnameis a remote endpoint192.168.60.1/24is an tunnel address of the server192.168.60.2 192.168.60.127the IP range from which the IPs are allocated to clients
cd home/
../add-client kamil-macbookThe:
kamil-macbookthe name of client
For each server follow the https://www.wireguard.com/install/:
sudo add-apt-repository ppa:wireguard/wireguard
sudo apt-get update
sudo apt-get install wireguardcd home/
../emit-server --shell scalewayThis will print a set of commands that enable VPN on start. Just copy-paste it and voila, or:
cd home/
../emit-server --shell scaleway | ssh [email protected]Or doing the above in simpler form:
cd home/
../emit-server --ssh [email protected] scalewayHowever, if you did install easy-wireguard on scaleway.server, you can also use:
cd home/
../emit-server --up scaleway
../emit-server --down scalewayThere are number of ways to grab config
cd home/
../emit-client scaleway kamil-macbookThis gets config for particular server.
cd home/
../emit-client --shell scaleway kamil-macbookThis is a new way to installing VPN config!
cd home/
../emit-client --qr scaleway kamil-macbookIt is possible to expose either on client, or on server additional routes.
Simply edit the servers/server.conf or clients/client.conf and modify Routes=:
Routes="192.168.0.0/24,192.168.20.0/24"And re-install each client and server.
Pass a default gateway interface via DefaultGateway= in servers/server.conf:
DefaultGateway=ens2And re-install server.
cd home/
../emit-client --default scaleway kamil-macbook
../emit-client --default --qr scaleway kamil-macbook
../emit-client --default --shell scaleway kamil-macbookThere's number of additional configurations that you might be interested in:
Routes=additional routesDNS=configured DNS server used by clientsListenPort=listen address for servers (and optionally clients)PersistentKeepalive=keep connections aliveFwMarka 32-bit fwmark for outgoing packets. If set to 0 or "off", this option is disabled. May be specified in hexadecimal by prepending "0x"MTUa maximum packet size send on interfacePresharedKeya base64 preshared key generated by wg genpsk. Optional, and may be omitted. This option adds an additional layer of symmetric-key cryptography to be mixed into the already existing public-key cryptography, for post-quantum resistance.Interface_${name_of_server}=0disallow connecting this peer to given serverRoutes_${name_of_client}=overwrite a set of routes returned to given client- ...
Kamil Trzciński, 2018-2019
MIT