RFC 1702 INFORMATIONAL TUNNELING · ROUTING · ENCAPSULATION

GRE over IPv4: Generic Routing Encapsulation over IPv4 networks

How GRE packets ride inside IP, how IP rides inside GRE, and how IP addresses and AS numbers can form a source route.

On rfc-editor.org ↗
PUBLISHED
October 1994
AUTHORS
S. Hanks, T. Li, D. Farinacci, P. Traina
STREAM
Legacy
IP PROTOCOL TYPE FOR GRE
47
PROTOCOL TYPE FOR IP PAYLOAD
0x800
ADDRESS FAMILY, IP SOURCE ROUTE
0x800
ADDRESS FAMILY, AS SOURCE ROUTE
0xfffe
OFFSET STEP, IP ADDRESS
4 octets
OFFSET STEP, AS NUMBER
2 octets
DOI
10.17487/RFC1702

RFC text

Contents
Original text · RFC Editor View on rfc-editor.org ↗
Network Working Group                                           S. Hanks
Request for Comments: 1702                               NetSmiths, Ltd.
Category: Informational                                            T. Li
                                                            D. Farinacci
                                                               P. Traina
                                                           cisco Systems
                                                            October 1994


            Generic Routing Encapsulation over IPv4 networks

Status of this Memo

   This memo provides information for the Internet community.  This memo
   does not specify an Internet standard of any kind.  Distribution of
   this memo is unlimited.

Introduction

   In an earlier memo [RFC 1701], we described GRE, a mechanism for
   encapsulating arbitrary packets within an arbitrary transport
   protocol.  This is a companion memo which describes the use of GRE
   with IP.  This memo addresses the case of using IP as the delivery
   protocol or the payload protocol and the special case of IP as both
   the delivery and payload.  This memo also describes using IP
   addresses and autonomous system numbers as part of a GRE source
   route.

IP as a delivery protocol

   GRE packets which are encapsulated within IP will use IP protocol
   type 47.

IP as a payload protocol

   IP packets will be encapsulated with a Protocol Type field of 0x800.

   For the Address Family value of 0x800, the Routing Information field
   will consist of a list of IP addresses and indicates an IP source
   route.  The first octet of the Routing Information field constitute a
   8 bit integer offset from the start of the Source Route Entry (SRE),
   called the SRE Offset.  The SRE Offset indicates the first octet of
   the next IP address.  The SRE Length field consists of the total
   length of the IP Address List in octets.

   This 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   |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                        IP Address List ...
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   For the Address Family value of 0xfffe, the Routing Information field
   will consist of a list of Autonomous System numbers and indicates an
   AS source route.  The third octet of the Routing Information field
   contains an 8 bit unsigned integer offset from the start of the
   Source Route Entry (SRE), called the SRE Offset.  The SRE Offset
   indicates the first octet of the next AS number.  THe SRE Length
   field consists of the total length of the AS Number list in octets.

       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   |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                         AS Number List ...
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP as both delivery and payload protocol

   When IP is encapsulated in IP, the TTL, TOS, and IP security options
   MAY be copied from the payload packet into the same fields in the
   delivery packet.  The payload packet's TTL MUST be decremented when
   the packet is decapsulated to insure that no packet lives forever.

IP source routes

   When a system is processing a SRE with an Address Family indicating
   an IP source route, it MUST use the SRE Offset to determine the next
   destination IP address.  If the next IP destination is this system,
   the SRE Offset field should be increased by four (the size of an IP
   address).  If the SRE Offset is equal to the SRE Length in this SRE,
   then the Offset field in the GRE header should be adjusted to point
   to the next SRE (if any).  This should be repeated until the next IP
   destination is not this system or until the entire SRE has been
   processed.

   If the source route is incomplete, then the Strict Source Route bit
   is checked.  If the source route is a strict source route and the
   next IP destination is NOT an adjacent system, the packet MUST be
   dropped.  Otherwise, the system should use the IP address indicated
   by the Offset field to replace the destination address in the
   delivery header and forward the packet.

