DEV Community

Cover image for Install and setup WireGuard VPN client on Ubuntu
Armstrong
Armstrong

Posted on

Install and setup WireGuard VPN client on Ubuntu

Follow these steps to install and setup WireGuard VPN client on Ubuntu

Install the WireGuard VPN client

To install the VPN client, you need to run the following command

sudo apt install wireguard
Enter fullscreen mode Exit fullscreen mode

Install ResolvConf

WireGuard relies on resolvconf to manage DNS settings when bringing up the VPN interface

sudo apt install resolvconf -y
Enter fullscreen mode Exit fullscreen mode

Restart the resolveconf service

sudo systemctl restart resolvconf.service
Enter fullscreen mode Exit fullscreen mode

Setup the VPN Configuration file

Move the VPN configuration files to the wireguard directory: /etc/wireguard

mv <location of config file>/<config_file.conf> /etc/wireguard/<config_file.conf>
Enter fullscreen mode Exit fullscreen mode

💡 Ensure that the configuration file has a valid name. That is, no special characters only alpha-numeric characters are allowed. For example: my_vpn or my-vpn is not a valid file name. Instead use myVPN or myvpn or vpn001

Start up the WireGuard interface using the configuration file:

Change your directory to /etc/wireguard

sudo wg-quick up <config_file_name>
Enter fullscreen mode Exit fullscreen mode

Replace <config_file_name> with the actual name of your configuration file (without the .conf extension). For example, if your file is myvpn.conf, the command would be:

sudo wg-quick up myvpn
Enter fullscreen mode Exit fullscreen mode

You can stop the WireGuard VPN client by running the command: wq-quick down

Verify that the VPN client is running:

sudo wg
Enter fullscreen mode Exit fullscreen mode

To stop the WireGuard VPN, run the following commands

sudo wg-quick down <config_file_name>
Enter fullscreen mode Exit fullscreen mode

You should get a similar output as shown in the screenshot attachment below:

Screenshot that verifies that the wireGuard VPN is running

If you followed this tutorial to this point and you get the above result, pat your self on the back. You’ve made it. Now share this to others. Bis später!

Top comments (0)