GRE - Understanding how keepalives work

When configuring a GRE tunnel between two endpoints, the GRE tunnel will use a keepalive mechanism to detect whether the GRE tunnel is still operational or has failed.

GRE is a protocol that encapsulates various network layer protocols into point-to-point connections over an IP network, but by default, it doesn’t provide any inherent mechanism for checking the liveliness of the tunnel. That’s where GRE keepalives come into play.

The GRE tunnel keepalive mechanism functions similarly to PPP keepalives, allowing one side to send and receive keepalive packets to and from a remote router, even if that router doesn’t natively support GRE keepalives.

In the case of GRE keepalives, the sender constructs a response packet within the original keepalive request packet. This means that the remote router only needs to perform standard GRE decapsulation to strip off the outer GRE IP header, then return the inner GRE packet back to the sender.

The decapsulated pre-created response packet is then routed or reflected back to the originating device.

Because of this method of implementing keepalives, they cannot be used with VRF-aware GRE tunnels. For more information about that, take a look at GRE - Keepalives and VRF-aware tunnels.