How to set up WireGuard VPN on Ubuntu

Last updated on October 4th, 2021 in Setup, VPN

In this tutorial, we will show you how to set up WireGuard VPN on Ubuntu but first let’s see what are our requirements and recommendations.

Generate the Wireguard configuration

  1. Now you need to access Wireguard tab in your package details. Sign in to your Client Area. Then go to  Packages (1) and select your active package (2).
  2. wireguard ubuntu client area details

  3. Once you have accessed your package details click on Wireguard tab
  4. Select the VPN server you want to connect to.
  5. In the field below, you will get the Wireguard configuration for the selected server. Copy the content of the field, you will need it later.

    Important! Keep the PrivateKey a closely guarded secret, do not share it with anyone and do not post it on the Internet. This is your personal key, similar to your private username & password on HideIPVPN.

    wireguard unbuntu config file

Install WireGuard

Open the Terminal app by pressing Ctrl + Alt + T.

If you are using Ubuntu 20, run the following commands to install WireGuard:

 

  1. sudo -i
    then enter your password to login as root.

    wireguard root access

  2. apt-get update
    to make sure your system libraries are up to date and you get the latest Wireguard release version

    wireguard ubuntu library update

  3. apt-get -y install wireguard
    to install Wireguard

     apt-get install wireguard

  4. apt-get install resolvconf
    to handle your dns queries on Wireguard

    wireguard resolvconf

If you are using Ubuntu 18 or earlier, run the following commands to install WireGuard:

add-apt-repository ppa:wireguard/wireguard
apt update
apt install wireguard

Configure WireGuard

  1. Go to the /etc/wireguard folder: cd /etc/wireguard/

    enter wireguard folder

  2. Create the [ServerName].conf file. Replace [ServerName] with the name of the HideIPVPN server you want to use. For example, Los_Angeles.conf. In the example below we used the standard name of a Wireguard config file:

    wireguard create config file

  3. Paste into the [ServerName].conf file the WireGuard configuration generated earlier in your account on our website.

    wireguard hideipvpn config

    Press
    Ctrl + o then press Enter to save the file.
    Press Ctrl + x to close the file.

Connect to VPN using Wireguard

Start the WireGuard interface:

systemctl start wg-quick@wg0

To make sure your interface is up type in console:

ifconfig
and you will see below your configuration file name under network interfaces

To check your external IP address in terminal:

apt update ; apt install curl

curl ifconfig.io

Or access this link in browser to check your current IP

To see the connection status:

systemctl status wg-quick@wg0

 

To disconnect:

systemctl stop wg-quick@wg0
where wg0 is your config name

“WireGuard” is a registered trademark of Jason A. Donenfeld.

« Back

VPN Trial

24 hours
Hide your IP.
Encrypt your traffic.
Enjoy your privacy.
Start Now

Smart DNS Trial

7 days
196 Unblocked websites.
Unlimited devices.
Original ISP speed.
Start Now