Generic Routing Encapsulation


Generic Routing Encapsulation 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.

Example uses

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.

IP as a delivery protocol

GRE packets that are encapsulated within IP use IP protocol type 47.

Packet header

Standard GRE Packet Header

A standard GRE packet header structure, as defined by and , is represented in the diagram below.
; C: Checksum bit. Set to 1 if a checksum is present.
; K: Key bit. Set to 1 if a key is present.
; S: Sequence number bit. Set to 1 if a sequence number is present.
; Reserved0: Reserved bits; set to 0.
; Version: GRE Version number; set to 0.
; Protocol Type: Indicates the ether protocol type of the encapsulated payload.
; Checksum: Present if the C bit is set; contains the checksum for the GRE header and payload.
; Reserved1: Present if the C bit is set; is set to 0.
; Key: Present if the K bit is set; contains an application-specific key value.
; Sequence Number: Present if the S bit is set; contains a sequence number for the GRE packet.

PPTP GRE Packet Header

The Point-to-Point Tunneling Protocol, defined in , uses a variant GRE packet header structure, represented below. PPTP creates a GRE tunnel through which the PPTP GRE packets are sent.
; C: Checksum bit. For PPTP GRE packets, this is set to 0.
; R: Routing bit. For PPTP GRE packets, this is set to 0.
; K: Key bit. For PPTP GRE packets, this is set to 1.
; S: Sequence number bit. Set to 1 if a sequence number is supplied, indicating a PPTP GRE data packet.
; s: Strict source route bit. For PPTP GRE packets, this is set to 0.
; Recur: Recursion control bits. For PPTP GRE packets, these are set to 0.
; A: Acknowledgement number present. Set to 1 if an acknowledgement number is supplied, indicating a PPTP GRE acknowledgement packet.
; Flags: Flag bits. For PPTP GRE packets, these are set to 0.
; Version: GRE Version number. For PPTP GRE packets, this is set to 1.
; Protocol Type: For PPTP GRE packets, this is set to hex 880B.
; Key Payload Length: Contains the size of the payload, not including the GRE header.
; Key Call ID: Contains the Peer's Call ID for the session to which the packet belongs.
; Sequence Number: Present if the S bit is set; contains the GRE payload sequence number.
; Acknowledgement Number: Present if the A bit is set; contains the sequence number of the highest GRE payload packet received by the sender.

Standards