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!

Billboard image

Imagine monitoring that's actually built for developers

Join Vercel, CrowdStrike, and thousands of other teams that trust Checkly to streamline monitor creation and configuration with Monitoring as Code.

Start Monitoring

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

đź‘‹ Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay