RFC 2784

Generic Routing Encapsulation (GRE)

๐Ÿ“… published March 2000, from ietf

RFC 2784: Generic Routing Encapsulation (GRE) ๐ŸŽ€

  • Series: Network Working Group โœจ
  • Number: RFC 2784
  • Title: Generic Routing Encapsulation (GRE)
  • Authors: D. Farinacci and T. Li (Procket Networks), S. Hanks (Enron Communications), D. Meyer (Cisco Systems), and P. Traina (Juniper Networks)
  • Category: Standards Track ๐Ÿ”ฅ
  • Date: March 2000
  • Obsoletes/Updates: The header doesn't list anything this document obsoletes or updates. ๐Ÿงš

Status of this Memo

Okay so this document specifies an Internet standards track protocol for the Internet community, and it's literally asking everyone to discuss it and suggest improvements ๐Ÿ’…. For where this protocol stands in the official standardization state, check the current edition of the "Internet Official Protocol Standards" (STD 1). Distribution of this memo is unlimited ๐ŸŒˆ.

Copyright (C) The Internet Society (2000). All Rights Reserved. ๐Ÿ”’

Abstract โœจ

This document specifies a protocol for encapsulation of an arbitrary network layer protocol over another arbitrary network layer protocol. It's basically a protocol for wrapping any network layer packet inside any other network layer packet ๐ŸŽ.

1. Introduction ๐Ÿ’–

Okay so there are already a bunch of different proposals [RFC1234, RFC1226] for wrapping one protocol inside another. Other encapsulations [RFC1241, RFC1479] were proposed for tunneling IP over IP for policy reasons ๐Ÿ™ˆ. This memo describes a protocol that's very similar to those proposals, but it's way more general. Going general means we ignored a lot of protocol-specific nuances, so this one might be less suitable if you have a specific "X over Y" encapsulation in mind ๐Ÿฆ‹. The whole point is a simple, general-purpose mechanism that shrinks the encapsulation problem from its current O(n^2) size down to something way more manageable ๐Ÿ‘‘. This memo purposely does not address when a packet should be encapsulated ๐Ÿ’…. It also acknowledges, but doesn't address, problems like mutual encapsulation [RFC1326] ๐Ÿซถ.

In the most general case, a system has a packet that needs to be encapsulated and delivered to some destination. We call this the payload packet ๐ŸŽ€. The payload gets encapsulated in a GRE packet first. That GRE packet can then be encapsulated in some other protocol and forwarded. We call this outer protocol the delivery protocol ๐Ÿš€. The algorithms for processing this packet come later in the doc โœจ.

Finally, this specification describes the intersection of GRE that's currently deployed by multiple vendors ๐Ÿ’œ.

The keywords MUST, MUST NOT, MAY, OPTIONAL, REQUIRED, RECOMMENDED, SHALL, SHALL NOT, SHOULD, SHOULD NOT are to be interpreted as defined in RFC 2119 [RFC2119] ๐Ÿ“š.

2. Structure of a GRE Encapsulated Packet ๐Ÿงฉ

A GRE encapsulated packet has the form:

---------------------------------
|                               |
|       Delivery Header         |
|                               |
---------------------------------
|                               |
|       GRE Header              |
|                               |
---------------------------------
|                               |
|       Payload packet          |
|                               |
---------------------------------

This specification is mostly concerned with the structure of the GRE header ๐Ÿ’…, though we give some special attention to the issues around IPv4 payloads ๐ŸŒธ.

2.1. GRE Header ๐ŸŽ€

The GRE packet header looks like this:

 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|C|       Reserved0       | Ver |         Protocol Type         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      Checksum (optional)      |       Reserved1 (Optional)    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

2.2. Checksum Present (bit 0) ๐Ÿฆ‹

If the Checksum Present bit is set to one, then the Checksum and Reserved1 fields are present, and the Checksum field contains valid information. Note that a compliant implementation MUST accept and process this field. No excuses, bestie ๐Ÿ’….

2.3. Reserved0 (bits 1-12) ๐Ÿ”’

A receiver MUST discard a packet where any of bits 1-5 are non-zero, unless that receiver implements RFC 1701. Bits 6-12 are reserved for future use ๐ŸŒ™. These bits MUST be sent as zero and MUST be ignored on receipt ๐Ÿซถ.

2.3.1. Version Number (bits 13-15) ๐Ÿ“

The Version Number field MUST contain the value zero. Zero only, periodt ๐Ÿ’….

