Wireguard
Looking for lightweight privacy on the go? Then consider hosting a WireGuard VPN service.
There are basically two ways to install Wireguard VPN on your server.
First method: use this script. It will do everything easiy and fast, and will give you client configs.
Second method: We will do everything manually
As an example, we’ll be using a virtual 172.16.0.0/24 network, but any private ip range will suffice.
On the Server
I will be using debian as example, because my server is debian as it is easy to maintain, easy to install packages, secure enough, updates are fast enough.
apt install wireguard
Enable IPv4 forwarding by adding/uncommenting the following like in /etc/sysctl.d/99-sysctl.conf
net.ipv4.ip_forward=1
then run following to apply change
sysctl -w net.ipv4.ip_forward=1
On the Client
Install wireguard Management tools, for Arch, it is wireguard-tools. For debian you can see above.
Create public and private keys for your machine:
sudo bash -c "umask 077 ; wg genkey > /etc/wireguard/client_priv.key"
sudo bash -c "wg pubkey < /etc/wireguard/client_priv.key > /etc/wireguard/client_pub.key"
On the Server
Generate public and private keys for server as well:
umask 077 ; wg genkey > /etc/wireguard/server_priv.key
wg pubkey < /etc/wireguard/server_priv.key > /etc/wireguard/server_pub.key
Then create Wireguard config file /etc/wireguard/wg0.conf
|
|
Then enable it with the following code
systemctl enable --now wg-quick@wg0.service
On the Client
Create another WireGuard configuration file in /etc/wireguard/myvpn.conf
|
|
Then it is time to go and test:
sudo wg-quick up myvpn
🌊⛰🔥