skip to main | skip to sidebar
Showing posts with label GRE. Show all posts
Showing posts with label GRE. Show all posts

Thursday, April 28, 2011

GRE Tunnel Keepalives:

0 comments
1.It gives the ability for one side to originate and receive keepalive packets to and from the remote router even if the remote router does not support GRE keepalives.


2.The sender pre-builds the keepalive response packet inside the original keepalive request packet so that the remote end only needs to do the standard GRE decapsulation of the outer GRE IP header and then forward the inner IP GRE packet.

3.This mechanism causes the keepalive response to forward out the physical interface rather than the tunnel interface.

4.GRE keepalive timers on each side are independent and do not have to match.

This is an example of a keepalive packet that originates from Router A and is destined for Router B. The keepalive response that Router B returns to Router A is already pre-built by Router A and is inside the inner IP header. Router B simply decapsulates the keepalive packet and sends it back to Router A out the physical interface serial 2.


To configure GRE tunnel keepalive,


Router (config)# interface Tunnel 0

Router (config-if)# keepalive 5 4

The syntax of the command is keepalive [retries]. The seconds parameter indicates the interval at which a GRE keepalive packet should be sent. The retries parameter indicates the number of GRE keepalive responses allowed to miss before declaring the tunnel down.


The inner GRE protocol type is set to 0 while the outer GRE protocol type is IP (0x0800). Hence, when the sender receives a response with GRE protocol type 0, it understands that the packet is a GRE tunnel keepalive packet response that it sent to its neighbor/remote-end. It drops the response packet and sets the tunnel keepalive counter to 0.

Note: GRE tunnel keepalive is only supported on point-to-point GRE tunnels; not on multipoint GRE (mGRE).

GRE (Generic Routing Encapsulation)

0 comments
1.Primary use of GRE was to carry non-IP protocols over IP network.

2.GRE is stateless and offers no flow-control mechanism. As long as the tunnel destination is routable, traffic can flow through it; no reliability or sequencing is provided.
3.A GRE tunnel encapsulates the original IP (or non-IP) packet inside of an outer shell.
4.GRE adds atleast 24 bytes of overhead, including 20 bytes of IP header. Meaning, a GRE header is a minimum 4 bytes without options.
5.GRE allows IP multicasting and routing protocols to travel though the tunnel.
6.GRE is non-secure.

GRE Header-



At the minimum, a GRE header has 4 bytes; first two bytes are Flags field and second two bytes are Protocol Type field.
C - Checksum Present (bit 0)-
If the Checksum Present bit is set to 1, the Checksum field (4 bytes) contains valid information.
R – Routing Present (bit 1)-
If the Routing Present bit is set to 1, the Routing field (variable bytes) contains valid information.
K – Key Present (bit 2)-
If the Key Present bit is set to 1, the Key field (4 bytes) contains valid information.
S – Sequence Number Present (bit 3)-
If the Sequence Number Present bit is set to 1, then it indicates that Sequence Number field (4 bytes) is present.
s – Strict Source Route (bit 4)-
This bit should be set to 1 only if all of the routing information consists of Strict Source Routes.
Recursion Control (bits 5-7)-
Recursion Control contains a three bit unsigned integer which contains the number of additional encapsulations which are permissible. This should be set to 0 by default.
Version Number (bits 13-15)-
The Version number field should be set to 0 by default.
Protocol Type (2 bytes)-
The Protocol Type field contains the protocol type of the payload packet. For IP, it is 0800.
Checksum (2 bytes)-
The Checksum field contains the IP checksum of the GRE header and the payload packet.
Offset (2 bytes)-
The Offset field indicates the octet offset from the start of the Routing field to the first octet of the active Source Route Entry to be examined.
Key (4 bytes)-
The Key field contains a four byte number which can be configured manually. It is used by the receiver to authenticate the source of the packet.
Routing (variable)-
The Routing field is a list of Source Route Entries (SREs). The SRE contains Address-family (which indicates the syntax and semantics of the Routing Information field), SRE offset, SRE length and Routing Information field (which contains data which may be used in routing the packets).

Packet encapsulation in GRE: