Guides
GRE Tunnel DDoS Protection: How It Works and When to Use It
Alexander Haglund
Chief Executive Officer
AWhen a large DDoS attack hits a server you run yourself, the frustrating part is that your own firewall never gets a chance to help. The flood fills your internet connection before a single packet reaches anything you control. GRE tunnel DDoS protection solves this by moving the filtering into a network with far more capacity, then delivering the surviving clean traffic to you through a tunnel. This article explains how that works in plain language, when a GRE tunnel is a good fit, and what to check before you set one up.
Why filtering on your own server is not enough
A DDoS attack (short for distributed denial of service) is an attempt to knock a service offline by flooding it with junk traffic from many sources at once. The obvious response is to block the junk with a firewall, and for small attacks that can work.
The problem is scale. Many attacks are designed simply to fill your internet connection with more data than it can carry. If your server sits behind a 1 Gbps port and the attack sends 50 Gbps, the excess gets discarded somewhere upstream, along with much of your legitimate traffic. Your firewall rules never matter, because the congestion happens before the traffic arrives. Attacks of this type are called volumetric attacks, and they are the reason on-server filtering alone fails.
Once the connection is saturated, everything behind it suffers: websites, game servers, APIs, and any customers sharing the same link. The only real fix is to filter the traffic earlier along its path, inside a network that has enough capacity to absorb the flood. That is exactly what tunnel-based protection does.
What a GRE tunnel actually is
A GRE tunnel is a private path between two networks that runs over the ordinary public internet. GRE stands for Generic Routing Encapsulation, a standard that has been in use since 2000 and is defined in RFC 2784.
The mechanism is easy to picture. Each packet headed for your network is placed inside another packet, like a letter tucked into a second envelope with a different address on it. The outer envelope is addressed to your router. When it arrives, your router removes the outer layer and handles the original packet as if it had arrived directly. In networking terms this is called encapsulation.
Two properties make GRE useful for DDoS protection. It works between any two endpoints that can reach each other over the internet, so no physical connection is required. And it behaves like a direct cable between the protection provider's network and yours, even when the two networks are far apart.
One thing GRE is not: encryption. A GRE tunnel does not scramble traffic the way a VPN does. Its job is delivery, not secrecy.
How GRE tunnel DDoS protection works
Providers differ in the details, but tunnel-based protection generally follows the same sequence.
- Traffic to your IP addresses is steered into the provider's network first. Instead of flowing straight to you, everything addressed to the protected IPs arrives at the protection provider's edge, the outer boundary of their network where it meets the rest of the internet.
- Attack traffic is filtered there. The provider's systems separate flood traffic from legitimate visitors and discard the junk. This step is often called scrubbing.
- Clean traffic is wrapped in GRE and forwarded to you. Whatever survives filtering is encapsulated and sent through the tunnel to your router or server.
- Your services see normal traffic. From the point of view of your applications, ordinary users are connecting as usual. The flood never touches your connection.
The important shift is where the fight happens. The provider's network absorbs the attack, and your own link carries only traffic that has already been cleaned. Sterile Networks uses this model for its network and ASN protection service: volumetric and protocol floods are absorbed upstream, and clean traffic is delivered over GRE or BGP with no hardware to install on your side.
GRE or BGP: which fits your setup?
GRE is one of two common ways to receive protected traffic. The other is a BGP announcement, which suits organizations that control their own IP address space.
BGP (Border Gateway Protocol) is the system networks use to tell each other which routes exist on the internet. If your organization owns its own IP ranges and has an ASN (an autonomous system number, essentially a registered identity for a network), a protection provider can announce your address ranges through their network. Traffic then flows through their filters before reaching you, and you keep using your own address space.
Here is a quick way to think about it.
- A single server or a small set of IP addresses: a GRE tunnel is usually the simpler fit.
- You want protection without changing how your network is announced: GRE works alongside your existing setup.
- You own IP ranges or an ASN and want whole-network coverage: a BGP announcement fits better.
- You are a hosting provider protecting everything you operate: either can work, depending on how your network is built.
Neither option is better in the abstract. GRE gets a single server or range protected quickly, while BGP suits operators who already manage their own routing and want everything covered at once.
What to check before you deploy a GRE tunnel
A few practical points decide how smooth the setup is.
Router or server support. Mainstream routing platforms and every common Linux distribution support GRE natively, so most setups need configuration rather than new equipment.
Packet size and MTU. Putting a packet inside another packet makes it slightly larger. Networks enforce a maximum packet size, called the MTU (maximum transmission unit), and the extra GRE header shrinks the space available for the original packet. In practice you lower the MTU setting on the tunnel interface so large packets still fit. Skipping this step causes confusing symptoms, such as small pages loading fine while larger transfers stall.
The return path. The tunnel defines how traffic reaches you. You also choose how your outbound replies leave: back through the tunnel, or out through your normal connection. Both approaches are used in practice, and the right choice depends on the provider and your setup, so confirm it during onboarding.
Keeping your unprotected address private. The tunnel delivers traffic to your real IP address, often called the origin. If that address is publicly known, attackers can aim at it directly and bypass the filtering. Once protection is in place, treat the origin address as private. Avoid publishing it in DNS records, and consider replacing it if it was exposed before protection started.
Common misconceptions
A tunnel does not add crippling delay. Clean traffic does take a detour through the provider's network, and the added latency depends on the distance between their filtering location and your servers. For many setups the difference is modest, and during an attack the real comparison is not fast versus slow but online versus offline.
Tunnel protection is also not reserved for large enterprises. Game server hosts and small hosting companies are among the most frequent DDoS targets, because a rival or an unhappy player can rent attack traffic cheaply. A GRE tunnel is one of the few approaches that puts serious filtering capacity in front of ordinary servers without moving them.
Finally, timing matters more than most people expect. A flood can saturate a link in seconds, so protection that only activates after someone notices an attack often arrives too late. Always-on filtering, where traffic is inspected continuously rather than after impact, avoids that gap. Sterile Networks includes always-on Layer 3/4 mitigation with every plan; Layers 3 and 4 refer to the parts of network communication that handle addressing and connections, which is where volumetric floods operate.
Getting protected without moving your servers
The practical appeal of GRE tunnel DDoS protection is that nothing about your infrastructure has to move. Your servers stay where they are, your hosting relationships stay intact, and filtering capacity is added in front of what you already run.
If you are weighing options, start by listing what you need to protect: individual servers, whole subnets, or an entire network with its own address space. That single question usually decides whether GRE delivery or a BGP announcement fits better. From there, you can review the available protection plans on the Sterile Networks website, or contact the team to talk through your specific setup.