Generic Routing Encapsulation

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]

Generic Routing Encapsulation
Communication protocol
PurposeNetwork tunneling
Developer(s)Cisco Systems
Introduced1994[1]
RFC(s)RFC1701, RFC1702, RFC2784

Example uses

  • In conjunction with PPTP to create VPNs.
  • In conjunction with IPsec VPNs to allow passing of routing information between connected networks.
  • In mobility protocols.
  • In A8/A10 interfaces to encapsulate IP data to/from Packet Control Function (PCF).
  • Linux and BSD can establish ad-hoc IP over GRE tunnels which are interoperable with Cisco equipment.
  • Distributed denial of service (DDoS) protected appliance to an unprotected endpoint.

Example protocol stack

OSI model layer Protocol
5. Session X.225
4. Transport UDP
3. Network (GRE-encapsulated) IPv4
Encapsulation GRE
3. Network IPv6
2. Data Link Ethernet
1. Physical Ethernet physical layer

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.[3]

Packet header

Standard GRE Packet Header (RFC2784)

A standard GRE packet header structure, as defined by RFC 2784 and RFC 2890, is represented in the diagram below.

0 Bits 1–12 13–15 16–31
C Reserved0 Version Protocol Type
Checksum (optional) Reserved1 (optional)
C
Checksum bit. Set to 1 if a checksum 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. (For IPv4, this would be hex 0800.)
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.

Standard GRE Packet Header (RFC1701, obsolete)

The newer structure superseded the original structure as defined in RFC 1701:

Bits 0–4 5–7 8-12 13–15 16–31
C R K S s Recur Flags Version Protocol Type
Checksum (optional) Offset (optional)
Key (optional)
Sequence Number (optional)
Routing (optional, variable length)

The original GRE RFC defined further fields in the packet header which became obsolete in the current standard:

R
Routing Bit. Set to 1 if Routing and Offset information are 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.
s
Strict source route bit.
Recur
Recursion control bits.
Flags
Reserved for future use, set to 0.
Offset
Present if R bit or C bit is set; contains valid information, only if R bit is set. An offset field indicating the offset within the Routing field to the active source route entry
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.
Routing
Present if R bit is set; contains a list of source route entries, therefore is of variable length

PPTP GRE Packet Header

The Point-to-Point Tunneling Protocol (PPTP), defined in RFC 2637, uses a variant GRE packet header structure, represented below. PPTP creates a GRE tunnel through which the PPTP GRE packets are sent.

Bits 0–4 5–7 8 9-12 13–15 16–31
C R K S s Recur A Flags Version Protocol Type
Key Payload Length Key Call ID
Sequence Number (optional)
Acknowledgement Number (optional)
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. (All PPTP GRE packets carry a key.)
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

  • RFC 1701: Generic Routing Encapsulation (GRE) (informational)
  • RFC 1702: Generic Routing Encapsulation over IPv4 networks (informational)
  • RFC 2637: Point to Point Tunneling Protocol (informational)
  • RFC 2784: Generic Routing Encapsulation (GRE) (proposed standard, updated by RFC 2890)
  • RFC 2890: Key and Sequence Number Extensions to GRE (proposed standard)
  • RFC 8086: GRE-in-UDP Encapsulation (proposed standard)

See also

Network Virtualization using Generic Routing Encapsulation - carries L2 packets over GRE

References

  1. Generic Routing Encapsulation (GRE). IETF. October 1994. doi:10.17487/RFC1701. RFC 1701. Retrieved May 14, 2018.
  2. , "Generic routing encapsulation tunnel keepalives", issued 2002-07-01
  3. RFC 1702: Generic Routing Encapsulation over IPv4 networks. October 1994.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.