How to manually configure WireGuard on Linux (2024)

WireGuard® is a fast, lightweight, and secure VPN protocol.

Learn more about WireGuard

We offer a GUI app and CLI tool for Linux. These include a kill switch, but currently support the OpenVPN protocol only (not WireGuard).

It’s possible to manually configure WireGuard on Linux using third-party clients. In this guide, we’ll show you how to configure WireGuard on any Linux distribution using the official WireGuard CLI tool for Linux, and on Debian and Ubuntu-based systems using NetworkManager.

  • WireGuard CLI
  • NetworkManager

An advantage of manually configuring WireGuard on Linux is that our WireGuard config files support port forwarding.

How to manually configure WireGuard on Linux

1. Install the official WireGuard VPN CLI tool for your distribution.

2. Sign in to account.protonvpn.com, go to DownloadsWireGuard configuration, and download a WireGuard configuration file. Note that WireGuard can be picky about the length of .conf names, so please ensure the the downloaded .conf file name is under 15 characters (you may need to rename the default suggested name to achieve this).

Learn how to download a WireGuard configuration file from Proton VPN

3. Move the downloaded .conf configuration file to the /etc/wireguard/ directory.

4. In a terminal window, enter:

sudo wg-quick up [the name of the configuration file, excluding the .conf suffix]

For example, if your configuration file is named swiss1-CH-5.conf, enter:

sudo wg-quick up swiss1-CH-5
How to manually configure WireGuard on Linux (1)

Your privacy is now protected by Proton VPN! To verify that the connection is running, enter:

sudo wg

You can also visit ip.me to confirm that everything is working correctly.

How to manually configure WireGuard on Linux (2)

To end the VPN session, enter:

sudo wg-quick down [the name of the configuration file, excluding the .conf suffix]

For example:

sudo wg-quick down swiss1-CH-5

How to use WireGuard with NetworkManager on Ubuntu

This guide was created on Ubuntu 20.04 LTS, but should work on most Debian and Ubuntu-based distros.

1. Open a terminal window from your Home directory and install WireGuard using the following command:

sudo apt install wireguard git dh-autoreconf libglib2.0-dev intltool build-essential libgtk-3-dev libnma-dev libsecret-1-dev network-manager-dev resolvconf

2. Sign in to account.protonvpn.com, go to DownloadsWireGuard configuration, and download a WireGuard configuration file.

Learn how to download a WireGuard configuration file from Proton VPN

3. Clone the NetworkManager plugin from GitHub, compile, and install it using the following commands:

git clone https://github.com/max-moser/network-manager-wireguard
cd network-manager-wireguard
./autogen.sh --without-libnm-glib
./configure --without-libnm-glib --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib/x86_64-linux-gnu --libexecdir=/usr/lib/NetworkManager --localstatedir=/var
make
sudo make install

4. Open NetworkManagerVPN+.

How to manually configure WireGuard on Linux (3)

5. If the WireGuard option is not available, restart your computer and try again. If it is, select Import from file…

How to manually configure WireGuard on Linux (4)

6. Locate the .conf configuration file you downloaded in step 2 using your file manager and click Add.

How to manually configure WireGuard on Linux (5)

7. Configuration is now complete. In NetworkManager, simply toggle the VPN switch next to the WireGuard connection you just created to on.

How to manually configure WireGuard on Linux (6)

You are now connected to ProtonVPN using the WireGuard protocol. Visit ip.me to confirm that the VPN connection is working correctly.

How to manually configure WireGuard on Linux (7)
How to manually configure WireGuard on Linux (2024)

FAQs

How to manually configure WireGuard? ›

I have a key pair
  1. Go to Surfshark's login page and log in. Then, visit VPN > Manual setup. Choose the Desktop or mobile option and click on WireGuard.
  2. In the next window, click on I have a key pair.
  3. Name your key pair and click Next.
  4. Enter your public key and hit Save.
Jun 19, 2024

How to setup WireGuard VPN on Linux? ›

Open NetworkManager → VPN → +.
  1. If the WireGuard option is not available, restart your computer and try again. If it is, select Import from file…
  2. Locate the . ...
  3. Configuration is now complete. ...
  4. You are now connected to ProtonVPN using the WireGuard protocol.

How to get config file for WireGuard? ›

