How to configure a WireGuard VPN on Ubuntu

Step-by-step instructions

1. Create a VPN server with WireGuard connection protocol

Open the program installation manual

2. Save the WireGuard configuration file from the application

В Ubuntu 20.04 протокол WireGuard включен в ядро системы, поэтому настройка сводится к простому импорту конфигурационного файла.

3. Откройте Параметры системы -> Соединения и нажмите: +

4. В открывшемся окне внизу выберите Импорт из файла

5. В открывшемся окне выбора файла укажите Ваш конфигурационный файл WireGuard. После чего новое соединение wireguard появится в списке доступных подключений.

6. В настройках соединение wireguard можете выбрать Автоматически подключаться к VPN если это необходимо

Подключаться и отключаться Вы можете привычным способом как и к любой другой сети нажатием кнопок Подключить и Отключить. Удалить соединение Вы можете так же как и любое другое.

1. Create a VPN server with WireGuard connection protocol

Open the program installation manual

2. Save the WireGuard configuration file from the application

3. Install WireGuard in Ubuntu

sudo add-apt-repository ppa:wireguard/wireguard && apt-get update && apt-get install wireguard resolvconf -y

4. Copy the settings from the saved WireGuard configuration file to the /etc/wireguard/wg0.conf file

sudo nano /etc/wireguard/wg0.conf

5. Run the interface

sudo wg-quick up wg0

6. Check connection is working (e.g. Whoer.Net)

Your IP on the site should match your VPN server, not the real IP

Add the interface to autoload (if necessary)

sudo systemctl enable wg-quick@wg0

Command to stop the VPN interface

sudo wg-quick down wg0

Command to disable WireGuard startup

sudo systemctl disable wg-quick@wg0

Удалить WireGuard

$ sudo systemctl disable wg-quick@wg0 && apt purge wireguard -y && rm -rf /etc/wireguard