How to set up WireGuard on your Webdock Server

Last updated: November 10th 2022

Introduction

There are many reasons you may want to deploy your own private VPN. One big reason is that many VPN companies sell your VPN logs to law enforcement agencies, so having your own personal VPN will ensure your privacy. You may also have some public admin portals to which you need to restrict access for only the users who have your VPN access.

WireGuard is a free, open source VPN protocol that you can use to deploy your own private VPN. It’s available for every Operating system including Windows, Mac, Linux and other Unix like platforms.

Prerequisites

Know your public IP

To setup WireGuard, you should know the public IP address of your Webdock server.

# curl icanhazip.com

You’ll get your IP Address in response.

Setup WireGuard

Update your Ubuntu and clone the git repository of the WireGuard deployment script.

# sudo apt update && sudo apt upgrade -y
# mkdir vpn && cd vpn
# wget https://git.io/wireguard -O install.sh

Change its permission and run it as sudo. The script will give you a few prompts, choose the options as per your requirement.

# sudo chmod +x install.sh
# sudo ./install.sh
Welcome to this WireGuard road warrior installer!

What port should WireGuard listen to?
Port [51820]: <- Enter or choose a port you like

Enter a name for the first client:
Name [client]: webdock (or some client name you like)

Select a DNS server for the client:
   1) Current system resolvers
   2) Google
   3) 1.1.1.1
   4) OpenDNS
   5) Quad9
   6) AdGuard
DNS server [1]: 3 (Or whatever DNS provider you like)

BoringTun will be installed to set up WireGuard in the system.
Should automatic updates be enabled for it? [Y/n]: Y

WireGuard installation is ready to begin.
Press any key to continue...

After the installation, install a client and scan the QR code as instructed or download the client configuration file as shown in the final message:

