> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/tutorials/network-services/vpn-gateway/wireguard-vdc-vdc.md).

# Create a WireGuard® Peer Between Two VDCs

Create a WireGuard site-to-site VPN between IONOS CLOUD VDCs in different regions using VPN Gateway.

## Overview

This tutorial demonstrates how to configure the VPN Gateway product in <code class="expression">space.vars.ionos\_cloud</code> to create a WireGuard® based site-to-site setup between two [<mark style="color:blue;">Virtual Data Centers (VDCs)</mark>](https://docs.ionos.com/cloud/support/general-information/glossary-of-terms#virtual-data-center-vdc) in different regions. It uses a managed WireGuard instance in each VDC to provide secure, encrypted connectivity between the two networks.

{% hint style="danger" %}
**Trademark notice:** All references to WireGuard in this guide refer to the WireGuard® protocol and software. WireGuard is a registered trademark of Jason A. Donenfeld.
{% endhint %}

This tutorial demonstrates the use of the following:

| **Components**   | **Description**                                                                                                                                                                          |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Two VDCs         | <p>- Berlin VPN example (<code>de/txl</code>) is the first VDC.<br>- London VPN example (<code>gb/lhr</code>) is the second VDC.</p>                                                     |
| Managed gateways | A managed WireGuard gateway in each VDC (`wg-txl` and `wg-lhr`) provides secure, encrypted connectivity between the two VDCs in <code class="expression">space.vars.ionos\_cloud</code>. |

<figure><picture><source srcset="https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-cc549babc23d2c9128e62c3c9d620b68f5084e80%2Fwireguard-vdc-vdc-architecture-dark.webp?alt=media" media="(prefers-color-scheme: dark)"><img src="https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-e0902802e466ea3442692391249f49a3de2af72f%2Fwireguard-vdc-vdc-architecture-light.webp?alt=media" alt="Architecture diagram showing two IONOS CLOUD VDCs in de/txl and gb/lhr, each with a VPN Gateway, connected by a WireGuard tunnel over the internet on the default UDP port 51820"></picture><figcaption><p>WireGuard site-to-site VPN between two IONOS CLOUD VDCs</p></figcaption></figure>

## Target audience

This tutorial is intended to help both developers and technical decision-makers.

## What you will learn

By following this tutorial, you will learn how to:

* Provision managed WireGuard VPN Gateways in <code class="expression">space.vars.ionos\_cloud</code> across different regions.
* Generate and manage WireGuard key pairs for secure connectivity.
* Set up LAN subnets and assign gateway addresses.
* Configure a VPN peer on each gateway for site-to-site communication.
* Manually add routing rules to enable traffic flow between the two VDCs.
* Verify connectivity between hosts in separate VDCs.

## Before you begin

{% hint style="info" %}
**Note:** This document uses sample keys as examples. The sample keys are shortened for illustration, while real WireGuard keys are 44 characters long. Do not use these keys for real-world scenarios.
{% endhint %}

The following information is necessary to set up a WireGuard connection between two VDCs:

| **Components**                | **Berlin VPN (Left)** `de/txl`       | **London VPN (Right)** `gb/lhr`      |
| ----------------------------- | ------------------------------------ | ------------------------------------ |
| **Datacenter Name**           | `Berlin VPN example`                 | `London VPN example`                 |
| **Gateway Name**              | `wg-txl`                             | `wg-lhr`                             |
| **Gateway Public Address**    | `203.0.113.10`                       | `203.0.113.20`                       |
| **LAN ID**                    | `1`                                  | `2`                                  |
| **LAN Subnet**                | `192.168.1.0/24`                     | `192.168.2.0/24`                     |
| **Gateway LAN Address**       | `192.168.1.5/24`                     | `192.168.2.5/24`                     |
| **LAN Host 1**                | `192.168.1.11` (`berlin-lan-host-1`) | `192.168.2.11` (`london-lan-host-1`) |
| **LAN Host 2**                | `192.168.1.12`                       | `192.168.2.12`                       |
| **WireGuard Subnet**          | `172.16.1.0/30`                      | `172.16.1.0/30`                      |
| **Gateway WireGuard Address** | `172.16.1.1/30`                      | `172.16.1.2/30`                      |
| **Gateway Private Key**       | `abcdefABC12345=`                    | `kHKHABcC+67891=`                    |
| **Gateway Public Key**        | `defDEFhiH/98765=`                   | `lmnoLMNO/89762=`                    |

### Create the VDCs

Ensure you have already created two VDCs, one in `de/txl` and one in `gb/lhr`. Each VDC must contain two virtual servers connected to each other via a private LAN. For more information, see [<mark style="color:blue;">Create a Data Center</mark>](https://docs.ionos.com/cloud/set-up-ionos-cloud/get-started/create-data-center).

### Reserve IP addresses

Before proceeding, ensure you have an IP block with at least one free IP address to assign to each gateway. Each VPN Gateway must be assigned a public IP address. For more information, see [<mark style="color:blue;">Reserve an IPv4 Address</mark>](https://docs.ionos.com/cloud/network-services/vdc-networking/how-tos/ip-addresses).

| **Components**             | **Berlin VPN (Left)** `de/txl` | **London VPN (Right)** `gb/lhr` |
| -------------------------- | ------------------------------ | ------------------------------- |
| **Gateway Public Address** | `203.0.113.10`                 | `203.0.113.20`                  |

### Configure LAN

This tutorial uses `192.168.1.0/24` for the private LAN in Berlin and `192.168.2.0/24` for the private LAN in London. Assign an IP address from each subnet to its respective gateway. For example, use `192.168.1.5` for the Berlin VPN Gateway and `192.168.2.5` for the London VPN Gateway.

The VPN Gateway is not DHCP-aware. Therefore, assign it a static address that is outside the DHCP pool, in the range from `.2` to `.9`.

| **Components**          | **Berlin VPN (Left)** `de/txl` | **London VPN (Right)** `gb/lhr` |
| ----------------------- | ------------------------------ | ------------------------------- |
| **LAN ID**              | `1`                            | `2`                             |
| **LAN Subnet**          | `192.168.1.0/24`               | `192.168.2.0/24`                |
| **Gateway LAN Address** | `192.168.1.5/24`               | `192.168.2.5/24`                |

### WireGuard interface IP address and subnet information

Each participant in a WireGuard VPN setup requires its own WireGuard interface address and subnet, which are unrelated to the networks you use in the cloud. Choose a subnet that does not conflict with anything already in use in the cloud or on the other side of the connection.

This tutorial connects two gateways, so it uses a `/30` subnet. A `/30` provides 2 usable host addresses, one for each gateway.

| **Components**                | **Berlin VPN (Left)** `de/txl` | **London VPN (Right)** `gb/lhr` |
| ----------------------------- | ------------------------------ | ------------------------------- |
| **WireGuard Subnet**          | `172.16.1.0/30`                | `172.16.1.0/30`                 |
| **Gateway WireGuard Address** | `172.16.1.1/30`                | `172.16.1.2/30`                 |

### Generate key pairs

WireGuard requires a key pair for each gateway. You can generate them using the WireGuard utilities or the OpenSSL command-line tools. This tutorial describes both approaches and recommends the WireGuard utilities because the procedure is more straightforward. Generate one key pair for each gateway.

| **Components**          | **Berlin VPN (Left)** `de/txl` | **London VPN (Right)** `gb/lhr` |
| ----------------------- | ------------------------------ | ------------------------------- |
| **Gateway Private Key** | `abcdefABC12345=`              | `kHKHABcC+67891=`               |
| **Gateway Public Key**  | `defDEFhiH/98765=`             | `lmnoLMNO/89762=`               |

{% tabs %}
{% tab title="Use wg utilities" %}
Use `wg genkey` to create the private key and `wg pubkey` to derive the public key content from the private key. You can also perform it via a single command, as shown below. The `umask 077` command ensures that only your user can read the key files. Repeat the process for each gateway.

```bash
umask 077
wg genkey | tee gateway_private_key | wg pubkey > gateway_public_key
cat gateway_private_key
cat gateway_public_key
```

The output shows the private key followed by the public key:

```
abcdefABC12345=
defDEFhiH/98765=
```

{% endtab %}

{% tab title="Use OpenSSL" %}
Use `openssl` to generate `der` keys and convert them to the required format for WireGuard. The `umask 077` command ensures that only your user can read the key files. Repeat the process for each gateway:

```bash
umask 077
openssl genpkey -algorithm X25519 -outform der -out gateway_private.der
openssl pkey -inform der -in gateway_private.der -pubout -outform der -out gateway_public.der
cat gateway_private.der | tail -c 32 | base64 > gateway_private_key
cat gateway_public.der | tail -c 32 | base64 > gateway_public_key
rm *.der
cat gateway_private_key
cat gateway_public_key
```

The output shows the private key followed by the public key:

```
kHKHABcC+67891=
lmnoLMNO/89762=
```

If the WireGuard tools are also available locally, you can verify the OpenSSL-generated key by deriving the public key from the OpenSSL-generated private key.

```bash
wg pubkey < gateway_private_key
```

The output shows the public key:

```
lmnoLMNO/89762=
```

The public key content matches the one generated by OpenSSL.
{% endtab %}
{% endtabs %}

## Procedure

{% stepper %}
{% step %}

### Set up the VDCs

The following screenshot from the [<mark style="color:blue;">Data Center Designer (DCD)</mark>](https://docs.ionos.com/cloud/support/general-information/glossary-of-terms#data-center-designer-dcd) shows the Berlin VDC. It contains two virtual servers that are connected to each other via a private LAN. They have no other connectivity. In this instance, LAN 1 uses a custom subnet of `192.168.1.0/24`. The two LAN hosts use the addresses `192.168.1.11` and `192.168.1.12`.

![Configuring Berlin VDC in the DCD](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-ecc9a510c944cfc858f7677bfd6ea3e97d2842c4%2Ftutorial-wg-vdc-vdc-cloud-setup.png?alt=media)

Set up the London VDC in the same way, using LAN 2 with the custom subnet `192.168.2.0/24`. The two LAN hosts use the addresses `192.168.2.11` and `192.168.2.12`.
{% endstep %}

{% step %}

### Provision the VPN Gateways

Create the Berlin gateway (`wg-txl`) first, and then repeat the procedure for the London gateway (`wg-lhr`) using the values for that site.

1\. In the **DCD**, go to **Menu** > **Network Services** > **VPN Gateway**.

2\. Click **Create VPN Gateway** from the **VPN Gateways** window.

3\. Enter the following details:

{% tabs %}
{% tab title="Properties" %}

| **Components**  | **Description**                                                                                                                    | **Example (Berlin)** | **Example (London)** |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------- | -------------------- | -------------------- |
| **Name**        | Enter a descriptive name for the gateway instance. It is not required to be globally unique but must be limited to 255 characters. | `wg-txl`             | `wg-lhr`             |
| **Description** | Enter a descriptive text for the gateway. It is limited to 1024 characters.                                                        | `Not applicable`     | `Not applicable`     |
| **Location**    | Select a location from the drop-down list of available locations for VPN Gateway.                                                  | `de/txl`             | `gb/lhr`             |
| **IP Address**  | Select an IP address from the drop-down list of available Public IPv4 Addresses.                                                   | `203.0.113.10`       | `203.0.113.20`       |

![Define properties](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-1585cd3a766683da3390f0cf48956500a881ff74%2Ftutorial-wg-vdc-vdc-dcd-properties.png?alt=media)
{% endtab %}

{% tab title="VPN Tier" %}
The **Enhanced VPN** tier is selected by default. The number of LANs and peers differ for each tier. You can also enable **High Availability** for a chosen tier, allowing VMs to operate in an active-passive mode. It minimizes downtime during a failover and ensures an uninterrupted connection.

![Select a tier](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-1d7e7e9c0fe945d63a89b723b333772c6fe691e9%2Ftutorial-wg-vdc-vdc-dcd-tier.png?alt=media)

{% hint style="info" %}
**Note:** You can only upgrade the tier or switch between High Availability (HA) and non-HA variants during editing.
{% endhint %}
{% endtab %}

{% tab title="Protocol" %}
Select **WireGuard** protocol and specify the following:

| **Components**     | **Description**                                                                                                 | **Example (Berlin)** | **Example (London)** |
| ------------------ | --------------------------------------------------------------------------------------------------------------- | -------------------- | -------------------- |
| **Private Key**    | The `gateway_private_key` value generated earlier in this tutorial for this gateway.                            | `abcdefABC12345=`    | `kHKHABcC+67891=`    |
| **Interface IPv4** | The IPv4 address of the WireGuard interface.                                                                    | `172.16.1.1/30`      | `172.16.1.2/30`      |
| **Interface IPv6** | The IPv6 address of the WireGuard interface. This demonstration does not contain IPv6 addresses.                | `Not applicable`     | `Not applicable`     |
| **ListenPort**     | The UDP port on which WireGuard listens for encrypted VPN packets. The tutorial uses the default value `51820`. | `51820`              | `51820`              |

![Select a protocol](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-616740589258c647340b6f642d6f7de5f2cad1fe%2Ftutorial-wg-vdc-vdc-dcd-protocol.png?alt=media)
{% endtab %}

{% tab title="LAN Connections" %}
Attach a VPN Gateway to LANs in <code class="expression">space.vars.ionos\_cloud</code>. You can only connect to LANs in the exact location where the VPN Gateway was provisioned. Take a look at the following mandatory parameters:

| **Components**  | **Description**                                                                                                        | **Example (Berlin)** | **Example (London)** |
| --------------- | ---------------------------------------------------------------------------------------------------------------------- | -------------------- | -------------------- |
| **Datacenter**  | Select a data center from the drop-down that lists VDCs in the same location as the gateway.                           | `Berlin VPN example` | `London VPN example` |
| **Connections** | After selecting a data center, click **Add LAN Connection** to open an additional pop-up window to set the properties. | `See Below`          | `See Below`          |

Enter the following in the **Edit LAN Connection** pop-up window:

| **Components** | **Description**                                                         | **Example (Berlin)** | **Example (London)** |
| -------------- | ----------------------------------------------------------------------- | -------------------- | -------------------- |
| **LAN**        | The ID of the LAN to connect to.                                        | `1`                  | `2`                  |
| **IPv4 CIDR**  | The LAN IPv4 address assigned to the subnet's gateway in CIDR notation. | `192.168.1.5/24`     | `192.168.2.5/24`     |
| **IPv6 CIDR**  | The LAN IPv6 address assigned to the subnet's gateway in CIDR notation. | `Not applicable`     | `Not applicable`     |

![LAN connections](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-4887cb3e14a49d2b79089023ce0d98c21dbaee9e%2Ftutorial-wg-vdc-vdc-dcd-lan.png?alt=media)
{% endtab %}
{% endtabs %}

4\. Click **Save** and wait for the gateway to complete provisioning. The process typically takes about 10-15 minutes, but further operations on the gateway are almost instantaneous. When provisioning completes, the gateway status shows **Available**.
{% endstep %}

{% step %}

### Configure the VPN peers

Now that the VPN Gateway instances are provisioned, configure a peer on each gateway to permit the two sides to communicate with each other. Configure the peer `to_lhr` on `wg-txl` and the peer `to_txl` on `wg-lhr`.

1\. Click **Create Peers** to begin configuring a new peer.

![Configure a peer](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-a18cffced047b3890172d9e8962a0f71aa25158c%2Ftutorial-wg-vdc-vdc-gw.png?alt=media)

{% tabs %}
{% tab title="Properties" %}
Enter the following details to configure a peer:

| **Components**  | **Description**                                                                                          | **Example (on wg-txl)** | **Example (on wg-lhr)** |
| --------------- | -------------------------------------------------------------------------------------------------------- | ----------------------- | ----------------------- |
| **Peer Name**   | Specify a name for the peer. The name is not required to be unique and can be up to 255 characters long. | `to_lhr`                | `to_txl`                |
| **Description** | Enter more descriptive text for the peer, not exceeding 1024 characters.                                 | `Not applicable`        | `Not applicable`        |

![Configure peer properties](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-643d09f302e8fc662821af61acf48e5b57ba1bee%2Ftutorial-wg-vdc-vdc-peer-properties.png?alt=media)
{% endtab %}

{% tab title="Endpoint configuration" %}
Configure the endpoint so the gateway knows with which remote address the connection must be established. Set it to the public IPv4 address of the gateway in the other location.

| **Components**    | **Description**                                                                                                               | **Example (on wg-txl)** | **Example (on wg-lhr)** |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------- | ----------------------- |
| **Endpoint host** | The gateway public IPv4 address of the remote gateway.                                                                        | `203.0.113.20`          | `203.0.113.10`          |
| **Endpoint port** | The endpoint port on which WireGuard listens for incoming encrypted VPN packets. The tutorial uses the default value `51820`. | `51820`                 | `51820`                 |

![Configure endpoint](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-50e55c7c1b699891f00c91719d400cd11d8295b3%2Ftutorial-wg-vdc-vdc-peer-endpoint-config.png?alt=media)
{% endtab %}

{% tab title="Peers configuration" %}
The peers section specifies which networks are permitted across the peer. Specify the LAN subnet of the remote site in CIDR notation, together with the public key of the remote gateway.

| **Components**  | **Description**                                                                                                                                              | **Example (on wg-txl)** | **Example (on wg-lhr)** |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------- | ----------------------- |
| **Allowed IPs** | Enter a comma separated list of subnets in CIDR notation that are permitted to send traffic to the given peer. It is the LAN subnet used on the remote site. | `192.168.2.0/24`        | `192.168.1.0/24`        |
| **Public Key**  | The public key of the remote gateway, as generated earlier in this tutorial.                                                                                 | `lmnoLMNO/89762=`       | `defDEFhiH/98765=`      |

![Configure peer](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-fe95c0806e9a92f7be5784ff0c320e3069b7e4e8%2Ftutorial-wg-vdc-vdc-peerconfig.png?alt=media)
{% endtab %}
{% endtabs %}

2\. Click **Save** to save the peer configuration. This operation typically completes within a few minutes at most. When the operation completes, the gateway status shows **Available**.

3\. Repeat the steps on the `wg-lhr` gateway in London, using the values from the **Example (on wg-lhr)** column.
{% endstep %}

{% step %}

### Configure routing on LAN hosts

You cannot automate adding routes to LAN hosts to route the required subnets over the VPN Gateway. In this section, you manually add the required routes on the LAN hosts in both VDCs.

{% stepper %}
{% step %}
**Configure routing on Berlin LAN hosts**

<details>

<summary><strong>1. Establish a console session to the LAN hosts</strong></summary>

The LAN hosts have no internet access, so the only way to reach them is the web console. Open a console session and run `ping` against the LAN address assigned to the VPN Gateway, `192.168.1.5`:

```bash
root@berlin-lan-host-1:~# ping 192.168.1.5 -c 3
PING 192.168.1.5 (192.168.1.5) 56(84) bytes of data.
64 bytes from 192.168.1.5: icmp_seq=1 ttl=64 time=0.392 ms
64 bytes from 192.168.1.5: icmp_seq=2 ttl=64 time=0.448 ms
64 bytes from 192.168.1.5: icmp_seq=3 ttl=64 time=0.498 ms

--- 192.168.1.5 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2005ms
rtt min/avg/max/mdev = 0.392/0.446/0.498/0.043 ms
```

![Berlin LAN host pinging the gateway LAN address](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-0c815f7f8ff8fa7cbd3b7fd4d295aa078b0201b1%2Ftutorial-wg-vdc-vdc-console-txl.png?alt=media)

</details>

<details>

<summary><strong>2. Configure the VPN route</strong></summary>

The LAN hosts must know where to route traffic destined for London. Add a route for the London subnet `192.168.2.0/24` through the Berlin gateway's LAN address `192.168.1.5`:

```bash
ip route add 192.168.2.0/24 via 192.168.1.5
```

Repeat this process for each LAN host in Berlin.

</details>
{% endstep %}

{% step %}
**Configure routing on London LAN hosts**

<details>

<summary><strong>1. Establish a console session to the LAN hosts</strong></summary>

Open a console session on a London LAN host and run `ping` against the LAN address assigned to the VPN Gateway, `192.168.2.5`:

```bash
root@london-lan-host-1:~# ping -c3 192.168.2.5
PING 192.168.2.5 (192.168.2.5) 56(84) bytes of data.
64 bytes from 192.168.2.5: icmp_seq=1 ttl=64 time=0.978 ms
64 bytes from 192.168.2.5: icmp_seq=2 ttl=64 time=0.403 ms
64 bytes from 192.168.2.5: icmp_seq=3 ttl=64 time=0.371 ms

--- 192.168.2.5 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2018ms
rtt min/avg/max/mdev = 0.371/0.584/0.978/0.278 ms
```

![London LAN host pinging the gateway LAN address](https://3040852435-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpuEvuLJIyhyeRGhmrv1%2Fuploads%2Fgit-blob-cf17442480614e6befe571d4e9da303e8fff80ed%2Ftutorial-wg-vdc-vdc-console-lhr.png?alt=media)

</details>

<details>

<summary><strong>2. Configure the VPN route</strong></summary>

The LAN hosts must know where to route traffic destined for Berlin. Add a route for the Berlin subnet `192.168.1.0/24` through the London gateway's LAN address `192.168.2.5`:

```bash
ip route add 192.168.1.0/24 via 192.168.2.5
```

Repeat this process for each LAN host in London.

</details>
{% endstep %}
{% endstepper %}

{% hint style="info" %}
**Note:** Routes added with `ip route add` do not persist across a restart. To make the routes persistent, use the network configuration tool of your operating system. For examples that use Netplan on Ubuntu and NetworkManager on Rocky Linux and AlmaLinux, see [<mark style="color:blue;">Configure the Guest OS to Use the NAT Gateway</mark>](https://docs.ionos.com/cloud/network-services/nat-gateway/how-tos/configure-guest-os#linux).
{% endhint %}
{% endstep %}

{% step %}

### Final result

You can now test connectivity across the VPN from either side. From a LAN host in Berlin, run `ping` against a LAN host in London (`192.168.2.11`). From a LAN host in London, run `ping` against a LAN host in Berlin (`192.168.1.11`).

{% tabs %}
{% tab title="Test from Berlin to London" %}
On the Berlin LAN host `berlin-lan-host-1`, test connectivity to a London LAN host:

```bash
root@berlin-lan-host-1:~# ping -c 5 192.168.2.11
PING 192.168.2.11 (192.168.2.11) 56(84) bytes of data.
64 bytes from 192.168.2.11: icmp_seq=1 ttl=62 time=18.4 ms
64 bytes from 192.168.2.11: icmp_seq=2 ttl=62 time=18.7 ms
64 bytes from 192.168.2.11: icmp_seq=3 ttl=62 time=18.8 ms
64 bytes from 192.168.2.11: icmp_seq=4 ttl=62 time=18.8 ms
64 bytes from 192.168.2.11: icmp_seq=5 ttl=62 time=18.3 ms

--- 192.168.2.11 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 18.300/18.600/18.800/0.210 ms
```

{% endtab %}

{% tab title="Test from London to Berlin" %}
On the London LAN host `london-lan-host-1`, test connectivity to a Berlin LAN host:

```bash
root@london-lan-host-1:~# ping -c 5 192.168.1.11
PING 192.168.1.11 (192.168.1.11) 56(84) bytes of data.
64 bytes from 192.168.1.11: icmp_seq=1 ttl=62 time=20.3 ms
64 bytes from 192.168.1.11: icmp_seq=2 ttl=62 time=18.3 ms
64 bytes from 192.168.1.11: icmp_seq=3 ttl=62 time=18.3 ms
64 bytes from 192.168.1.11: icmp_seq=4 ttl=62 time=18.3 ms
64 bytes from 192.168.1.11: icmp_seq=5 ttl=62 time=18.4 ms

--- 192.168.1.11 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 18.300/18.720/20.300/0.791 ms
```

{% endtab %}
{% endtabs %}
{% endstep %}
{% endstepper %}

## Conclusion

You have successfully configured two managed WireGuard gateways connected to different VDCs and established a site-to-site VPN connection between them in <code class="expression">space.vars.ionos\_cloud</code>.

## Next steps

* Connect a VDC to an on-premises network, as described in [<mark style="color:blue;">Create a WireGuard® Peer between a VDC and an on-premises Gateway</mark>](https://docs.ionos.com/cloud/tutorials/network-services/vpn-gateway/wireguard-vdc-onprem.md).
* Set up the same VDC-to-VDC connection using IPSec, as described in [<mark style="color:blue;">Create an IPSec Tunnel between two VDCs</mark>](https://docs.ionos.com/cloud/tutorials/network-services/vpn-gateway/ipsec-vdc-vdc.md).
* Download the configuration of your VPN Gateway, as described in [<mark style="color:blue;">Download VPN Gateway Configuration</mark>](https://docs.ionos.com/cloud/network-services/vpn-gateway/dcd-how-tos/download-config).
* Learn more about VPN Gateway features and limits in the [<mark style="color:blue;">VPN Gateway Overview</mark>](https://docs.ionos.com/cloud/network-services/vpn-gateway/overview).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ionos.com/cloud/tutorials/network-services/vpn-gateway/wireguard-vdc-vdc.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
