VPN gateways, from the edge inward
A VPN gateway is the device or service at the edge of a network that terminates VPN tunnels. This guide explains the types, how to size one, and how to make it highly available. It also explains why a gateway that listens on a public IP is a risk.
The client finds the gateway
The VPN client connects to a public address. The firewall keeps one port open for that purpose.
The gateway accepts the tunnel
The VPN gateway answers each connection from the internet, before it knows who the sender is.
The gateway checks the user
The gateway asks the identity provider to authenticate the user, and then makes the keys for the tunnel.
The gateway forwards traffic
The gateway decrypts each packet and sends it to the private network.
What a VPN gateway is
A VPN gateway is the endpoint of a VPN tunnel on the network side. A device or a second network sends encrypted traffic to it. The gateway authenticates the sender, decrypts the traffic, and forwards it to hosts in the private network. It encrypts the replies and sends them back.
The gateway sits at the edge of the network, with one interface on each side. It can be a hardware appliance, a virtual machine, a feature of a firewall or a router, or a service from a cloud provider.
A VPN concentrator is a VPN gateway that is built for a large number of tunnels. The two terms describe the same job.
The types of VPN gateway
Remote access
A remote access VPN gateway accepts tunnels from the devices of users. Each device runs a client, and the user signs in. The gateway gives the device an address and a set of routes. The protocols are usually IPsec with IKEv2, TLS, or WireGuard.
Site-to-site
A site-to-site VPN gateway holds a permanent tunnel to a gateway in a different network. The hosts on each side run no client. The protocol is usually IPsec. One device frequently does the remote access job and the site-to-site job together.
Cloud-managed
A cloud VPN gateway is a service that a cloud provider runs at the edge of your virtual network. The provider operates the gateway, and you configure the tunnels. It connects an office to the cloud, and some providers also give remote access.
How to size a VPN gateway
Encryption uses CPU, so the CPU usually sets the limit of a VPN gateway. Four numbers matter.
- Throughput with encryption on. A data sheet gives the firewall throughput and the VPN throughput. Use the VPN number, which is much lower.
- Concurrent tunnels. Count the users or sites that connect at the same time. Many appliances also limit this number with a license.
- Peak, not average. Size for Monday at 09:00, and for the day when all people work from home.
- The link. All users share the uplink of the gateway. A fast gateway on a slow link is a slow gateway.
The tunnel design changes the load. A full tunnel sends all the internet traffic of each user through the gateway. A split tunnel sends only the traffic for private networks, which is much less.
High availability for a VPN gateway
One VPN gateway is a single point of failure. When it stops, each remote user and each remote site loses access. Three designs are common.
- Active and standby. Two gateways share one virtual address. The standby takes the address when the active gateway fails. The standby does no work until that moment.
- Active and active. A load balancer or DNS spreads clients across two or more gateways. All the gateways do work, and the capacity grows with each one.
- More than one location. Gateways in different regions protect against the loss of a site and put a gateway near each user.
High availability also covers maintenance. With one gateway, each software upgrade is an outage. With three, you can upgrade one at a time and keep spare capacity.
The weakness of a public listener
A traditional VPN gateway must accept connections from any address on the internet, because users connect from any network. The gateway has a public IP address and an open port, and it answers before it knows who the sender is.
This design has three results.
- Each scanner on the internet can find the gateway. The vendor and the software version are frequently visible.
- A vulnerability before authentication is critical. The code that handles the first packets is open to all senders. A defect in that code gives an attacker a way in with no credentials.
- The sign-in page gets attacked. Attackers try stolen passwords against the gateway all day.
You can reduce the risk. Apply patches quickly, require multi-factor authentication, and limit the source addresses where that is possible. The alternative is a design with no listener on a public address.
How a Firezone Gateway is different
A Firezone Gateway does the same job as a VPN gateway. It terminates encrypted WireGuard tunnels from Clients and forwards the traffic to Resources in its Site. The design is different in four ways.
- Outbound connections only. The Gateway connects out to the Firezone control plane. The Client and the Gateway then make a direct tunnel with NAT hole punching. If a direct path is not possible, the encrypted traffic goes through a relay.
- No public listener. The Gateway needs no public IP address and no inbound firewall rule. A scan of your address range does not find it. See ports and protocols.
- No persistent storage. The Gateway holds no long-term state. It authenticates with a token and gets its configuration from the admin portal. You can replace a Gateway and not move data.
- Scale by addition. Add Gateways to a Site to add capacity. Firezone selects a healthy Gateway that is closest to each Client, which spreads the load.
You run the Gateways, and Firezone runs the control plane. Firezone cannot decrypt the traffic between a Client and a Gateway.
Sizing and high availability
The Gateway is a Linux binary that runs as a Docker image or a systemd unit. Firezone gives these sizing guidelines:
- A Gateway on a 2-core VM handles up to 1,000 clients, if the link is fast enough.
- A Gateway scales with CPU up to 4 cores and uses up to 4 GB of RAM.
- A 4-core Linux machine with a recent kernel can push 2 Gbps or more of peer-to-peer WireGuard traffic.
For production, Firezone recommends a minimum of three Gateways in each Site. If a Gateway fails, the Client moves to a healthy Gateway within 15 seconds. See high availability.
A VPN concentrator, a cloud VPN gateway, and a Firezone Gateway
The three do the same job at the edge of a network. They differ in what they expose to the internet and in how they grow.
| VPN concentrator | Cloud VPN gateway | Firezone Gateway | |
|---|---|---|---|
| Where it runs | A hardware or virtual appliance | A managed service in one cloud | Any Linux host, as a Docker image or a systemd unit |
| No listener on a public IP | No | No | YesOutbound connections only |
| Remote access and site-to-site | Yes | PartialSite-to-site first | Yes |
| Add capacity with more units | PartialA larger appliance or a cluster | PartialFixed tiers from the provider | YesAdd Gateways to a Site |
| Automatic failover | PartialYou build an active and standby pair | YesThe provider operates it | YesThe Client moves to a healthy Gateway |
| State on the device | Configuration and sessions | The provider holds it | None. The configuration is in the admin portal. |
| An access rule for each group and service | PartialNetwork rules for each group | NoRoutes and firewall rules | YesOne Policy for each Group and Resource |
The table describes the usual design of each category. A specific product can be different. Read the documentation of the product before you decide.
Common questions
What is a VPN gateway?
A VPN gateway is a device or a service at the edge of a network that terminates VPN tunnels. It authenticates the remote side, decrypts the traffic, and forwards it into the private network.
What is the difference between a VPN gateway and a VPN concentrator?
The job is the same. VPN concentrator is the older term for a device that is built to terminate a large number of tunnels. VPN gateway is the general term, and cloud providers use it for their managed services.
Is a VPN gateway the same as a firewall?
No. A firewall decides which traffic can pass. A VPN gateway terminates encrypted tunnels. Many firewalls include a VPN gateway, and the two functions frequently run on one device.
Does a VPN gateway need a public IP address?
A traditional VPN gateway does, because clients must be able to find it and connect to it. A Firezone Gateway does not. It makes outbound connections only and uses NAT hole punching to connect with Clients.
How many VPN gateways do I need?
Plan for a minimum of two, so that the loss of one does not stop access. Then add capacity for your peak load. For a Firezone Site in production, the recommendation is three or more Gateways.
Can I deploy Firezone Gateways with Terraform?
Yes. Firezone has Terraform examples for AWS, GCP, and Azure. See Automate your deployment.