Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Generic routing encapsulation
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Cisco tunneling protocol}} {{Infobox networking protocol | title = Generic routing encapsulation | logo = | logo alt = | image = | image alt = | caption = | is stack = no | purpose = [[Tunneling protocol|Network tunneling]] | developer = [[Cisco Systems]] | date = 1994{{Ref RFC|1701}} | based on = | influenced = | osilayer = | ports = | rfcs = {{IETF RFC|1701|1702|2784|plainlink=yes}} | hardware = }} '''Generic routing encapsulation''' ('''GRE''') is a [[tunneling protocol]] developed by [[Cisco Systems]] that can [[Encapsulation (networking)|encapsulate]] a wide variety of [[network layer]] [[Protocol (computing)|protocols]] inside virtual [[Point-to-point (telecommunications)|point-to-point links]] or point-to-multipoint links over an [[Internet Protocol]] network.<ref>{{Cite patent|title=Generic routing encapsulation tunnel keepalives|country=US|number=7801021B1|invent1=Nikolaos Triantafillis|invent2=Robert J. Ordemann|invent3=Simon D. Barber|assign1=[[Cisco|Cisco Technology Inc.]]|gdate=2010-09-21|fdate=2002-07-01|url=https://patents.google.com/patent/US7801021B1/en}}</ref> ==Example uses== * In conjunction with [[Point-to-point tunneling protocol|PPTP]] to create [[VPN]]s. * In conjunction with [[IPsec]] [[VPN]]s to allow passing of routing information between connected networks. * In [[mobility management]] protocols. * In [[A12 Authentication|A8/A10]] interfaces to encapsulate IP data to/from Packet Control Function (PCF). * [[Linux]] and [[Berkeley Software Distribution|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 [[Communication endpoint|endpoint]]. ===Example protocol stack=== {|class="wikitable" ![[OSI model]] layer ![[Protocol (computing)|Protocol example]] |- |7. [[Application layer|Application]] |[[HTTP]] |- |4. [[Transport layer|Transport]] |[[Transmission Control Protocol|TCP]] |- |3. [[Network layer|Network]] <small>(GRE-encapsulated)</small> |[[IPv4]] |- |[[Encapsulation (networking)|Encapsulation]] |'''GRE''' |- |3. [[Network layer|Network]] |[[IPv6]] |- |2. [[Data link layer|Data link]] |[[Ethernet]] |- |1. [[Physical layer|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. ==Delivery protocols== GRE packets that are encapsulated within [[Internet Protocol|IP]] directly, use IP protocol [[List of IP protocol numbers|type 47]] in the IPv4 header's ''Protocol'' field{{Ref RFC|1702}} or the [[IPv6 header]]'s ''Next Header'' field.{{Ref RFC|7676}} For performance reasons, GRE can also be encapsulated in UDP packets.{{Ref RFC|8086}} Better throughput may be achieved by using [[Equal-cost multi-path routing]]. ==Packet header== ===Extended GRE packet header (RFC 2890)=== The extended version of the GRE [[Header (computing)|packet header]]{{Ref RFC|2890}} is represented below: :{| class="wikitable" style="text-align: center" |+Extended GRE header format |- !style="border-bottom:none; border-right:none;"|''Offsets'' !style="border-left:none;"|[[Octet (computing)|Octet]] !colspan="8"|0 !colspan="8"|1 !colspan="8"|2 !colspan="8"|3 |- !style="border-top: none"|[[Octet (computing)|Octet]] ![[Bit]] !style="width:2.75%;"|0 !style="width:2.75%;"|1 !style="width:2.75%;"|2 !style="width:2.75%;"|3 !style="width:2.75%;"|4 !style="width:2.75%;"|5 !style="width:2.75%;"|6 !style="width:2.75%;"|7 !style="width:2.75%;"|8 !style="width:2.75%;"|9 !style="width:2.75%;"|10 !style="width:2.75%;"|11 !style="width:2.75%;"|12 !style="width:2.75%;"|13 !style="width:2.75%;"|14 !style="width:2.75%;"|15 !style="width:2.75%;"|16 !style="width:2.75%;"|17 !style="width:2.75%;"|18 !style="width:2.75%;"|19 !style="width:2.75%;"|20 !style="width:2.75%;"|21 !style="width:2.75%;"|22 !style="width:2.75%;"|23 !style="width:2.75%;"|24 !style="width:2.75%;"|25 !style="width:2.75%;"|26 !style="width:2.75%;"|27 !style="width:2.75%;"|28 !style="width:2.75%;"|29 !style="width:2.75%;"|30 !style="width:2.75%;"|31 |- !0 !0 |''C'' | |''K'' |''S'' |colspan="9"|''Reserved 0'' |colspan="3"|''Version'' |colspan="16"|''Protocol Type'' |- !4 !32 |colspan="16"|''[[Checksum]] (optional)'' |colspan="16"|''Reserved 1 (optional)'' |- !8 !64 |colspan="32"|''Key (optional)'' |- !12 !96 |colspan="32"|''Sequence Number (optional)'' |} ; ''C (1 bit)'': [[Checksum]] bit. Set to 1 if a checksum is present. ; ''K (1 bit)'': Key bit. Set to 1 if a key is present. ; ''S (1 bit)'': Sequence number bit. Set to 1 if a sequence number is present. ; ''Reserved 0 (9 bits)'': Reserved bits; set to 0. ; ''Version (3 bits)'': GRE Version number; set to 0. ; ''Protocol Type (16 bits)'': Indicates the [[EtherType|ether protocol type]] of the encapsulated payload. (For [[IPv4]], this would be hex 0800.) ; ''Checksum (16 bits)'': Present if the ''C'' bit is set; contains the checksum for the GRE header and payload. ; ''Reserved 1 (16 bits)'': Present if the ''C'' bit is set; is set to 0. ; ''Key (32 bits)'': Present if the ''K'' bit is set; contains an application-specific key value. ; ''Sequence Number (32 bits)'': Present if the ''S'' bit is set; contains a sequence number for the GRE packet. ===Standard GRE packet header (RFC 2784)=== A standard GRE [[Header (computing)|packet header]] structure{{Ref RFC|2784}} is represented in the diagram below. :{| class="wikitable" style="text-align: center" |+Standard GRE header format |- !style="border-bottom:none; border-right:none;"|''Offsets'' !style="border-left:none;"|[[Octet (computing)|Octet]] !colspan="8"|0 !colspan="8"|1 !colspan="8"|2 !colspan="8"|3 |- !style="border-top: none"|[[Octet (computing)|Octet]] ![[Bit]] !style="width:2.75%;"|0 !style="width:2.75%;"|1 !style="width:2.75%;"|2 !style="width:2.75%;"|3 !style="width:2.75%;"|4 !style="width:2.75%;"|5 !style="width:2.75%;"|6 !style="width:2.75%;"|7 !style="width:2.75%;"|8 !style="width:2.75%;"|9 !style="width:2.75%;"|10 !style="width:2.75%;"|11 !style="width:2.75%;"|12 !style="width:2.75%;"|13 !style="width:2.75%;"|14 !style="width:2.75%;"|15 !style="width:2.75%;"|16 !style="width:2.75%;"|17 !style="width:2.75%;"|18 !style="width:2.75%;"|19 !style="width:2.75%;"|20 !style="width:2.75%;"|21 !style="width:2.75%;"|22 !style="width:2.75%;"|23 !style="width:2.75%;"|24 !style="width:2.75%;"|25 !style="width:2.75%;"|26 !style="width:2.75%;"|27 !style="width:2.75%;"|28 !style="width:2.75%;"|29 !style="width:2.75%;"|30 !style="width:2.75%;"|31 |- !0 !0 |''C'' |colspan="12"|''Reserved 0'' |colspan="3"|''Version'' |colspan="16"|''Protocol Type'' |- !4 !32 |colspan="16"|''[[Checksum]] (optional)'' |colspan="16"|''Reserved 1 (optional)'' |} ; ''C (1 bit)'': [[Checksum]] bit. Set to 1 if a checksum is present. ; ''Reserved 0 (12 bits)'': Reserved bits; set to 0. ; ''Version (3 bits)'': GRE Version number; set to 0. ; ''Protocol Type (16 bits)'': Indicates the [[EtherType|ether protocol type]] of the encapsulated payload. (For [[IPv4]], this would be [[hexadecimal]] 0x0800; for [[IPv6]], it would be 0x86DD.{{Ref RFC|7676}}) ; ''Checksum (16 bits)'': Present if the ''C'' bit is set; contains the checksum for the GRE header and payload. ; ''Reserved 1 (16 bits)'': Present if the ''C'' bit is set; its contents is set to 0. ===Original GRE packet header (RFC 1701)=== The newer structure superseded the original structure:{{Ref RFC|1701}} :{| class="wikitable" style="text-align: center" |+Original GRE header format |- !style="border-bottom:none; border-right:none;"|''Offsets'' !style="border-left:none;"|[[Octet (computing)|Octet]] !colspan="8"|0 !colspan="8"|1 !colspan="8"|2 !colspan="8"|3 |- !style="border-top: none"|[[Octet (computing)|Octet]] ![[Bit]] !style="width:2.75%;"|0 !style="width:2.75%;"|1 !style="width:2.75%;"|2 !style="width:2.75%;"|3 !style="width:2.75%;"|4 !style="width:2.75%;"|5 !style="width:2.75%;"|6 !style="width:2.75%;"|7 !style="width:2.75%;"|8 !style="width:2.75%;"|9 !style="width:2.75%;"|10 !style="width:2.75%;"|11 !style="width:2.75%;"|12 !style="width:2.75%;"|13 !style="width:2.75%;"|14 !style="width:2.75%;"|15 !style="width:2.75%;"|16 !style="width:2.75%;"|17 !style="width:2.75%;"|18 !style="width:2.75%;"|19 !style="width:2.75%;"|20 !style="width:2.75%;"|21 !style="width:2.75%;"|22 !style="width:2.75%;"|23 !style="width:2.75%;"|24 !style="width:2.75%;"|25 !style="width:2.75%;"|26 !style="width:2.75%;"|27 !style="width:2.75%;"|28 !style="width:2.75%;"|29 !style="width:2.75%;"|30 !style="width:2.75%;"|31 |- !0 !0 |''C'' |''R'' |''K'' |''S'' |''s'' |colspan="3"|''Recur'' |colspan="5"|''Flags'' |colspan="3"|''Version'' |colspan="16"|''Protocol Type'' |- !4 !32 |colspan="16"|''[[Checksum]] (optional)'' |colspan="16"|''Offset (optional)'' |- !8 !64 |colspan="32"|''Key (optional)'' |- !12 !96 |colspan="32"|''Sequence Number (optional)'' |- !16 !128 |colspan="32"|''Routing (optional, variable length)'' |} The original GRE RFC defined further fields in the packet header which became obsolete in the current standard: ; ''C (1 bit)'': [[Checksum]] bit. Set to 1 if a checksum is present. ; ''R (1 bit)'': Routing Bit. Set to 1 if Routing and Offset information are present. ; ''K (1 bit)'': Key bit. Set to 1 if a key is present. ; ''S (1 bit)'': Sequence number bit. Set to 1 if a sequence number is present. ; ''s (1 bit)'': Strict source route bit. ; ''Recur (3 bits)'': [[Recursion (computer science)|Recursion]] control bits. ; ''Flags (5 bits)'': Reserved for future use, set to 0. ; ''Version (3 bits)'': Set to 0. ; ''Protocol Type (16 bits)'': Indicates the [[EtherType|ether protocol type]] of the encapsulated payload. ; ''Checksum (16 bits)'': Present if the ''C'' bit is set; contains the checksum for the GRE header and payload. ; ''Offset (16 bits)'': 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 (32 bits)'': Present if the ''K'' bit is set; contains an application-specific key value. ; ''Sequence Number (32 bits)'': Present if the ''S'' bit is set; contains a sequence number for the GRE packet. ; ''Routing (variable)'': 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) {{Ref RFC|2637}} uses a variant GRE packet header structure, represented below. PPTP creates a GRE tunnel through which the PPTP GRE packets are sent. :{| class="wikitable" style="text-align: center" |+PPTP GRE header format |- !style="border-bottom:none; border-right:none;"|''Offsets'' !style="border-left:none;"|[[Octet (computing)|Octet]] !colspan="8"|0 !colspan="8"|1 !colspan="8"|2 !colspan="8"|3 |- !style="border-top: none"|[[Octet (computing)|Octet]] ![[Bit]] !style="width:2.75%;"|0 !style="width:2.75%;"|1 !style="width:2.75%;"|2 !style="width:2.75%;"|3 !style="width:2.75%;"|4 !style="width:2.75%;"|5 !style="width:2.75%;"|6 !style="width:2.75%;"|7 !style="width:2.75%;"|8 !style="width:2.75%;"|9 !style="width:2.75%;"|10 !style="width:2.75%;"|11 !style="width:2.75%;"|12 !style="width:2.75%;"|13 !style="width:2.75%;"|14 !style="width:2.75%;"|15 !style="width:2.75%;"|16 !style="width:2.75%;"|17 !style="width:2.75%;"|18 !style="width:2.75%;"|19 !style="width:2.75%;"|20 !style="width:2.75%;"|21 !style="width:2.75%;"|22 !style="width:2.75%;"|23 !style="width:2.75%;"|24 !style="width:2.75%;"|25 !style="width:2.75%;"|26 !style="width:2.75%;"|27 !style="width:2.75%;"|28 !style="width:2.75%;"|29 !style="width:2.75%;"|30 !style="width:2.75%;"|31 |- !0 !0 |''C'' |''R'' |''K'' |''S'' |''s'' |colspan="3"|''Recur'' |colspan="1"|''A'' |colspan="4"|''Flags'' |colspan="3"|''Version'' |colspan="16"|''Protocol Type'' |- !4 !32 |colspan="16"|''Key Payload Length'' |colspan="16"|''Key Call ID'' |- !8 !64 |colspan="32"|''Sequence Number (optional)'' |- !12 !96 |colspan="32"|''Acknowledgement Number (optional)'' |- |} ; ''C (1 bit)'': [[Checksum]] bit. For PPTP GRE packets, this is set to 0. ; ''R (1 bit)'': Routing bit. For PPTP GRE packets, this is set to 0. ; ''K (1 bit)'': Key bit. For PPTP GRE packets, this is set to 1. (All PPTP GRE packets carry a key.) ; ''S (1 bit)'': Sequence number bit. Set to 1 if a sequence number is supplied, indicating a PPTP GRE data packet. ; ''s (1 bit)'': Strict source route bit. For PPTP GRE packets, this is set to 0. ; ''Recur (3 bits)'': [[Recursion (computer science)|Recursion]] control bits. For PPTP GRE packets, these are set to 0. ; ''A (1 bit)'': Acknowledgment number present. Set to 1 if an acknowledgment number is supplied, indicating a PPTP GRE acknowledgment packet. ; ''Flags (4 bits)'': Flag bits. For PPTP GRE packets, these are set to 0. ; ''Version (3 bits)'': GRE Version number. For PPTP GRE packets, this is set to 1. ; ''Protocol Type (16 bits)'': For PPTP GRE packets, this is set to hex 880B. ; ''Key Payload Length (16 bits)'': Contains the size of the payload, not including the GRE header. ; ''Key Call ID (16 bits)'': Contains the Peer's Call ID for the session to which the packet belongs. ; ''Sequence Number (32 bits)'': Present if the S bit is set; contains the GRE payload sequence number. ; ''Acknowledgement Number (32 bits)'': Present if the A bit is set; contains the sequence number of the highest GRE payload packet received by the sender. ==Standards== * {{IETF RFC|1701|link=no}}: ''Generic Routing Encapsulation (GRE)'' (informational) * {{IETF RFC|1702|link=no}}: ''Generic Routing Encapsulation over IPv4 networks'' (informational) * {{IETF RFC|2637|link=no}}: ''Point to Point Tunneling Protocol'' (informational) * {{IETF RFC|2784|link=no}}: ''Generic Routing Encapsulation (GRE)'' (proposed standard, updated by RFC 2890) * {{IETF RFC|2890|link=no}}: ''Key and Sequence Number Extensions to GRE'' (proposed standard) * {{IETF RFC|8086|link=no}}: ''GRE-in-UDP Encapsulation'' (proposed standard) == See also == * [[Network Virtualization using Generic Routing Encapsulation]] - carries L2 packets over GRE * [[GPRS Tunnelling Protocol]] - GTP-U is similar to GRE and used in cellular networks ==References== {{reflist}} ==External links== {{Commons}} * [http://www.cisco.com/en/US/tech/tk827/tk369/tk287/tsd_technology_support_sub-protocol_home.html Generic Routing Encapsulation], Subprotocol homepage at Cisco * [http://docwiki.cisco.com/wiki/Internetworking_Terms:_Generic_Routing_Encapsulation_%28GRE%29 Generic Routing Encapsulation] {{Webarchive|url=https://web.archive.org/web/20181229224642/http://docwiki.cisco.com/wiki/Internetworking_Terms:_Generic_Routing_Encapsulation_%28GRE%29 |date=2018-12-29 }}, Entry in Cisco DocWiki (formerly known as the "Internetworking Technology Handbook") [[Category:Tunneling protocols]] [[Category:Cisco Systems]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite patent
(
edit
)
Template:Commons
(
edit
)
Template:IETF RFC
(
edit
)
Template:Infobox networking protocol
(
edit
)
Template:Ref RFC
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Webarchive
(
edit
)