RFC 1701
Generic Routing Encapsulation (GRE)
Generic Routing Encapsulation (GRE) ๐
Okay bestie, this is RFC 1701 ๐ and it's all about Generic Routing Encapsulation (GRE) ๐. It came out of the Network Working Group in October 1994. The category is Informational, which is giving "here's some useful info, but it's not a standard" ๐ . S. Hanks wrote it from NetSmiths, Ltd., and T. Li, D. Farinacci and P. Traina are the other authors, with cisco Systems listed as their affiliation. It doesn't list anything it obsoletes or updates, so no drama there โจ.
Status of this Memo โจ
This memo is here to provide information for the Internet community ๐. It doesn't specify an Internet standard of any kind, so don't go calling it one ๐. Distribution of this memo is unlimited ๐.
Abstract ๐ฆ
This doc specifies a protocol for encapsulating an arbitrary network layer protocol inside another arbitrary network layer protocol ๐.
Introduction ๐ธ
Okay so there are already a bunch of proposals [RFC 1234, RFC 1226] for encapsulating one protocol over another ๐. Other types of encapsulation [RFC 1241, SDRP, RFC 1479] have been proposed for transporting IP over IP for policy purposes ๐งณ. This memo describes a protocol that's super similar to those proposals, just more general ๐ .
Going more general means a lot of protocol-specific nuances got left out โจ. So this proposal may be less suitable for a situation where a specific "X over Y" encapsulation has already been described ๐คทโโ๏ธ. The whole point of this protocol is to be a simple, general purpose mechanism that takes the problem of encapsulation from its current O(n^2) problem to a much more manageable state ๐ง. It also gives you a lightweight encapsulation for use in policy based routing ๐.
This memo explicitly doesn't get into when a packet gets encapsulated ๐ โโ๏ธ. It's aware of problems with mutual encapsulation [RFC 1326], but it doesn't address them ๐.
In the most general case, a system has a packet that needs to be encapsulated and routed. We'll call this the payload packet ๐. The payload gets encapsulated in a GRE packet first, and that GRE packet may also include a route ๐ฃ๏ธ. The resulting GRE packet can then be encapsulated in some other protocol and forwarded from there. We'll call this outer protocol the delivery protocol ๐. The algorithms for processing this packet are discussed later ๐.
Overall packet ๐ง
The entire encapsulated packet ends up looking like this:
---------------------------------
| |
| Delivery Header |
| |
---------------------------------
| |
| GRE Header |
| |
---------------------------------
| |
| Payload packet |
| |
---------------------------------
Packet header ๐
The GRE packet header has the form:
0 1 2 3
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|R|K|S|s|Recur| Flags | Ver | Protocol Type |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Checksum (optional) | Offset (optional) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Key (optional) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Sequence Number (optional) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Routing (optional)
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Flags and version (2 octets)
The GRE flags live in the first two octets ๐. Bit 0 is the most significant bit and bit 15 is the least significant bit ๐ข. Bits 13 through 15 are reserved for the Version field ๐. Bits 5 through 12 are reserved for future use and MUST be transmitted as zero. ๐ซถ
Checksum Present (bit 0)
If the Checksum Present bit is set to 1, then the Checksum field is present and contains valid information โ
.
If either the Checksum Present bit or the Routing Present bit is set, BOTH the Checksum and Offset fields are present in the GRE packet ๐ฏ.
Routing Present (bit 1)
If the Routing Present bit is set to 1, then it means the Offset and Routing fields are present and contain valid information ๐ฃ๏ธ.
If either the Checksum Present bit or the Routing Present bit is set, BOTH the Checksum and Offset fields are present in the GRE packet ๐ฏ.
Key Present (bit 2)
If the Key Present bit is set to 1, then the Key field is present in the GRE header ๐. Otherwise, the Key field is not present in the GRE header ๐.
Sequence Number Present (bit 3)
If the Sequence Number Present bit is set to 1, then the Sequence Number field is present ๐ข. Otherwise, the Sequence Number field is not present in the GRE header ๐ซ .
Strict Source Route (bit 4)
The meaning of the Strict Source Route bit is defined in other documents ๐. It's recommended that this bit only be set to 1 if all of the Routing Information consists of Strict Source Routes ๐งญ.
Recursion Control (bits 5-7)
Recursion control is a three bit unsigned integer. It holds the number of additional encapsulations that are permissible ๐. This SHOULD default to zero. ๐
Version Number (bits 13-15)
The Version Number field MUST contain the value 0. Other values are outside the scope of this document ๐ซ.
Protocol Type (2 octets)
The Protocol Type field holds the protocol type of the payload packet ๐ฆ. In general, the value will be the Ethernet protocol type field for the packet ๐ชช. Currently defined protocol types are listed below ๐. Additional values may be defined in other documents ๐.
Offset (2 octets)
The offset field tells you the octet offset from the start of the Routing field to the first octet of the active Source Route Entry to be examined ๐. This field is present if the Routing Present or the Checksum Present bit is set to 1, and it only contains valid information if the Routing Present bit is set to 1 ๐ฏ.
Checksum (2 octets)
The Checksum field has the IP (one's complement) checksum of the GRE header and the payload packet ๐งฎ. This field is present if the Routing Present or the Checksum Present bit is set to 1, and it only contains valid information if the Checksum Present bit is set to 1 โ
.
Key (4 octets)
The Key field is a four octet number that was inserted by the encapsulator ๐. The receiver can use it to authenticate the source of the packet ๐ต๏ธโโ๏ธ. How you actually determine authenticity is outside the scope of this document ๐. The Key field is only present if the Key Present field is set to 1.
Bestie, the authentication techniques aren't in this doc, so don't go hunting for them here ๐
Sequence Number (4 octets)
The Sequence Number field is an unsigned 32 bit integer that was inserted by the encapsulator ๐ข. The receiver can use it to work out the order in which packets were transmitted from the encapsulator to the receiver ๐ฌ. The exact algorithms for generating the Sequence Number and the semantics of receiving it are outside the scope of this document ๐ง .
Routing (variable)
The Routing field is optional. It's only present if the Routing Present bit is set to 1 ๐ฃ๏ธ.
The Routing field is a list of Source Route Entries (SREs). Each SRE has the form:
0 1 2 3
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Address Family | SRE Offset | SRE Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Routing Information ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The routing field ends with a "NULL" SRE. That one has an address family of type 0x0000 and a length of 0 ๐.
Address Family (2 octets)
The Address Family field is a two octet value that tells you the syntax and semantics of the Routing Information field ๐๏ธ. The values for this field, and the matching syntax and semantics for Routing Information, are defined in other documents ๐.
SRE Offset (1 octet)
The SRE Offset field is the octet offset from the start of the Routing Information field to the first octet of the active entry in the Source Route Entry that needs to be examined ๐ฏ.
SRE Length (1 octet)
The SRE Length field holds the number of octets in the SRE ๐. If the SRE Length is 0, that means this is the last SRE in the Routing field ๐.
Routing Information (variable)
The Routing Information field has data that may be used for routing this packet ๐บ๏ธ. The exact semantics of this field are defined in other documents ๐.
Forwarding of GRE packets ๐
Okay this part is so important ๐ญ. Normally, a system that's forwarding delivery layer packets won't treat GRE packets differently from any other packets ๐ซฅ. However, a GRE packet might get received by a system. In that case, the system should use some delivery-specific means to figure out that this is a GRE packet ๐ต๏ธ. Once that's determined, the Key, Sequence Number and Checksum fields can be checked, as long as they contain valid information according to their corresponding flags ๐. If the Routing Present bit is set to 1, then the Address Family field should be checked to determine the semantics and use of the SRE Length, SRE Offset and Routing Information fields ๐งฉ. The exact semantics for processing an SRE for each Address Family are defined in other documents ๐.
Once all SREs have been processed, the source route is complete ๐. The GRE header should be removed, and the payload's TTL MUST be decremented (if one exists). After that, the payload packet should be forwarded as a normal packet ๐. The exact forwarding method depends on the Protocol Type field ๐.
Current List of Protocol Types โจ
Okay bestie, here's the list of protocol types that are currently assigned for GRE ๐ฆ Future protocol types must be taken from DIX ethernet encoding, no cap. For historical reasons, a bunch of other values have been used for some protocols, which is messy but iconic ๐ The following table of values MUST be used to identify the protocols ๐
Protocol Family PTYPE
--------------- -----
Reserved 0000
SNA 0004
OSI network layer 00FE
PUP 0200
XNS 0600
IP 0800
Chaos 0804
RFC 826 ARP 0806
Frame Relay ARP 0808
VINES 0BAD
VINES Echo 0BAE
VINES Loopback 0BAF
DECnet (Phase IV) 6003
Transparent Ethernet Bridging 6558
Raw Frame Relay 6559
Apollo Domain 8019
Ethertalk (Appletalk) 809B
Novell IPX 8137
RFC 1144 TCP/IP compression 876B
IP Autonomous Systems 876C
Secure Data 876D
Reserved FFFF
For the complete list of these values, check the IANA list of Ether Types ๐ง
URL = ftp://ftp.isi.edu/in-notes/iana/assignments/ethernet-numbers.
References ๐
RFC 1479 Steenstrup, M. "Inter-Domain Policy Routing Protocol Specification: Version 1", RFC1479, BBN Systems and Technologies, July 1993.
RFC 1226 Kantor, B. "Internet Protocol Encapsulation of AX.25 Frames", RFC 1226, University of California, San Diego, May 1991.
RFC 1234 Provan, D. "Tunneling IPX Traffic through IP Networks", RFC 1234, Novell, Inc., June 1991.
RFC 1241 Woodburn, R., and D. Mills, "Scheme for an Internet Encapsulation Protocol: Version 1", RFC 1241, SAIC, University of Delaware, July 1991.
RFC 1326 Tsuchiya, P., "Mutual Encapsulation Considered Dangerous", RFC 1326, Bellcore, May 1992.
SDRP Estrin, D., Li, T., and Y. Rekhter, "Source Demand Routing Protocol Specification (Version 1)", Work in Progress.
RFC 1702 Hanks, S., Li, T., Farinacci, D., and P. Traina, "Generic Routing Encapsulation over IPv4 networks", RFC 1702, NetSmiths, Ltd., cisco Systems, October 1994.
Security Considerations ๐
Security issues are not discussed in this memo, so that's a whole plot twist ๐ญ
Acknowledgements ๐ซถ
The authors would like to shout out Yakov Rekhter (IBM) and Deborah Estrin (USC) for their advice, encouragement and insightful comments. Iconic support, honestly ๐
Authors' Addresses ๐ง
Stan Hanks
NetSmiths, Ltd.
2025 Lincoln Highway
Edison NJ, 08817
EMail: stan@netsmiths.com
Tony Li
cisco Systems, Inc.
1525 O'Brien Drive
Menlo Park, CA 94025
EMail: tli@cisco.com
Dino Farinacci
cisco Systems, Inc.
1525 O'Brien Drive
Menlo Park, CA 94025
EMail: dino@cisco.com
Paul Traina
cisco Systems, Inc.
1525 O'Brien Drive
Menlo Park, CA 94025
EMail: pst@cisco.com
๐ฆ where this page comes from
- ietf: rfc1701 1994-10
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms