GRE (Generic Routing Encapsulation)
What it is for
Two private networks want to be adjacent but only the public internet lies between -- and private addresses (10.x) are not routable there.
★★★ GRE's approach is utterly plain: treat the whole private packet as a payload and wrap it in a publicly routable IP header. The internet reads only the outer header; the inner one is unwrapped at the far end.
★★ It can also carry non-IP protocols, which is why the header has a protocol-type field.
How it divides labour with IPsec
★★★ GRE provides no encryption at all -- it solves "how do I get the packet there", not "can anyone read it".
★★★ Hence the common production pattern GRE over IPsec: GRE handles encapsulation (it can carry multicast and routing protocols) while IPsec handles encryption.
★★ Why not IPsec alone? Because an IPsec tunnel cannot carry multicast or multicast routing protocols while GRE can -- so running OSPF inside a tunnel needs it.
★ Common misconceptions
★★★ "GRE is an encrypted tunnel" -- it provides no encryption; a capture shows the inner packet. Using it as a VPN is a security incident.
★★★ "Configure the endpoints and you are done" -- beware recursive routing: if the route to the tunnel's far end points through the tunnel itself, it encapsulates itself repeatedly and collapses. ★ The peer address must be reached via a physical interface.
★★ "The overhead is small" -- 24 bytes (20 of new IP plus 4 of GRE), so the MTU drops to 1476; stacked with IPsec it is 50-80.