2.4. Protocol Type (2 octets) ๐ŸŒˆ

The Protocol Type field contains the protocol type of the payload packet. These Protocol Types are defined in [RFC1700] as "ETHER TYPES" and in [ETYPES]. An implementation that receives a packet with a Protocol Type not listed in [RFC1700] or [ETYPES] SHOULD discard the packet ๐Ÿ—‘๏ธ.

2.5. Checksum (2 octets) โœจ

The Checksum field contains the IP (one's complement) checksum sum of all the 16 bit words in the GRE header and the payload packet. When computing the checksum, the value of the checksum field is zero ๐Ÿงฎ. This field is only present if the Checksum Present bit is set to one.

2.6. Reserved1 (2 octets) ๐Ÿ’œ

The Reserved1 field is reserved for future use. If it's present, it MUST be transmitted as zero ๐ŸŒธ. Reserved1 is only present when the Checksum field is present (that is, when the Checksum Present bit is set to one).

3. IPv4 as a Payload ๐Ÿฆ‹

When IPv4 is carried as the GRE payload, the Protocol Type field MUST be set to 0x800 ๐Ÿ‘‘.

3.1. Forwarding Decapsulated IPv4 Payload Packets ๐Ÿš€

When a tunnel endpoint decapsulates a GRE packet whose payload is an IPv4 packet, the destination address in the IPv4 payload packet header MUST be used to forward the packet, and the TTL of the payload packet MUST be decremented โณ. Care should be taken when forwarding such a packet ๐Ÿ™ˆ, because if the destination address of the payload packet is the encapsulator of the packet (that is, the other end of the tunnel), looping can occur ๐ŸŒ€. In this case, the packet MUST be discarded ๐Ÿ’€.

4. IPv4 as a Delivery Protocol ๐ŸŒ

The IPv4 protocol 47 [RFC1700] is used when GRE packets are encapsulated in IPv4. See [RFC1122] for requirements relating to the delivery of packets over IPv4 networks ๐Ÿ“ฆ.

5. Interoperation with RFC 1701 Compliant Implementations ๐Ÿค

In RFC 1701, the field described here as Reserved0 contained a bunch of flag bits, and this specification deprecates them ๐Ÿ™ƒ. Specifically, the Routing Present, Key Present, Sequence Number Present, and Strict Source Route bits have been deprecated, along with the Recursion Control field. So the GRE header will never contain the Key, Sequence Number, or Routing fields specified in RFC 1701 ๐Ÿฅ€.

There are, however, existing implementations of RFC 1701 out there. The following sections describe correct interoperation with them ๐Ÿซถ.

5.1. RFC 1701 Compliant Receiver ๐Ÿ‘‚

An implementation complying with this specification will transmit the Reserved0 field set to zero. An RFC 1701 compliant receiver will interpret this as having the Routing Present, Key Present, Sequence Number Present, and Strict Source Route bits set to zero. It won't expect the RFC 1701 Key, Sequence Number, or Routing fields to be present ๐Ÿ™Œ.

5.2. RFC 1701 Compliant Transmitter ๐Ÿ“ฃ

An RFC 1701 transmitter may set any of the Routing Present, Key Present, Sequence Number Present, and Strict Source Route bits to one, and so it may transmit the RFC 1701 Key, Sequence Number, or Routing fields in the GRE header ๐ŸŽ€. As stated in Section 5.3, a packet with non-zero bits in any of bits 1-5 MUST be discarded unless the receiver implements RFC 1701 ๐Ÿšซ.

6. Security Considerations ๐Ÿ”

Security in a network using GRE should be pretty similar to security in a normal IPv4 network ๐Ÿ›ก๏ธ, since routing over GRE follows the same routing that IPv4 uses natively. Route filtering stays unchanged. Packet filtering, though, requires either that a firewall looks inside the GRE packet or that the filtering happens on the GRE tunnel endpoints ๐Ÿ˜ฌ. In environments where this is considered a security issue, it may be desirable to terminate the tunnel at the firewall ๐Ÿงฑ.

Hold up, this part matters: if your filtering depends on what's inside the GRE packet, you need to figure out where the inspection happens before you ship anything ๐Ÿ’€.

7. IANA Considerations ๐Ÿ“‹

This section covers the assignment of additional GRE Version Numbers and Protocol Types ๐Ÿญ.

7.1. GRE Version Numbers ๐Ÿ”ข

This document specifies GRE version number 0. GRE version number 1 is used by PPTP [RFC2637]. Additional GRE version numbers are assigned by IETF Consensus, as defined in RFC 2434 [RFC2434] ๐Ÿงพ.

7.2. Protocol Types ๐Ÿท๏ธ

GRE uses an ETHER Type for the Protocol Type. New ETHER TYPES are assigned by Xerox Systems Institute [RFC1700] โœจ.

10. REFERENCES ๐Ÿ“š

Okay bestie, here are all the references the spec leans on, with every detail kept ๐Ÿซถ

  • [ETYPES] ftp://ftp.isi.edu/in-notes/iana/assignments/ethernet-numbers
  • [RFC1122] Braden, R., "Requirements for Internet hosts - communication layers", STD 3, RFC 1122, October 1989.
  • [RFC1191] Mogul, J. and S. Deering, "Path MTU Discovery", RFC 1191, November 1990.
  • [RFC1226] Kantor, B., "Internet Protocol Encapsulation of AX.25 Frames", RFC 1226, May 1991.
  • [RFC1234] Provan, D., "Tunneling IPX Traffic through IP Networks", RFC 1234, June 1991.
  • [RFC1241] Woodburn, R. and D. Mills, "Scheme for an Internet Encapsulation Protocol: Version 1", RFC 1241, July 1991.
  • [RFC1326] Tsuchiya, P., "Mutual Encapsulation Considered Dangerous", RFC 1326, May 1992. ๐Ÿ’€
  • [RFC1479] Steenstrup, M., "Inter-Domain Policy Routing Protocol Specification: Version 1", RFC 1479, July 1993.
  • [RFC1700] Reynolds, J. and J. Postel, "Assigned Numbers", STD 2, RFC 1700, October 1994.
  • [RFC1701] Hanks, S., Li, T., Farinacci, D. and P. Traina, "Generic Routing Encapsulation", RFC 1701, October 1994. ๐ŸŽ€
  • [RFC1702] Hanks, S., Li, T., Farinacci, D. and P. Traina, "Generic Routing Encapsulation over IPv4 networks", RFC 1702, October 1994.
  • [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March, 1997. ๐ŸŒธ
  • [RFC2408] Maughan, D., Schertler, M., Schneider, M. and J. Turner, "Internet Security Association and Key Management Protocol (ISAKMP)", RFC 2408, November 1998.
  • [RFC2434] Narten, T. and H. Alvestrand, "Guidelines for Writing an IANA Considerations Section in RFCs", BCP 26, RFC 2434, October, 1998.
  • [RFC2637] Hamzeh, K., et al., "Point-to-Point Tunneling Protocol (PPTP)", RFC 2637, July, 1999. ๐Ÿฆ‹

11. Authors' Addresses ๐Ÿงš

The crew behind this spec, slay ๐Ÿ’…

Dino Farinacci

Procket Networks
3850 No. First St., Ste. C
San Jose, CA 95134

EMail: dino@procket.com

Tony Li

Procket Networks
3850 No. First St., Ste. C
San Jose, CA 95134

Phone: +1 408 954 7903
Fax:   +1 408 987 6166
EMail: tony1@home.net

Stan Hanks

Enron Communications

EMail: stan_hanks@enron.net

David Meyer

Cisco Systems, Inc.
170 Tasman Drive
San Jose, CA, 95134

EMail: dmm@cisco.com

Paul Traina

Juniper Networks
EMail: pst@juniper.net

Here's the legal bit, and it matters, so read it fr fr โœจ

Copyright (C) The Internet Society (2000).  All Rights Reserved.

Okay so the vibe is: anyone can copy and share this document and translations of it, and make derivative works that comment on or explain it or help with implementing it. You can publish and distribute those, in whole or in part, with zero restrictions, as long as the copyright notice and this paragraph show up on every copy and derivative work. ๐Ÿซถ

But the document itself? No modifying it in any way, like ripping out the copyright notice or the references to the Internet Society or other Internet organizations. The exceptions are needed for developing Internet standards (in which case the copyright procedures in the Internet Standards process have to be followed) or translating it into languages other than English. ๐ŸŒˆ

The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns. Forever, bestie ๐Ÿ’œ

This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. ๐Ÿ™ˆ

Acknowledgement ๐Ÿ“

Funding for the RFC Editor function is currently provided by the Internet Society. Thank you, Internet Society ๐Ÿซถโœจ

๐Ÿ“ฆ where this page comes from