Autonomous system source routes

   When a system is processing a SRE with an Address Family indicating
   an AS source route, it MUST use the SRE Offset field to determine the
   next autonomous system.  If the next autonomous system is the local
   autonomous system, the SRE Offset field should be increased by two
   (the size of an autonomous system number).  If the SRE Offset is
   equal to the SRE Length in this SRE, then the Offset field in the GRE
   header should be adjusted to point to the next SRE (if any).  This
   should be repeated until the next autonomous system number is not
   equal to the local autonomous system number or until the entire SRE
   has been processed.

   If the source route is incomplete, then the Strict Source Route bit
   is checked.  If the source route is a strict source route and the
   next autonomous system is NOT an adjacent autonomous system, the
   packet should be dropped.  Otherwise, the system should use the
   autonomous system number indicated by the SRE Offset field to replace
   the destination address in the delivery header and forward the
   packet.  The exact mechanism for determining the next delivery
   destination address given the AS number is outside of the scope of
   this document.

Security Considerations

   Security issues are not discussed in this memo.

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

References

   RFC 1701
      Hanks, S., Li, T, Farinacci, D., and P. Traina, "Generic Routing
      Encapsulation", RFC 1701, NetSmiths, Ltd., and cisco Systems,
      October 1994.

AI ELI5

On this page
PROBLEMRFC 1701 defined GRE as a way to wrap arbitrary packets in an arbitrary transport protocol, but it did not spell out what that means when the protocol involved is IP itself.
MECHANISMThis companion memo says GRE in IP uses IP protocol type 47, IP inside GRE uses Protocol Type 0x800, and it defines source route entries built from IP addresses (Address Family 0x800) or autonomous system numbers (0xfffe).
WHY IT MATTERSIt gives implementers the IPv4-specific rules for GRE. It is an Informational memo, not a standard.

§1Introduction

This memo is a companion to RFC 1701, which described GRE, a mechanism for encapsulating arbitrary packets within an arbitrary transport protocol. Here the focus is on IP: IP as the delivery protocol (the outer wrapper), IP as the payload protocol (the thing being carried), and the special case where IP is both.

The memo also describes how IP addresses and autonomous system numbers can be used as part of a GRE source route. It states plainly that it does not specify an Internet standard of any kind.

GRE is a way to put one kind of packet inside another. This note says how to do it when both the box and the thing in the box are internet packets.

§2IP as Delivery and as Payload

When GRE packets are carried inside IP, they use IP protocol type 47. When IP packets are carried inside GRE, the GRE Protocol Type field is set to 0x800.

When IP is wrapped in IP, the TTL, TOS and IP security options MAY be copied from the payload packet into the same fields of the delivery packet. The payload packet's TTL MUST be decremented when the packet is decapsulated, so that no packet lives forever.

The outer envelope gets a label saying it holds a GRE packet. The inner packet keeps its own life counter, and that counter must tick down when the envelope is opened so the packet cannot wander forever.

§3Source Route Entries

A source route lets the sender list the stops a packet should visit. In GRE, each list lives in a Source Route Entry (SRE) in the Routing Information field. Each SRE starts with an Address Family, an 8-bit SRE Offset that points to the first octet of the next address or number, and an 8-bit SRE Length giving the total length of the list in octets.

  • Address Family 0x800: the list holds IP addresses and forms an IP source route.
  • Address Family 0xfffe: the list holds autonomous system numbers and forms an AS source route.

A system processing an IP source route MUST use the SRE Offset to find the next destination. If that destination is the system itself, it advances the offset by four, the size of an IP address. For an AS source route the step is two, the size of an AS number. When the offset reaches the SRE Length, the offset in the GRE header should move on to the next SRE, if there is one. This repeats until the next hop is not this system or the whole SRE is used up.

If the route is incomplete, the Strict Source Route bit is checked. For a strict route whose next hop is not adjacent, the IP version says the packet MUST be dropped, and the AS version says it should be dropped. Otherwise the system puts the indicated address into the delivery header's destination and forwards the packet. For AS routes, how an AS number becomes a delivery address is outside the scope of the memo.

A source route is a list of stops written on the package. Each router crosses off its own name and sends the package to the next one. If the list says to go strictly stop by stop and the next stop is not a neighbor, the package is thrown away.

§4Security Considerations

The memo has nothing to say here. Its Security Considerations section states only that security issues are not discussed. Readers should not take that to mean the mechanisms described are free of security concerns; the RFC simply does not address them.

The authors did not write anything about safety in this note, so it does not tell us whether these tricks are safe.

§5References