Skip to main content
On naming convention: in the API Reference, certain legacy documentations, and the Mission Control Portal, WireGuard Gateways are referred to as “Wireguard Interfaces”. In this guide and all guides under the “Networking” collection, the term WireGuard Gateway is used consistently. The devices that connect to it are referred to as WireGuard Peers or simply Peers

Introduction

WireGuard Gateway (WGW) is an element to which peers can connect and form a VPN over the public internet. It’s built on top of the WireGuard implementation.

Creating a WGW

Step 1: Create a Network

Follow this guide.

Step 2: Check for Coverage

Follow this guide. Use filter[available_services][contains]=cloud_vpn to look for a desired site at which to deploy the WGW. ashburn-va is chosen for the subsequent steps.

Step 3: Create a WGW

Using the network created from Step 1 and the chosen region from Step 2, create the WGW.
Once a WGW is created on a specific network, it cannot be “migrated” to another one; it needs to be recreated on the other network. Double check the correct network_id is used in the following API request.
It’s not yet ready to be used immediately after the creation since its status is provisioning.
  • endpoint denotes the publicly routable IP to which peers will connect over the public internet.
  • server_ip_address is the private subnet range the WGW and peers will use with WGW occupying the first usable IP.

Step 4: Wait for Status Transition

The expected time for status to transition to provisioned is approximately 5 minutes. You can poll the WGW to check for status.

Creating Peers

In the following example, a peer is created for the WGW from the previous section.
In the response, you are given the key pair with which to configure your peer. private_key is only given to you ONCE in the creation API response. It must be stored by you.
Simpler still, you may use the following API to obtain the conf file template.
After inserting the private_key, you can import the conf file on the peer.
[Interface] refers to the local peer.
  • PrivateKey should have the value returned in the private_key parameter.
  • Address is the next available IP in the subnet range. In this case, since this is the first peer, it gets the next IP after the WGW.
[Peer] refers to the WGW created previously.
  • PublicKey is that of the WGW
  • AllowedIPs is the network this peer has access to. See this excellent explanation.
  • Endpoint is the publicly exposed IP to which peers can connect
  • PersistentKeepalive is a default parameter that can be ignored.

Configuring Peers

With the conf file, you can import that onto the host. Here are the environment specific guides:

Use Cases

In this section, we introduce 3 use cases that WGW can accommodate by itself.

Use Case 1: Multi-Cloud Network

WGW can be used as a VPN concentrator server to facilitate traffic between peers. In the following example, we will construct this architecture. Multi Cloud Peers
  • Peer in Cloud A is an EC2 instance in AWS.
  • Peer in Cloud B is a Droplet in DigitalOcean.
It will be demonstrated that it’s extremely trivial to set up a “multicloud” network.

Peer in Cloud A

This EC2 instance runs an apache server but only allows inbound SSH traffic. EC2 Peer As a result, it’s unreachable from the public internet.
However, it’s connected to the WGW we created earlier.

Peer in Cloud B

Similarly, this Droplet instance runs an apache server but only allows inbound SSH traffic. Droplet Peer As a result, it’s unreachable from the public internet.
However, it’s connected to the WGW we created earlier.

Cross Cloud Boundary

Despite of the firewall rule configs in the respective environments, Peer 1 is able to talk to Peer 2 over the WireGuard subnet. From Peer 1
From Peer 2
This is readily extensible to peers running web services in various environments.

Use Case 2: Private Access to Other Telnyx Services

If a WGW is created with enable_sip_trunking, the WGW will enable routing for all Telnyx public API endpoints. Private Access On the peer config, additional routes are added under AllowedIPs.
As a result, traffic between a connected peer to Telnyx API, SIP, and Storage services will flow through the WGW (172.27.0.1) onto the Telnyx network as demonstrated below.
This arrangement is extremely useful in the case where we have to lock down public routing in the event of an extreme DDoS attack.

Use Case 3: Cross-Region Network

The previous architecture can be extended to the following one. Cross Regional Network In this example ---
  • Site A is Telnyx Ashburn
  • Site B is Telnyx Amsterdam
  • Cloud A is AWS
  • Cloud B is Digital Ocean
Traffic between the two peers ride the Telnyx backbone between Ashburn and Amsterdam. Coming Soon.

Other use cases

Costs

  • MRC for each WGW instance is $10.
  • Connected Peers are free of charge.

API References