Deploy WireGuard with One-Click Apps
Updated by Linode Contributed by Linode
WireGuard One-Click App
WireGuard is a simple, fast, and modern virtual private network (VPN) which utilizes state-of-the-art cryptography. It aims to be faster and leaner than other VPN protocols such as OpenVPN and IPSec, and it has a much smaller source code footprint.
Configuring WireGuard is as simple as configuring SSH. A connection is established by an exchange of public keys between server and client, and only a client whose public key is present in the server’s configuration file is considered authorized. WireGuard sets up standard network interfaces which behave similarly to other common network interfaces, like
eth0. This makes it possible to configure and manage WireGuard interfaces using standard networking tools such as ifconfig and ip.
The WireGuard One-Click App will create a Linode instance and set up a WireGuard network device named
wg0 on it. This device will have a simple configuration which can send and receive traffic to/from a single WireGuard peer (which will also be referred to as your WireGuard client).
The peer configurations provided by the One-Click App and this guide will allow you to directly connect your WireGuard server and client. This configuration will not enable forwarding of all of your client’s traffic through the WireGuard server to the public Internet (though that arrangement is possible with WireGuard).
Your WireGuard configuration can be adjusted after you first set up your One-Click App; review the WireGuard man page for more information about the options that are available.
Deploy WireGuard with One-Click Apps
One-Click Apps allow you to easily deploy software on a Linode using the Linode Cloud Manager. To access Linode’s One-Click Apps:
Log in to your Linode Cloud Manager account.
From the Linode dashboard, click on the Create button in the top left-hand side of the screen and select Linode from the dropdown menu.
The Linode creation page will appear. Select the One-Click tab.
Under the Select App section, select the app you would like to deploy:
Once you have selected the app, proceed to the app’s Options section and provide values for the required fields.
The WireGuard One-Click form includes fields for your WireGuard client’s public key, and for your client’s endpoint IP (which is your client’s public IP address). If you have already set up your client and installed the WireGuard software on it prior to setting up your WireGuard One-Click App, then you may already have this information. If you do have the key and the endpoint IP for the client, you can enter them into the app’s creation form, and your server’s configuration will be pre-populated with those values.
NotePlease note that a public key generated by WireGuard will not resemble a public key that you might use for SSH connections; when in doubt, leave the form’s Public Key (Client) field blank.
If you do not have the values for these fields, you can leave them empty. After the app is deployed, visit the Configure and Connect your WireGuard Client and Server section to set up your client and generate a key. The instructions in that section will also show you how to insert the key and the endpoint IP for your client into your server’s configuration.
|SSH Key||Your SSH public key. The public key will be stored in the
|Port||Set your WireGuard server’s listening port number. The default is:
|Tunnel IP||Your WireGuard server’s tunnel IP address and subnet in CIDR notation. The default is:
|WireGuard Public Key (Client)||Your WireGuard client’s public key. Advanced Configuration.|
|Tunnel IP (Client)||Your WireGuard client’s tunnel IP address and subnet in CIDR notation. The default is:
|Endpoint IP (Client)||The Internet address of your WireGuard client. If your WireGuard client is another Linode, then the Endpoint IP is the public IP of that Linode, which is visible in the Linode’s dashboard in the Linode Cloud Manager. Advanced Configuration.|
After providing the app-specific options, provide configurations for your Linode server:
|Select an Image||Debian 9 is currently the only image supported by the WireGuard One-Click App, and it is pre-selected on the Linode creation page. Required|
|Region||The region where you would like your Linode to reside. In general, it’s best to choose a location that’s closest to you. For more information on choosing a DC, review the How to Choose a Data Center guide. You can also generate MTR reports for a deeper look at the network routes between you and each of our data centers. Required.|
|Linode Plan||Your Linode’s hardware resources. You can use any size Linode for your WireGuard App. The Linode plan that you select should be appropriate for the amount of data transfer, users, and other stress that may affect the performance of your VPN. You can create your VPN on a Nanode 1GB or a Linode 2GB with low risk for performance hits, unless you expect intensive data transfer to happen on your VPN. Required|
|Linode Label||The name for your Linode, which must be unique between all of the Linodes on your account. This name will be how you identify your server in the Cloud Manager’s Dashboard. Required.|
|Root Password||The primary administrative password for your Linode instance. This password must be provided when you log in to your Linode via SSH. It must be at least 6 characters long and contain characters from two of the following categories: lowercase and uppercase case letters, numbers, and punctuation characters. Your root password can be used to perform any action on your server, so make it long, complex, and unique. Required|
When you’ve provided all required Linode Options, click on the Create button. Your WireGuard app will complete installation anywhere between 2-5 minutes after your Linode has finished provisioning.
Getting Started after Deployment
Configure and Connect your WireGuard Client and Server
After your One-Click App has provisioned your WireGuard server, you can proceed with setting up your WireGuard client and establishing a connection to the server.
If you did not provide a public key for WireGuard when you first set up your One-Click App, you will need to follow the next set of steps. These instructions will set up your client and inform your server of your client’s public key. If you did provide a public key when deploying the One-Click App and have set up your client, skip to the second collection of steps in this section.
Follow the WireGuard Client section of our WireGuard guide to generate a public/private keypair for your client, and to set up the WireGuard network interface configuration on your client.
Bring down the
wg0interface on the server:
wg-quick down wg0
/etc/wireguard/wg0.conffile in a text editor (nano, for example).
You will see a line that reads
PublicKey =under the
[Peer]section. Append your client’s public key to this line.
You will also see a line that reads
Endpoint =. Append your client’s Internet address to this line and then save the file. If your WireGuard client is also a Linode, user your Linode’s public IP. If your client is on your home computer, visit a site like whatismyip.com to get your address.
wg0interface back up on the server:
wg-quick up wg0
wg-quickis a convenient wrapper for many of the common functions in
wg. To learn more about all the available commands for each utility, issue the
wg-quick --helpcommands from your Linode’s command line.
You should now have your server configuration completed. At this point, you still need to complete your client’s configuration; specifically, you need to add your server as a peer to the client:
Just like your client, your server also has a public/private keypair of its own. The One-Click App script leaves a copy of these keys in the root user’s home folder:
catcommand to get the value of the server’s WireGuard public key:
You should see a random string similar to:
Copy the output of your server’s public key, then use it to complete steps 1 and 2 of the Connect the Client and Server section of our WireGuard guide. These steps will tell you to append
[Peer]section to your client’s existing WireGuard configuration and then how to enable the service on your client.
Enter your server’s WireGuard tunnel IP (using the
/24CIDR notation) as the value for the
AllowedIPssetting, and set the server’s public IP address and WireGuard port to be the Endpoint. Here’s an example template for a completed client configuration:
1 2 3 4 5 6 7 8
[Interface] PrivateKey = <Your client WireGuard private key> Address = 10.0.1.2 [Peer] PublicKey = <Your server WireGuard public key> AllowedIPs = 10.0.1.1 Endpoint = <Your WireGuard server public IP>:51820
After you complete steps 1 and 2 from that section, you will have established the server as the client’s peer.
Test your WireGuard Client’s Connection
This test should be performed once you have configured a WireGuard client and updated your WireGuard server to include the client’s peer information:
Access your WireGuard client and ping the WireGuard server. Replace
10.0.1.1with the tunnel IP address you assigned to the WireGuard server in the One-Click App creation form:
Use the WireGuard utility to verify your client’s latest handshake:
The last two lines of the output from running the wg command should be similar to:
latest handshake: 1 minute, 17 seconds ago transfer: 98.86 KiB received, 43.08 KiB sent
|UFW (UncomplicatedFireWall)||Firewall utility. The Port assigned during the WireGuard Options step of the deployment will allow outgoing and incoming traffic.|
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
Join our Community
This guide is published under a CC BY-ND 4.0 license.