WireGuard
Deploy WireGuard, a modern virtual private network (VPN) protocol designed for creating encrypted point-to-point tunnels over the internet.
The WireGuard Quick Deploy App provides two separate applications:
- WireGuard Server. Creates a Linode and sets up a WireGuard network device named
wg0. This device acts as the central hub for your WireGuard network. - WireGuard Client. Creates a Linode that can connect to your WireGuard server. You can deploy multiple clients to connect to the same server.
Note: You can deploy the WireGuard Server and Client apps independently. If you already have the server app running, you can deploy the client app and configure it to connect to your existing server.
1. Deploy WireGuard
Follow the deployment instructions from the Get started section to configure the app, deploy it, and verify software installation.
For information on the app-specific configurations, see the Configuration options section.
Software included
Software installed on your Linode when deploying the app.
Base distribution and plan
- Supported distribution: Ubuntu 24.04 LTS
- Recommended plans: All plan types and sizes can be used. Select a plan appropriate for your expected VPN traffic and number of users.
Configuration options
Configure the required options to deploy your instance. For additional customization, add advanced options.
The table maps the Cloud Manager UI fields to their corresponding API/CLI keys (stackscript_data) required for automated deployments.
WireGuard Server options
StackScript ID: 401706
| UI field | API/CLI key | Description |
|---|---|---|
| Required options | ||
| Limited sudo user | user_name |
Your preferred username for the limited sudo user entered without any capital letters, spaces, or special characters. When adding a limited sudo user, the user is created with a strong generated password for your new Linode instance, and the account is assigned to the sudo group, which provides elevated permissions when running commands with the sudo prefix.
Note: For easier and more secure access with the sudo user, add an account SSH key for the Cloud Manager user during deployment and select that user as an
|
| Advanced options | ||
| Disable root access over SSH | disable_root |
Applies to a limited sudo user. To block the root user from logging in over SSH, select Yes. Defaults to No. Note: When you disable the root user from logging in over SSH and don't provide a valid Account SSH Key assigned to the |
| WireGuard Server Tunnel Address | wireguard_server_address |
The WireGuard server tunnel IP address and subnet in CIDR notation. Defaults to 10.0.0.1/24.This is not the same as a private IP address that Linode can assign to your Linode instance. This address is managed by the network that WireGuard creates. |
| Optional data exporter Add-ons | add_ons | An option to include add-ons for your deployment. Possible values are:
|
WireGuard Client options
StackScript ID: 1914317
| UI field | API/CLI key | Description |
|---|---|---|
| Required options | ||
| Limited sudo user | user_name |
Your preferred username for the limited sudo user entered without any capital letters, spaces, or special characters. When adding a limited sudo user, the user is created with a strong generated password for your new Linode instance, and the account is assigned to the sudo group, which provides elevated permissions when running commands with the sudo prefix.
Note: For easier and more secure access with the sudo user, add an account SSH key for the Cloud Manager user during deployment and select that user as an
|
| WireGuard Server Public Key (Base64) | wireguard_server_public_key |
The public key of your WireGuard server. You can find it in /etc/wireguard/server_public.key on your server instance. |
| WireGuard Server Endpoint (IP:51820) | wireguard_server_endpoint |
The public IP address and port of your WireGuard server in the format IP:PORT. |
| Advanced options | ||
| Disable root access over SSH | disable_root |
Applies to a limited sudo user. To block the root user from logging in over SSH, select Yes. Defaults to No. Note: When you disable the root user from logging in over SSH and don't provide a valid Account SSH Key assigned to the |
| WireGuard Client Tunnel IP (with /32) | wireguard_client_tunnel_ip |
Your WireGuard clientās tunnel IP address with the /32 subnet. Defaults to 10.0.0.2/32. |
| Allowed IPs (comma-separated list) | wireguard_allowed_ips |
A comma-separated list of IP addresses that should be routed through the WireGuard tunnel. Defaults to 10.0.0.1/32. |
| Optional data exporter Add-ons | add_ons | An option to include add-ons for your deployment. Possible values are:
|
Use API, CLI, or Terraform
In addition to deploying the app to a new Linode instance via Cloud Manager, you can also use the Linode API, CLI, or Terraform. When running the operation, you need to provide the StackScript ID, supported Linux distribution, and app-specific fields along with the standard Linode deployment configurations.
Note: Generate a personal access token to authenticate your API, CLI, or Terraform requests.
WireGuard Server
curl --location 'https://api.linode.com/v4/linode/instances' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer abc123def456hij789klm' \
--data-raw '{
"region": "us-east",
"type": "g6-standard-2",
"image": "linode/ubuntu24.04",
"label": "my-wireguard-server-one-click-app",
"root_pass": "@C0mpl3x#P@ssw0rd",
"stackscript_id": 401706,
"stackscript_data": {
"user_name": "jsmith"
}
}'linode-cli linodes create \
--region us-east \
--type g6-standard-2 \
--label my-wireguard-server-one-click-app \
--image linode/ubuntu24.04 \
--root_pass @C0mpl3x#P@ssw0rd \
--stackscript_id 401706 \
--stackscript_data '{"user_name":"jsmith"}'resource "linode_instance" "my-linode" {
region = "us-east"
type = "g6-standard-2"
label = "my-wireguard-server-one-click-app"
image = "linode/ubuntu24.04"
root_pass = "@C0mpl3x#P@ssw0rd"
stackscript_id = 401706
stackscript_data = {
"user_name" = "jsmith"
}
}WireGuard Client
curl --location 'https://api.linode.com/v4/linode/instances' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer abc123def456hij789klm' \
--data-raw '{
"region": "us-east",
"type": "g6-standard-2",
"image": "linode/ubuntu24.04",
"label": "my-wireguard-client-one-click-app",
"root_pass": "@C0mpl3x#P@ssw0rd",
"stackscript_id": 1914317,
"stackscript_data": {
"user_name": "jsmith",
"wireguard_server_public_key": "1+ab23cd45e67FGh890iJklM+123nOpQrs45t6=",
"wireguard_server_endpoint": "123.1.123.0:51820"
}
}'linode-cli linodes create \
--region us-east \
--type g6-standard-2 \
--label my-wireguard-client-one-click-app \
--image linode/ubuntu24.04 \
--root_pass @C0mpl3x#P@ssw0rd \
--stackscript_id 1914317 \
--stackscript_data '{"user_name":"jsmith", "wireguard_server_public_key":"1+ab23cd45e67FGh890iJklM+123nOpQrs45t6=", "wireguard_server_endpoint":"123.1.123.0:51820"}'resource "linode_instance" "my-linode" {
region = "us-east"
type = "g6-standard-2"
label = "my-wireguard-client-one-click-app"
image = "linode/ubuntu24.04"
root_pass = "@C0mpl3x#P@ssw0rd"
stackscript_id = 1914317
stackscript_data = {
"user_name" = "jsmith"
"wireguard_server_public_key" = "1+ab23cd45e67FGh890iJklM+123nOpQrs45t6="
"wireguard_server_endpoint" = "123.1.123.0:51820"
}
}2. Configure WireGuard
Server-side configuration
The WireGuard Server deployment creates these files on the instance:
/etc/wireguard/server_private.key. The serverās private key./etc/wireguard/server_public.key. The serverās public key./etc/wireguard/wg0.conf. The serverās WireGuard configuration file.
The initial wg0.conf looks like this:
[Interface]
PrivateKey = <server-private-key>
Address = <server-tunnel-address>
ListenPort = <listen-port>Client-side configuration
The WireGuard Client deployment creates these files on the instance:
/etc/wireguard/client_private.key. The clientās private key./etc/wireguard/client_public.key. The clientās public key.- /
etc/wireguard/wg0.conf. The clientās WireGuard configuration file.
The initial wg0.conf looks like this:
[Interface]
PrivateKey = <client-private-key>
Address = <client-tunnel-ip>
MTU = 1420
DNS = 8.8.8.8Add clients to a server
To add a new client to your WireGuard server:
-
Deploy a new WireGuard Client instance and copy its public key.
cat /etc/wireguard/client_public.key -
On the WireGuard Server instance, edit its
/etc/wireguard/wg0.conffile.sudo nano /etc/wireguard/wg0.conf -
Add a
[Peer]section with the client public key and allowed client tunnel IP.[Peer] PublicKey = <client-public-key> AllowedIPs = <client-tunnel-ip> -
Restart the WireGuard Service on the server.
sudo systemctl restart wg-quick@wg0 sudo wg-quick down wg0 sudo wg-quick up wg0
Test the connection
To test the connection between your WireGuard Client and Server:
-
From the client instance, ping the serverās tunnel IP.
ping <server-tunnel-ip> -
Check the WireGuard connection status.
The output displays the WireGuard interface and peer status. Verify that the peer is listed and that the
latest handshakeshows a recent time indicating that the client is connected and communicating with the server. Thetransfervalues show the amount of data exchanged through the VPN tunnel.sudo wg showinterface: wg0 public key: <server-public-key> private key: (hidden) listening port: 51820 peer: <client-public-key> endpoint: <client-ip>:<port> allowed ips: <client-tunnel-ip> latest handshake: 1 minute, 17 seconds ago transfer: 98.86 KiB received, 43.08 KiB sent
Additional resources
For more information about the installed packages, see their official documentation.
Note that we can't vouch for the accuracy or timeliness of externally hosted resources.
Updated about 10 hours ago
