Guides - Deploy WireGuard through the Linode Marketplace
Quickly deploy a Compute Instance with many various software applications pre-installed and ready to use.
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 Marketplace 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 Marketplace 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 Marketplace App; review the WireGuard man page for more information about the options that are available.
The Linode Marketplace allows you to easily deploy software on a Compute Instance using the Cloud Manager. See Get Started with Marketplace Apps for complete steps.
Log in to the Cloud Manager and select the Marketplace link from the left navigation menu. This displays the Linode Create page with the Marketplace tab pre-selected.
Under the Select App section, select the app you would like to deploy.
Complete the form by following the steps and advice within the Creating a Compute Instance guide. Depending on the Marketplace App you selected, there may be additional configuration options available. See the Configuration Options section below for compatible distributions, recommended plans, and any additional configuration options available for this Marketplace App.
Click the Create Linode button. Once the Compute Instance has been provisioned and has fully powered on, wait for the software installation to complete. If the instance is powered off or restarted before this time, the software installation will likely fail.
To verify that the app has been fully installed, see Get Started with Marketplace Apps > Verify Installation. Once installed, follow the instructions within the Getting Started After Deployment section to access the application and start using it.
- Supported distributions: Ubuntu 22.04 LTS
- Recommended minimum plan: All plan types and sizes can be used. The 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.
The WireGuard Marketplace 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 Marketplace 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.
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.
- 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:
10.0.1.1/24. This is not the same as a private IP address that Linode can assign to your Linode instance; instead, this address is managed by the network that WireGuard creates.
- WireGuard Public Key (Client): Your WireGuard client’s public key.
- Tunnel IP (Client): Your WireGuard client’s tunnel IP address and subnet in CIDR notation. The default is:
10.0.1.2/24. This is not the same as a private IP address that Linode can assign to your Linode instance; instead, this address is managed by the network that WireGuard creates.
- 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.
After your Marketplace 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 Marketplace 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 Marketplace 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 Marketplace 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/24 [Peer] PublicKey = <Your server WireGuard public key> AllowedIPs = 10.0.1.1/24 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.
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 Marketplace 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
|Firewall utility. The Port assigned during the WireGuard Options step of the deployment will allow outgoing and incoming traffic.
“WireGuard” is a registered trademark of Jason A. Donenfeld.
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.
This page was originally published on