Generic routing encapsulation (GRE) is a tunneling protocol developed by Cisco Systems that can encapsulate a wide variety of network layer protocols inside virtual point-to-point links or point-to-multipoint links over an Internet Protocol network.[2]
Based on the principles of protocol layering in OSI, protocol encapsulation, not specifically GRE, breaks the layering order. It may be viewed as a separator between two different protocol stacks, one acting as a carrier for another.
GRE packets that are encapsulated within IP directly, use IP protocol type 47 in the IPv4 header's Protocol field[3] or the IPv6 header's Next Header field.[4]
For performance reasons, GRE can also be encapsulated in UDP packets.[5] Better throughput may be achieved by using Equal-cost multi-path routing.
The extended version of the GRE packet header[6] is represented below:
A standard GRE packet header structure[7] is represented in the diagram below.
The newer structure superseded the original structure:[1]
The original GRE RFC defined further fields in the packet header which became obsolete in the current standard:
The Point-to-Point Tunneling Protocol (PPTP) [8] uses a variant GRE packet header structure, represented below. PPTP creates a GRE tunnel through which the PPTP GRE packets are sent.