Update Linux WireGuard client instructions (#1407)

This commit is contained in:
David Myers 2019-04-26 00:56:38 -04:00 committed by Jack Ivanov
parent b7a448350a
commit feb0091448

View File

@ -2,38 +2,54 @@
## Install WireGuard ## Install WireGuard
To connect to your Algo VPN using [WireGuard](https://www.wireguard.com) from an Ubuntu Server 16.04 (Xenial) or 18.04 (Bionic) client, first install WireGuard on the client: To connect to your AlgoVPN using [WireGuard](https://www.wireguard.com) from Ubuntu Server, first install WireGuard:
```shell ```shell
# Add the WireGuard repository: # Add the WireGuard repository:
sudo add-apt-repository ppa:wireguard/wireguard sudo add-apt-repository ppa:wireguard/wireguard
# Update the list of available packages (not necessary on Bionic): # Update the list of available packages (not necessary on Bionic or later):
sudo apt update sudo apt update
# Install the tools and kernel module: # Install the tools and kernel module:
sudo apt install wireguard sudo apt install wireguard
``` ```
(For installation on other Linux distributions, see the [Installation](https://www.wireguard.com/install/) page on the WireGuard site.) For installation on other Linux distributions, see the [Installation](https://www.wireguard.com/install/) page on the WireGuard site.
## Locate the Config File ## Locate the Config File
The Algo-generated config files for WireGuard are named `configs/<ip_address>/wireguard/<username>.conf` on the system where you ran `./algo`. One file was generated for each of the users you added to `config.cfg` before you ran `./algo`. Each Linux and Android client you connect to your Algo VPN must use a different WireGuard config file. Choose one of these files and copy it to your Linux client. The Algo-generated config files for WireGuard are named `configs/<ip_address>/wireguard/<username>.conf` on the system where you ran `./algo`. One file was generated for each of the users you added to `config.cfg`. Each WireGuard client you connect to your AlgoVPN must use a different config file. Choose one of these files and copy it to your Linux client.
If your client is running Bionic (or another Linux that uses `systemd-resolved` for DNS) you should first edit the config file. Comment out the line that begins with `DNS =` and replace it with: ## Configure DNS
### Ubuntu 18.04 (Bionic)
If your client is running Bionic (or another Linux that uses `systemd-resolved` for DNS but does not have `resolvectl` or `resolvconf` installed) you should first edit the config file. Comment out the line that begins with `DNS =` and replace it with:
``` ```
PostUp = systemd-resolve -i %i --set-dns=172.16.0.1 --set-domain=~. PostUp = systemd-resolve -i %i --set-dns=172.16.0.1 --set-domain=~.
``` ```
Use the IP address shown on the `DNS =` line (for most, this will be `172.16.0.1`). If the `DNS =` line contains multiple IP addresses, use multiple `--set-dns=` options. Use the IP address shown on the `DNS =` line (for most, this will be `172.16.0.1`). If the `DNS =` line contains multiple IP addresses, use multiple `--set-dns=` options.
### Ubuntu 18.10 (Cosmic) or 19.04 (Disco)
If your client is running Cosmic or Disco (or another Linux that uses `systemd-resolved` for DNS and has `resolvectl` but *not* `resolvconf` installed) you can either edit the config file as shown above for Bionic or run the following command once:
```
sudo ln -s /usr/bin/resolvectl /usr/bin/resolvconf
```
### Other Linux Distributions
On other Linux distributions you might need to install the `openresolv` package.
## Configure WireGuard ## Configure WireGuard
Finally, install the config file on your client as `/etc/wireguard/wg0.conf` and start WireGuard: Finally, install the config file on your client as `/etc/wireguard/wg0.conf` and start WireGuard:
```shell ```shell
# Install the config file to the WireGuard configuration directory on your # Install the config file to the WireGuard configuration directory on your
# Bionic or Xenial client: # Linux client:
sudo install -o root -g root -m 600 <username>.conf /etc/wireguard/wg0.conf sudo install -o root -g root -m 600 <username>.conf /etc/wireguard/wg0.conf
# Start the WireGuard VPN: # Start the WireGuard VPN:
@ -52,4 +68,4 @@ curl ipv4.icanhazip.com
sudo systemctl enable wg-quick@wg0 sudo systemctl enable wg-quick@wg0
``` ```
(If your Linux distribution does not use `systemd`, you can bring up WireGuard with `sudo wg-quick up wg0`). If your Linux distribution does not use `systemd` you can bring up WireGuard with `sudo wg-quick up wg0`.