GRE Encapsulation · GRE
1. GRE adds a 24-byte header (20 IP + 4 GRE).
2. Carries multicast and non-IP.
3. No encryption.
4. Set ip mtu 1476 and tcp adjust-mss 1436.
5. Recursive routing breaks tunnels.
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
ping 10.2.2.2 size 1476 df-bitVerification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 MTU tests Verify boundary
ping 10.2.2.2 size 1476 df-bit ! through the tunnel
ping 198.51.100.2 size 1500 df-bit ! underlay
If 1476 fails but smaller sizes work, lower ip mtu on the tunnel and set ip tcp adjust-mss 40 bytes lower.
Step 2 Common mistakes Narrow the fault
- Forgetting GRE adds 24 bytes, so large packets fragment or drop.
- Assuming GRE is encrypted — it is not; add IPsec.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
ReferenceWhat it is1 section · depth on demand
Overhead and MTU
ReferenceImportant terms & boundaries3 sections · depth on demand
Worked example
Encapsulation means adding headers, and every added header takes space from the payload. Because the physical link's MTU stays the same, packets that were exactly the right size before may now be too big. The worked example calculates the GRE overhead and shows the settings that keep TCP traffic from running into fragmentation problems.
GRE adds a new 20-byte outer IPv4 header plus a 4-byte GRE header (24 bytes; more with keys or sequence numbers).
Worked example: physical MTU 1500 → maximum inner packet 1476. With IPsec protecting the GRE (ESP, AES, SHA) overhead grows by roughly 50–70 bytes, so ip mtu 1400 and ip tcp adjust-mss 1360 on the tunnel are common safe values. GRE can carry multicast and non-IP payloads, which is why it is used for routing protocols over IPsec and in DMVPN (mGRE).
In depth
GRE header fields
| Field | Size | Meaning |
|---|---|---|
| C bit | 1 bit | Checksum present (adds 4 bytes) |
| K bit (RFC 2890) | 1 bit | Key present (adds 4 bytes) |
| S bit (RFC 2890) | 1 bit | Sequence number present (adds 4 bytes) |
| Version | 3 bits | 0 |
| Protocol type | 16 bits | EtherType of the payload: 0x0800 IPv4, 0x86DD IPv6, 0x8847 MPLS |
The outer IP header carries IP protocol 47. GRE has no ports, so firewalls and NAT devices must explicitly allow protocol 47; PAT cannot multiplex several GRE tunnels behind one address.
Tunnel keys
interface Tunnel0
tunnel source Loopback0
tunnel destination 203.0.113.2
tunnel key 100
The key distinguishes several tunnels between the same pair of endpoints. It is not a security feature — it is sent in clear text.
GRE with or without IPsec
| Mode | Configuration | Carries |
|---|---|---|
| Plain GRE | tunnel mode gre ip (default) | Any protocol incl. multicast/routing — unencrypted |
| GRE over IPsec | GRE tunnel + tunnel protection ipsec profile X | Same as GRE, encrypted |
| Native IPsec VTI | tunnel mode ipsec ipv4 | IP unicast and multicast, no GRE header (saves 4 bytes) |
Identify GRE in a capture
tcpdump -ni eth0 ip proto 47
Wireshark shows the outer IP, the GRE header with protocol type and then the inner packet. If the inner packets appear on one side but not the other, look for an ACL or firewall dropping protocol 47 rather than a routing problem.
Counters to check
show interfaces Tunnel0 shows input/output packets and drops for the tunnel. Output packets increasing with no input on either side means encapsulated packets leave but never arrive — a path or filter issue in the underlay.
Header
| Field | Size |
|---|---|
| New IP header | 20 bytes |
| GRE header (basic) | 4 bytes |
| Optional key | +4 bytes |
| Optional sequence | +4 bytes |
Typical settings: ip mtu 1476 and ip tcp adjust-mss 1436 on the tunnel interface.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Virtualization & Overlays → GRE → GRE Encapsulation. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc2784.html · confidence 94%