To get the config, first select the Location you want to connect to. Then choose a Port (use 443 if you're unsure). Now select New Key Pair (or use an existing key pair if you have them). And finally, press Download Config to get the WireGuard configuration file.

How to setup WireGuard VPN server at home? ›

  1. Step 1: Expose Wireguard VPN Server to the Internet. Your Public IP Address. ...
  2. Step 2: Setup Wireguard VPN Server. Install the wireguard software and dependencies. ...
  3. Step 3: Setup client connections. ...
  4. Step 4: Setup clients. ...
  5. Step 5: Test Connection.
Sep 29, 2023

Is WireGuard easy to setup? ›

Simple & Easy-to-use

WireGuard aims to be as easy to configure and deploy as SSH. A VPN connection is made simply by exchanging very simple public keys – exactly like exchanging SSH keys – and all the rest is transparently handled by WireGuard. It is even capable of roaming between IP addresses, just like Mosh.

Which is more secure, WireGuard or OpenVPN? ›

The biggest notable differences between WireGuard and OpenVPN are speed and security. While WireGuard is generally faster, OpenVPN provides heavier security. The differences between these two protocols are also what make up their defining features.

How to configure VPN in Linux server step by step? ›

Set Up a Linux VPN Server With Hostinger OpenVPN VPS Template
  1. Log in to hPanel and click VPS on the top menu.
  2. Select the VPS you want to install OpenVPN on.
  3. Navigate to the sidebar → OS & Templates → Operating System.
  4. Click Applications.
  5. Select Ubuntu 22.04 64bit with OpenVPN from the drop-down menu and click Change OS.
Mar 20, 2024

How to configure WireGuard client in Ubuntu? ›

In this tutorial, we will set up WireGuard VPN client on a Ubuntu Server/Desktop using nmcli .
  1. Install WireGuard. ...
  2. Import WireGuard Connection Configuration File. ...
  3. Test WireGuard VPN Connection. ...
  4. Connect/Disconnect from WireGuard VPN. ...
  5. Modify WireGuard VPN Connection Settings. ...
  6. Modify WireGuard VPN Connection Settings using GUI.

How to tell if WireGuard is working? ›

To check if WireGuard Server is working properly

Enable the connection, check if the phone has Internet access and whether its IP address is the IP of your WireGuard Server. There are several common reasons cause failed: The Internet Service Provider doesn't assign you a public IP address, please check here.

What port does WireGuard config listen to? ›

The default port is 51820 , additional tunnels must use a different port. The GUI will automatically suggest the next highest available port.

Does WireGuard need static IP? ›

We recommend obtaining a static IP address from your ISP, or configuring a Dynamic DNS to avoid these interruptions."

Does WireGuard use TCP or UDP? ›

Networking. WireGuard uses only UDP, due to the potential disadvantages of TCP-over-TCP. Tunneling TCP over a TCP-based connection is known as "TCP-over-TCP", and doing so can induce a dramatic loss in transmission performance (a problem known as "TCP meltdown").

How do I manually set a WireGuard? ›

In the VPN section, tap Manual setup, select Desktop or mobile, and WireGuard. In the next window, tap on I have a key pair. Enter a name for your key pair and tap Next. Enter your public key and hit Save.

How to install and configure WireGuard VPN on Linux? ›

Installing and Configuring WireGuard on the server
  1. Connect to your Instance via SSH.
  2. Install Linux kernel headers and WireGuard. sudo apt update && apt upgrade -y. sudo apt install linux-headers-$(uname --kernel-release) # installs the right kernel headers for your version. sudo apt install wireguard.
Mar 28, 2019

What is the file extension for WireGuard config? ›

WireGuard config is in INI syntax, defined in a file usually called wg0. conf .

How to set up WireGuard on router? ›

Set up WireGuard VPN Server on Your Router

Go to Advanced > VPN Server > WireGuard, and tick the Enable box of WireGuard. 3. View the default WireGuard VPN settings, as shown above. The parameters are automatically filled in, and do NOT change them unless necessary.

How do I activate the tunnel in WireGuard? ›

Start or Stop WireGuard Tunnel on Windows

msc . Click “Yes” to any security warning. Scroll down to the bottom and you will see the available WireGuard tunnels. Right-click and select Start or Stop, as appropriate.

How to set up WireGuard for remote access? ›

Create the Wireguard Setup on your Internal Network
  1. Enter a unique Name for this Interface.
  2. Enter a Description (optional)
  3. Check Enabled.
  4. Enter the IP Address to be used for this Wireguard Internal Network. ...
  5. Enter the Listen Port to be used when connecting to the VPN (Default: 51820).

Top Articles
Latest Posts
Article information

Author: Madonna Wisozk

Last Updated:

Views: 5957

Rating: 4.8 / 5 (68 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Madonna Wisozk

Birthday: 2001-02-23

Address: 656 Gerhold Summit, Sidneyberg, FL 78179-2512

Phone: +6742282696652

Job: Customer Banking Liaison

Hobby: Flower arranging, Yo-yoing, Tai chi, Rowing, Macrame, Urban exploration, Knife making

Introduction: My name is Madonna Wisozk, I am a attractive, healthy, thoughtful, faithful, open, vivacious, zany person who loves writing and wants to share my knowledge and understanding with you.