No history yet

Introduction to GRE

Creating Virtual Tunnels

Imagine you have two separate islands, but the only way to get between them is by using a public ferry system. You want to send a special type of cargo—say, a unique kind of vehicle—that the ferry system doesn't normally handle. What do you do? You could load your special vehicle into a standard, approved shipping container. The ferry operators only see the container, not what's inside, and they transport it just like any other cargo. When it arrives at the other island, you simply open the container and your vehicle rolls out.

Generic Routing Encapsulation (GRE) works in a very similar way. It's a tunneling protocol, which means it creates a virtual point-to-point link between two networks over an existing network, like the internet. GRE takes packets from one protocol (the cargo), wraps them inside another packet (the container), and sends them on their way.

The core purpose of GRE is to encapsulate a wide variety of network protocols inside an IP tunnel, effectively creating a private path over a public or incompatible network.

The Encapsulation Process

The magic of GRE is in its encapsulation process. Let's break down how it wraps up a packet for delivery.

  1. The Original Packet: This is the data you want to send, often called the payload. It could be an IPv6 packet, an AppleTalk packet, or even a standard IPv4 packet from a private network.
  2. The GRE Header: GRE adds its own small header to the original packet. This header contains information about the type of protocol being carried and other control information for the tunnel.
  3. The New IP Header: Finally, the whole thing—the original packet plus the GRE header—is wrapped inside a new IP packet. This outer packet, called the delivery or carrier packet, has a source and destination address that are reachable on the transport network (e.g., the public internet). Routers on the internet only look at this outer header to deliver the package.

Once the encapsulated packet reaches the end of the tunnel, the process is reversed. The destination router strips off the outer IP header and the GRE header, revealing the original packet, which it then forwards to its final destination within the private network.

The Advantages of GRE

GRE isn't the only tunneling protocol, but it has a couple of key features that make it a popular choice.

GRE (Generic Routing Encapsulation) and VXLAN (Virtual Extensible LAN) are often used to extend VLANs across Layer 3 boundaries.

Its primary advantage is its versatility. The "G" in GRE stands for "Generic," and it lives up to the name. It can encapsulate a vast array of different network layer protocols. While the internet primarily runs on IP, many private networks historically used other protocols like AppleTalk or IPX. GRE provides a way to transport this non-IP traffic across an IP-only backbone.

Another major benefit is its support for multicast traffic. Multicast is a way of sending a single packet to multiple recipients simultaneously, which is crucial for applications like video streaming, online gaming, and certain routing protocols (like OSPF and EIGRP). Many other simple tunneling methods don't support multicast, making GRE the go-to solution when this functionality is needed.

Common Use Cases

GRE tunnels are practical tools for solving several common networking challenges.

Use CaseDescription
Connecting Private NetworksLink two private office networks over the public internet, making them appear as if they are directly connected.
Enabling IPv6 ConnectivityTunnel IPv6 traffic over an IPv4-only network, helping organizations transition to the newer protocol.
Virtual Private Networks (VPNs)Create simple site-to-site VPNs. When paired with IPsec, these VPNs become secure.
Transporting Routing ProtocolsExtend an internal routing protocol (like EIGRP or OSPF) across a service provider's network that doesn't support it directly.

In each scenario, GRE acts as a bridge, connecting otherwise incompatible or isolated network segments into a single, cohesive network.

Quiz Questions 1/5

What is the primary function of Generic Routing Encapsulation (GRE)?

Quiz Questions 2/5

In the ferry system analogy, the 'standard, approved shipping container' represents which component of the GRE process?