-
Notifications
You must be signed in to change notification settings - Fork 0
Add Linux Client to a Wireguard VPN
Sergio Giménez Antón edited this page Apr 22, 2023
·
1 revision
Login ssh into server:
Install wireguard:
sudo apt install wireguardMove into the wireguard directory:
sudo su
cd /etc/wireguardCopy the Wireguard config file into a wg0.conf file. To do so, run the following command with your proper wireguard conf file:
echo "
[Interface]
PrivateKey = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Address = 10.0.0.7/24
DNS = 1.1.1.1,1.0.0.1
[Peer]
PublicKey = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
PresharedKey = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
AllowedIPs = 0.0.0.0/0, ::/0
PersistentKeepalive = 25
Endpoint = wg.server.com:51820" > /etc/wireguard/wg0.confNow, enable the wireguard interface wg0, so the server can connect to the VPN.
sudo wg-quick up wg0In Ubuntu 20.04 I found a problem with resolvconf Ref
Creating this simlink solves the error:
ln -s /usr/bin/resolvectl /usr/local/bin/resolvconfIf you’ve added a wg-quick config, e.g. /etc/wireguard/wg0.conf, you can enable autostarting it on system boot using systemd:
sudo systemctl enable --now wg-quick@wg0
If you have started Wireguard with this config manually before, you need to shut it down first or systemd will not be able to start it !