█████████████████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████████████████
████ ▄▄▄▄▄ █▀▀▀▄████▄█▀ ▀ █ ▀▀█▄▄ ▄█▄▄▄▄ █▀ ▀█ ▀▀▄ ▀▄ ▀▀▄██▄▀█ ▄▄▄▄▄ ████
████ █   █ █▀▀▄▄ ██▄▄▄ ▀█▀█▀██▀ ▄▀▄▀▀▄█▄▄▀▀██▀▄▄ ▀██▀██ ▀▀ ▀▄█ █   █ ████
████ █▄▄▄█ █▀█▄▄██ ▄█▄ ▄▀▀█▀▄█▀▄█▀ ▄▄▄ █▀▀█  █▄█  ▀▄█▀█ ▄▄▀█▄█ █▄▄▄█ ████
████▄▄▄▄▄▄▄█▄▀ ▀▄▀▄▀▄▀▄█ █▄█ ▀▄▀ █ █▄█ ▀ █ ▀ █▄█▄▀▄█ █ █ █▄▀▄█▄▄▄▄▄▄▄████
████▄▄▄ ▄█▄▄▄▀▀▀▀▄▄ ▄▄ ▄▀ ▄ ▀ ▀ ▀█▄ ▄  ▀█ ▀ ▀▄██▀▀▄▀█▀▄▄▀██ ▀ ▀ ▀▄█ ▀████
████ ▀ ▄▀█▄▀▀▄▄▄  ▀▄▄▀▄▄▄ ▀▄▄█▀▀█▄▄▄█▀█▀▀█ ▄██▄█▀▀█▀▀█▄ ▀█ ▄█ █▀▄▀▄█▄████
█████▀██ █▄█ ▄█ █▀▀█▀█▄▀▀█▀▀▄ ██ ▄ ▀▀▄  ▀█ ▄▄▄▄▀▀▄▄█▄▄ ▄█▄█ ▀██▀▀▄█ █████
█████▄▀▀▄▄▄▀▀▄▄ ▀▄ ▄▀▀▄▀ ▄ ▀██▀ █▄▄█   ▀ █  ▀▀▀██▀██ ▄▀▀▄█ █▄ ▄█▄▄▀█▀████
████▄▄ ▄█▄▄ █▀█▄▀▄▄█▀ ▄▀▄█████▄  █  ▀█  ▀ █▀█▀▄▀▄▄█   ▄▄   █▀▀▄▀▀█▀ ▄████
████▀█▄▄█ ▄▀ ▄ █▀▄▀ █▄█▄ ▀ ▄▄██▀████▀▄█▄▀█▀ █▄▀  ▄▀█▄█▀▄█ ▀▄ ▀██▄ █▄█████
████▀ ██  ▄▀ ▀▀▄█ ▄▄▀▄▀ █▀▄█▄▄▄▄ ▄▄█▀▀▀ ▄▄▀  ▄▀▀▄▀▄▀▄▄▀▀█▀ ▀▄▀▄▄▄█ ▄▄████
██████▄█ ▀▄█ ▄ ▄▀▀▀▄ ▀██▄▄███▀█▀█▄▀▀█▀▄███  ████▀ ▄█ ▄█ ▄▄█▄█▀█ ▄▄█▄▀████
████  █   ▄▀█▀▀ ▄  ▀▀▀██▀█▀█▄█▄█▄▄▄▀▄██▀▄▀█▀▀▀▀▄▀▀▄ █  ▄ ▀▀ ▀██  ██ ▄████
████▄ ▀▄▄█▄ ▀ ▀ █▄█▀▄▀▄█▄  ▄ ▀█▀▀██▄█▀ ▀▀▄█▄██▀▀   █ ▄█▄ ▄█▄█▀▄█  ▄▄█████
█████▄█▀▀▀▄▀▄ █ ▀▄ ▀██▀▄█  ▄ ▄▄ ▀▀▀ ▀▄█ ▀█▄█▄▄█▀▀▀▄  ▄▄ █▄▄ ▀█▄ █▄█▄▄████
████  ▀▄ ▄▄▄ █ ▄▀▀▄▀█▀█▄█▄▀▄ ▀ ▄█▀ ▄▄▄ █ █▄ █ █▀▀ ▄▄ █  ▀▄█  ▄▄▄  ███████
███████  █▄█  ▀▄█▀  ▀▀███  ███▄▄▄▄ █▄█  ▀▄▀ ██ ▄█▄ ▀  ▄▄▀▄▄▀ █▄█   ▀▀████
████▀  ▀  ▄  ▄▄ ▄▀▀  ▀ █▄▄████▄▀  ▄▄▄▄▄ ▄▄█ █▄ ▄▄ █▀▀ ▄ ▀█ ▄▄  ▄ ▀▄█▄████
████ ▀ ▀▀█▄▄▄  ▀▀█▀█▀▀ █▄▄█▀▄ ▄ ██▄▄█▄█▀▄ ▀▀▀ ▄▀█ █▀█ ██▄▀▀ █▄ ▀ ▄▄▄▀████
█████▄█  ▄▄   ▀ ▀  ▀ ▀▄█▄▄█▄█▀▄▀▀▀ ▄   ██▄█ █▄▄▀  ▀▀███▄▄███▀█▀▄▀▀▄  ████
████▄▄ █  ▄▄ █▀▄█  ███  █ ▄█  ▀ ▀▄  █▄▄▀▄▀█▀▀▄▄ ▀██▀▄▄▀▄▄ ▀▀█▄ ▀▀██ ▄████
████▀▄▀ █▄▄▀█▄▄▀██   █▄█▀  ▄ █ ▀██████▄█▄▄▀  █ █▄▀ █ ▄▀ ▀█ ▄█ ▄█▀ ▄█ ████
████ ███  ▄ ████▀▀▄▄▀▀▀▀▀▄ ▀▄█▀▀▀ ▄▄▀▄▄▀▀▀▄▄▄▄█▀██ ▀ ▄ ▄▀▀██▄▄▄█▄█▄▄▄████
████▄█▀▄▄▄▄▀▄█▄█  █▄ ▀█▀ ▄▀▀█▀▄▀▀▄  ▀▄ ██ █▄▄▄ ██ █▄▄▄█▄▀▄ █▄ ▄▄ ▄▀ █████
████▄▀█▄█▀▄ ▀ █▄█▄ ▄██▄ █████▀▄▄▀▀▄ █ ▀▀▀ ▀  ▀ █▀▀▀ ▀▄ █▀▀ ▀▄███▄▀█ █████
████▀▀ ▀▄█▄  ▄▄ ▄ ▀ ▄▄██▀▀ ██▄█▀▀▄ █▄ ▄ ▀██▀██▀█▀ ▀█ █▄▄▄  ▀█████▀█▄█████
████ █▀█▄▄▄▀▀▄ █▀▀███▄▀ ▄▀▄█▀█▀▄▀▀▄█ ▄  ▄▄▀▀▀▄▄ ▄▄█▀▄ █▄▀   █▄ ▄▄█ ▄▄████
████▀█▄ █▄▄█ ▀▄▀ ▀▀▀▀▀█▄ ▄██▀▀█▀  ▀▄▄█▀█ ▄█▄ ▄ ▀▀▀ █ ▄▀▄▄▄█▄█▄▀▄██▄▄ ████
█████▄▄█▄█▄█▀█▄▀█ █ ▄███▀█▀▀▀█▄ █▀ ▄▄▄ ██▀ █▀▄▀▄▀█ ▀▀▄▄▄▄█▀▀ ▄▄▄ ▄▀ ▀████
████ ▄▄▄▄▄ █▄▀▀██▀▀▀▄█▄▄█▄ ▄▄▀ ▀▀▄ █▄█ ▀▀▄█▄▄▄██  ▀█▄█ ▄▀▄ ▀ █▄█ ▄▀▄▀████
████ █   █ █ █ ▀ █ ▀█▀█▄████  ▄█▀█▄▄  ▄▀▄▄ ▄▀ ▀ █▀█   ▄█▀██▄  ▄ ▄█▄ ▄████
████ █▄▄▄█ █ ▄█▀  ▀▀█▀█▄█▄▄█▄▀ ███▄▀▄▀██ ▄▀▄█▄█▀█ ▀█ ██ ▀▄▀ █     █ █████
████▄▄▄▄▄▄▄█▄██▄██▄▄▄█▄█▄█▄▄███▄▄████▄▄▄█▄█▄████▄███▄▄█▄█████▄▄▄▄▄▄██████
█████████████████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████████████████
↑ That is a QR code containing the client configuration.

Finished!

The client configuration is available in: /root/webdock.conf
New clients can be added by running this script again.

Use your VPN

WireGuard client software is available for Android, iOS, Windows, Linux etc.

For Linux, you can simply install it using apt.

sudo apt install wireguard

Download the Client Config File to your Local Machine

You can download the file using Scp, Netcat or Python, but Python way is the easiest.

# cd /root && python3 -m http.server

Sample output:

Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...

Go to your web browser and enter your Webdock server’s Public IP Address with the port number 8000 i.e, http://XX.XX.20.90:8000/, and download the webdock.conf file.

Conclusion

In this article, we’ve successfully set up our own private VPN using Webdock Ubuntu server. If you want to learn more about WireGuard, you can read the official documentation here: https://www.wireguard.com/

As an alternative, if you do not want to set up a VPN yourself there is a wide range of VPN companies which you can use to get a fully managed service.

Related articles

We use cookies. Please see our Privacy Policy.