Generic Routing Encapsulation (GRE) Tunnel Defined

Updated: November 12, 2026 Time to read: ~

TL;DR

Generic Routing Encapsulation (GRE) is a tunneling protocol that wraps data packets inside new packets, enabling direct communication between otherwise incompatible network nodes. While GRE tunnels have legitimate uses — such as bridging device incompatibilities without new hardware — they can also be weaponized in large-scale DDoS attacks using botnets. Understanding how GRE works, including its setup requirements and protocol interactions (e.g., Maximum Transmission Unit (MTU) / Maximum Segment Size (MSS) conflicts), is essential for both implementing and defending against it.

What is GRE and how does it work?

To break down what a GRE tunnel is and how it works, we'll need to define a few critical terms. 

Any GRE protocol involves:

  • Nodes: A device that can accept or send information (like computers, routers, printers, and switches) is a node. 
  • Packets: Information sent from one device to another is split into packets. 
  • Headers: Each packet contains a header with information about the sender, the recipient, and the order of the message. 
  • Payload: The payload includes important contents of the message. 

During GRE, a data packet essentially gets wrapped up inside a new packet. The payload never changes, but the process adds two headers.

  • Identification: This header notifies recipients that they're dealing with a GRE packet. 
  • Directions: The second header includes source and recipient information.

With encapsulation complete, GRE tunneling can begin. Think of this as a form of direct, protected communication between two nodes. Even if the packet must zoom past other nodes, it's never inspected or held up along the way. It moves swiftly to the target. 

How do you set up a GRE tunnel?

In most cases, you'll set up a GRE tunnel by tapping into your router setup. But you'll need two pieces of information to get started. 

GRE tunnels rely on:

  • Your Internet Protocol (IP) address. This isn't the same as a human-friendly web address (like www.okta.com). An IP address is made up of numbers and decimals. 
  • Your recipient's IP address. You'll need that same data for the node you want to connect to. 

GRE standards were set up by the Network Working Group back in 2000. Developers can look over this very technical document and understand just how to set up new headers and configure messages to move through without disruption. 

What does a GRE protocol look like in practice?

Many of us deal with incompatible devices. For example, Google Nest users dealing with low batteries or power issues may be dealing with an incompatibility issue. Typically, solving that means buying new equipment. But what if there was another way?

If you know the IP address of your target server, you could reconfigure your router and send your messages along, even if you never buy one new thing to smooth the process. 

In essence, you'll trick your incompatible devices into believing that they can get along nicely and communicate like old friends. You'll wrap your messages in the proper code and experience no delays. 

A simple analogy for GRE encapsulation

Let's give a simplistic example to describe how this works. You have a package tied to the back of your bicycle that you need to get to the post office across the river. Unfortunately, no bridge exists, and your bike can't ride across the water. But you can put your bike on a ferry. Doing so doesn't mean changing your package or your bike. You just wrap your package in another system for the journey.

GRE protocols in computing work much the same way (with a lot more coding, of course). 

How does GRE interact with other network protocols?

Packet rules are plentiful and widespread. Sometimes, implementing a GRE tunnel means running afoul of some of these protocols. 

How GRE interacts with Maximum Transmission Unit (MTU) and Maximum Segment Size (MSS) rules

TermAcronymWhat It Measures
Maximum Transmission UnitMTUMaximum packet size, set at the device level
Maximum Segment SizeMSSPayload size

Move through the GRE encapsulation process, and you won't change the size of your payload. But you will add two headers, and that could mean you violate MTU rules. Your clean, repackaged packets could be blown apart before they're delivered. 

What are GRE encapsulation attacks and how can you defend against them?

The GRE protocol allows one device to talk to another, bypassing open filtering systems. Hackers love setups like this. With a little bit of tinkering, they can set up distributed denial of service (DDoS) attacks that crash your servers and take you offline. 

How hackers exploit GRE tunnels

In 2016, for example, hackers used GRE to attack the website for the Rio Olympics. They hoped to crash the server, blocking people from watching the games on their devices. Brazil and the International Olympics Committee (IOC) were able to keep the systems up and running, even though traffic from hackers reached 540 Gb per second at the height of the attack. 

Masking techniques aren't available for GRE tunnels. Hackers must disclose their originating IP addresses. Any security technician, seeing so much traffic coming from one source, would simply block that address from sending anything more. 

Hackers get around this problem by deploying botnets. Hundreds of thousands of infected devices, typically connected via a purchase made on the internet, point their packets at a target. An attack like this is massive, and it's very difficult to stop. 

How to defend against GRE-based DDoS attacks

Your defense approaches for a DDoS attack stemming from GRE are the same as those you'd use for any other botnet attack. In essence, your job is to either scale up your capacity to handle the additional traffic or scale back your access to reduce the packets that can come your direction.

We've written a playbook for developers filled with ideas about how to combat DDoS attacks. If you're looking for help, start here.

Frequently asked questions

What is a Generic Routing Encapsulation (GRE) tunnel and why is it used?

A GRE tunnel is a direct communication channel created using the Generic Routing Encapsulation (GRE) protocol. It allows data packets to travel between two network nodes — bypassing the public network — even when those devices are otherwise incompatible. It is commonly used to bridge device incompatibilities without requiring new hardware.

How does Generic Routing Encapsulation (GRE) encapsulation actually work?

GRE encapsulation wraps an existing data packet inside a new one. The original payload remains unchanged, but two new headers are added: one identifying the packet as a GRE packet, and another containing source and destination information. This allows the packet to travel directly to its target without being inspected or delayed by intermediate nodes.

What information do you need to set up a Generic Routing Encapsulation (GRE) tunnel?

To configure a GRE tunnel, you need two pieces of information: your own Internet Protocol (IP) address and the IP address of the recipient node you want to connect to. Setup is typically done through your router configuration.

Can Generic Routing Encapsulation (GRE) tunnels conflict with other network protocols?

Yes. Because GRE encapsulation adds two extra headers to each packet, it can cause packets to exceed the Maximum Transmission Unit (MTU) limit set at the device level. This size violation can cause packets to be fragmented or dropped before they reach their destination, disrupting communication.

How do hackers exploit Generic Routing Encapsulation (GRE) tunnels in cyberattacks?

Hackers can use GRE tunnels to launch Distributed Denial of Service (DDoS) attacks. Because GRE bypasses open filtering systems, attackers can direct massive volumes of traffic at a target. They typically use botnets — networks of hundreds of thousands of infected devices — to overwhelm servers, since GRE does not support IP masking and individual source addresses can be blocked.

What are the best defenses against a Generic Routing Encapsulation (GRE)-based DDoS attack?

Defense strategies against GRE-based DDoS attacks mirror those used for any botnet attack: either scale up your infrastructure capacity to absorb the additional traffic, or restrict inbound access to reduce the volume of packets that can reach your systems.

References

Generic Routing Encapsulation. (March 2000). Network Working Group. 

WiFi Routers That Are Incompatible With Nest Products. Google Nest Help. 

How a Massive 540 Gb/Sec DDoS Attack Failed to Spoil the Rio Olympics. (September 2016). The State of Security.

Continue your Identity journey