---
updatedAt: 2026-09-28T08:45:27.000Z
agentTools:
  siteIndex: https://techdocs.akamai.com/llms.txt
  projectIndex: https://techdocs.akamai.com/quick-deploy-apps/llms.txt
---

# WireGuard

Deploy [WireGuard](https://www.wireguard.com/), 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

<div class="aligned">
   <img src="https://techdocs.akamai.com/terraform-images/img/clock.png" alt="" height="25" width="25" />
   <span class="span-header">&nbsp;Estimated deployment time:</span><span>&nbsp;2–5 minutes</span>
</div>

<div><p></p></div>

Follow the [deployment instructions](https://techdocs.akamai.com/quick-deploy-apps/docs/get-started) 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](#configuration-options) section.

### Software included

Software installed on your Linode when deploying the app.

| Package                          | Description                                                                                       |
| -------------------------------- | ------------------------------------------------------------------------------------------------- |
| **WireGuard**                    | A VPN software used to create encrypted network tunnels.                                          |
| **UFW (Uncomplicated Firewall)** | A firewall utility. The port assigned during the deployment allows outgoing and incoming traffic. |

### 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`

<table>
  <thead>
    <tr>
      <th>UI field</th>
      <th>API/CLI key</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td colspan="3">Required options</td>
    </tr>
    <tr>
      <td><b>Limited sudo user</b></td>
      <td><code>user_name</code></td>
      <td>Your preferred username for the limited sudo user entered without any capital letters, spaces, or special characters.<br /> 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 <code>sudo</code> group, which provides elevated permissions when running commands with the <code>sudo</code> prefix.
        <blockquote>
          <b>Note:</b> For easier and more secure access with the sudo user, add an <a href="https://techdocs.akamai.com/cloud-computing/docs/manage-ssh-keys">account SSH key</a> for the Cloud Manager user during deployment and select that user as an <code>authorized_user</code>. Their SSH pubkey will be assigned to both the root and limited user.
        </blockquote>
      </td>
    </tr>
    <tr>
      <td colspan="3">Advanced options</td>
    </tr>
    <tr>
      <td><b>Disable root access over SSH</b></td>
      <td><code>disable_root</code></td>
      <td><i>Applies to a limited sudo user.</i> To block the root user from logging in over SSH, select <i>Yes</i>. Defaults to <i>No</i>. <br />
        <blockquote>
          <b>Note:</b> When you disable the root user from logging in over SSH and don't provide a valid Account SSH Key assigned to the <code>authorized_user</code>, you can still switch to the root user. To do that, log in as root via the <a href="https://techdocs.akamai.com/cloud-computing/docs/access-your-system-console-using-lish">Lish console</a> and run <code>cat /home/$USERNAME/.credentials</code> to view the generated password for the limited sudo user.
        </blockquote>
      </td>
    </tr>
    <tr>
      <td><b>WireGuard Server Tunnel Address</b></td>
      <td><code>wireguard_server_address</code></td>
      <td>The WireGuard server tunnel IP address and subnet in CIDR notation. Defaults to <code>10.0.0.1/24</code>.<br />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.</td>
    </tr>
    <tr><td><b>Optional data exporter Add-ons</b></td><td><code>add_ons</code></td><td>An option to include add-ons for your deployment. Possible values are:
        <ul>
          <li><i>none</i> (default)</li>
          <li><i>node_exporter</i></li>
          <li><i>mysqld_exporter</i></li>
          <li><i>newrelic</i></li>
      </ul></td></tr>
  </tbody>
</table>

#### WireGuard Client options

**StackScript ID:** `1914317`

<table>
  <thead>
    <tr>
      <th>UI field</th>
      <th>API/CLI key</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td colspan="3">Required options</td>
    </tr>
    <tr>
      <td><b>Limited sudo user</b></td>
      <td><code>user_name</code></td>
      <td>Your preferred username for the limited sudo user entered without any capital letters, spaces, or special characters.<br /> 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 <code>sudo</code> group, which provides elevated permissions when running commands with the <code>sudo</code> prefix.
        <blockquote>
          <b>Note:</b> For easier and more secure access with the sudo user, add an <a href="https://techdocs.akamai.com/cloud-computing/docs/manage-ssh-keys">account SSH key</a> for the Cloud Manager user during deployment and select that user as an <code>authorized_user</code>. Their SSH pubkey will be assigned to both the root and limited user.
        </blockquote>
      </td>
    </tr>
    <tr>
      <td><b>WireGuard Server Public Key (Base64)</b></td>
      <td><code>wireguard_server_public_key</code></td>
      <td>The public key of your WireGuard server. You can find it in <code>/etc/wireguard/server_public.key</code> on your server instance.</td>
    </tr>
    <tr>
      <td><b>WireGuard Server Endpoint (IP:51820)</b></td>
      <td><code>wireguard_server_endpoint</code></td>
      <td> The public IP address and port of your WireGuard server in the format <code>IP:PORT</code>.</td>
    </tr>
    <tr>
      <td colspan="3">Advanced options</td>
    </tr>
    <tr>
      <td><b>Disable root access over SSH</b></td>
      <td><code>disable_root</code></td>
      <td><i>Applies to a limited sudo user.</i> To block the root user from logging in over SSH, select <i>Yes</i>. Defaults to <i>No</i>. <br />
        <blockquote>
          <b>Note:</b> When you disable the root user from logging in over SSH and don't provide a valid Account SSH Key assigned to the <code>authorized_user</code>, you can still switch to the root user. To do that, log in as root via the <a href="https://techdocs.akamai.com/cloud-computing/docs/access-your-system-console-using-lish">Lish console</a> and run <code>cat /home/$USERNAME/.credentials</code> to view the generated password for the limited sudo user.
        </blockquote>
      </td>
    </tr>
    <tr>
      <td><b>WireGuard Client Tunnel IP (with /32)</b></td>
      <td><code>wireguard_client_tunnel_ip</code></td>
      <td> Your WireGuard client’s tunnel IP address with the <code>/32</code> subnet. Defaults to <code>10.0.0.2/32</code>.</td>
    </tr>
    <tr>
      <td><b>Allowed IPs (comma-separated list)</b></td>
      <td><code>wireguard_allowed_ips</code></td>
      <td>A comma-separated list of IP addresses that should be routed through the WireGuard tunnel. Defaults to <code>10.0.0.1/32</code>.</td>
    </tr>
    <tr><td><b>Optional data exporter Add-ons</b></td><td><code>add_ons</code></td><td>An option to include add-ons for your deployment. Possible values are:
        <ul>
          <li><i>none</i> (default)</li>
          <li><i>node_exporter</i></li>
          <li><i>mysqld_exporter</i></li>
          <li><i>newrelic</i></li>
      </ul></td></tr>
  </tbody>
</table>

### 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](#configuration-options) along with the standard Linode deployment configurations.

> **Note:** [Generate a personal access token](https://techdocs.akamai.com/linode-api/reference/get-started#personal-access-tokens) to authenticate your [API](https://techdocs.akamai.com/linode-api/reference/api), [CLI](https://techdocs.akamai.com/cloud-computing/docs/cli-1), or [Terraform](https://registry.terraform.io/providers/linode/linode/latest/docs) requests.

#### WireGuard Server

```bash API
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"
    }
  }'
```
```bash CLI
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"}'
```
```json Terraform
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

```bash API
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"
    }
  }'
```
```bash CLI
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"}'
```
```json Terraform
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:

```bash
[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:

```bash
[Interface]
PrivateKey = <client-private-key>
Address = <client-tunnel-ip>
MTU = 1420
DNS = 8.8.8.8
```

### Add clients to a server

To add a new client to your WireGuard server:

1. Deploy a new WireGuard Client instance and copy its public key.

   ```bash
   cat /etc/wireguard/client_public.key
   ```

2. On the WireGuard Server instance, edit its `/etc/wireguard/wg0.conf` file.

   ```bash
   sudo nano /etc/wireguard/wg0.conf
   ```

3. Add a `[Peer]` section with the client public key and allowed client tunnel IP.

   ```bash
   [Peer]
   PublicKey = <client-public-key>
   AllowedIPs = <client-tunnel-ip>
   ```

4. Restart the WireGuard Service on the server.

   ```bash
   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:

1. From the client instance, ping the server’s tunnel IP.

   ```bash
   ping <server-tunnel-ip>
   ```

2. Check the WireGuard connection status.

   The output displays the WireGuard interface and peer status. Verify that the peer is listed and that the `latest handshake` shows a recent time indicating that the client is connected and communicating with the server. The `transfer` values show the amount of data exchanged through the VPN tunnel.

   ```bash Command
   sudo wg show
   ```
   ```bash Output
    interface: 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.

* [WireGuard Quick Start](https://www.wireguard.com/quickstart/)
* [WireGuard Conceptual Overview](https://www.wireguard.com/#conceptual-overview)
* [WireGuard Man Page](https://manpages.debian.org/unstable/wireguard-tools/wg.8.en.html)

> 📘
>
> Note that we can't vouch for the accuracy or timeliness of externally hosted resources.

# Sibling pages

* [BeEF](https://techdocs.akamai.com/quick-deploy-apps/docs/beef.md)
* [Haltdos Community WAF](https://techdocs.akamai.com/quick-deploy-apps/docs/haltdos-community-waf.md)
* [HashiCorp Vault](https://techdocs.akamai.com/quick-deploy-apps/docs/hashicorp-vault.md)
* [Kali Linux](https://techdocs.akamai.com/quick-deploy-apps/docs/kali-linux.md)
* [OpenBao](https://techdocs.akamai.com/quick-deploy-apps/docs/openbao.md)
* [OpenVPN](https://techdocs.akamai.com/quick-deploy-apps/docs/openvpn.md)
* [Passbolt Community Edition](https://techdocs.akamai.com/quick-deploy-apps/docs/passbolt-community-edition.md)
* [Pi-hole](https://techdocs.akamai.com/quick-deploy-apps/docs/pi-hole.md)
* [Pritunl](https://techdocs.akamai.com/quick-deploy-apps/docs/pritunl.md)
* [Secure Your Server](https://techdocs.akamai.com/quick-deploy-apps/docs/secure-your-server.md)
* [Shadowsocks](https://techdocs.akamai.com/quick-deploy-apps/docs/shadowsocks.md)
* [Wazuh](https://techdocs.akamai.com/quick-deploy-apps/docs/wazuh.md)