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.
Important
You will need an active vpn package. If you don’t have one try our VPN for free
Generate the Wireguard configuration
- 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).
- Once you have accessed your package details click on Wireguard tab
- Select the VPN server you want to connect to.
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.
Install WireGuard
Open the Terminal app by pressing Ctrl + Alt + T.
If you are using Ubuntu 20, run the following commands to install WireGuard:
sudo -i
then enter your password to login as root.
apt-get update
to make sure your system libraries are up to date and you get the latest Wireguard release version
apt-get -y install wireguard
to install Wireguard
-
apt-get install resolvconf
to handle your dns queries on Wireguard
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
- Go to the /etc/wireguard folder: cd /etc/wireguard/
- 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:
- Paste into the [ServerName].conf file the WireGuard configuration generated earlier in your account on our website.
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.