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 form a GRE 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.

ISO Plain Language

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 inside IP uses IP protocol type 47, IP inside GRE uses Protocol Type 0x800, and source route entries can hold 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 and does not specify an Internet standard of any kind.

§1Introduction

An earlier memo, RFC 1701, described Generic Routing Encapsulation (GRE), a mechanism for encapsulating arbitrary packets within an arbitrary transport protocol. This companion memo describes the use of GRE with IP. It addresses three cases: IP as the delivery protocol, IP as the payload protocol, and the special case of IP as both delivery and payload. It also describes using IP addresses and autonomous system numbers as part of a GRE source route. The memo states that it does not specify an Internet standard of any kind.

GRE wraps one packet inside another packet of a chosen transport protocol. This note covers the cases where internet packets are the wrapper, the wrapped item, or both.

§2IP as Delivery Protocol and as Payload

GRE packets encapsulated within IP use IP protocol type 47. IP packets encapsulated within GRE carry a Protocol Type field of 0x800.

For the Address Family value 0x800, the Routing Information field consists of a list of IP addresses and indicates an IP source route. The first octet of the Routing Information field is an 8-bit integer offset from the start of the Source Route Entry (SRE), called the SRE Offset, which indicates the first octet of the next IP address. The SRE Length field is the total length of the IP address list in octets. For Address Family 0xfffe, the field consists of a list of autonomous system numbers and indicates an AS source route; the third octet is the SRE Offset, pointing at the first octet of the next AS number, and the SRE Length is the total length of the AS number list in octets.

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 ensure that no packet lives forever.

GRE inside IP is IP protocol type 47. IP inside GRE is marked 0x800. An inner IP packet keeps its own lifetime counter, and that counter must be reduced when the outer packet is opened, so no packet survives indefinitely.

§3IP and AS Source Routes

When a system processes an 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 is increased by four, the size of an IP address. If the SRE Offset equals the SRE Length, the Offset field in the GRE header is adjusted to point to the next SRE, if any. This repeats until the next IP destination is not this system or the whole SRE has been processed. If the source route is incomplete, the Strict Source Route bit is checked: for a strict route whose next IP destination is not an adjacent system, the packet MUST be dropped. Otherwise the system replaces the destination address in the delivery header with the address indicated by the offset and forwards the packet.

For an AS source route the same pattern applies with a two-octet step, the size of an autonomous system number. A system whose own autonomous system number matches the next one advances the offset by two and continues. If the source route is incomplete and the Strict Source Route bit is set while the next autonomous system is not an adjacent one, the packet should be dropped. Otherwise the system should use the autonomous system number indicated by the SRE Offset to replace the destination address in the delivery header and forward the packet. The exact mechanism for determining the next delivery destination address from an AS number is outside the scope of the memo.

The memo's Security Considerations section states only that security issues are not discussed.

A GRE source route lists the hops a packet should follow, either as IP addresses or as autonomous system numbers. Each system checks the list, skips past its own entry, and forwards the packet. A strict route drops the packet if the next hop is not a direct neighbor.

SOURCE ROUTE ENTRY HEADER (RFC 1702)
Source Route Entry (SRE)
FieldNameSizeValueDescription
ADDRESS-FAMILYAddress Family2 bytes0x800 for an IP address list, 0xfffe for an AS number list.
SRE-OFFSETSRE Offset1 byteOffset from the start of the SRE to the next address or number.
SRE-LENGTHSRE Length1 byteTotal length of the address or AS number list in octets.

§4References