What is GRE tunneling and when is it used?

Answer

GRE (Generic Routing Encapsulation) is a simple tunneling protocol that encapsulates any Layer 3 protocol (IPv4, IPv6, IPX, MPLS) inside IPv4 packets. A GRE tunnel appears as a virtual point-to-point link between two routers. GRE header adds 24 bytes overhead. GRE itself provides no encryption or authentication — it is commonly combined with IPsec for secure GRE tunnels (GRE over IPsec). Use cases: transporting non-IP protocols over IP networks, carrying routing protocols over point-to-point links (OSPF, EIGRP over GRE tunnels in hub-and-spoke WAN), IPv6 over IPv4 (during IPv6 transition), MPLS over IP. Example Cisco config: interface Tunnel0; ip address 10.0.0.1 255.255.255.252; tunnel source 203.0.113.1; tunnel destination 198.51.100.1. mGRE (Multipoint GRE) is used in DMVPN (Dynamic Multipoint VPN) to create scalable hub-and-spoke VPN networks where spokes can communicate directly (spoke-to-spoke) after initial hub negotiation.