Article ID: 241251 - Last Review: February 28, 2007 - Revision: 2.2 VPN Tunnels - GRE Protocol 47 Packet Description and UseThis article was previously published under Q241251 On This PageSUMMARY
The Generic Route Encapsulation (GRE) protocol is used in conjunction with Point-to-Point Tunneling Protocol (PPTP) to create virtual private networks (VPNs) between clients or between clients and servers.
MORE INFORMATION
One popular implementation is to use Microsoft's VPN technology between two Routing and Remote Access Services (RRAS) servers that are configured for LAN-to-LAN routing, as shown below:
Lclient L-RRAS ===== VPN ===== R-RRAS Rclient
| IP | | Internet | | IP |
-------------- ------------------- --------------
241252
(http://support.microsoft.com/kb/241252/EN-US/
)
VPN Tunnels - PPTP Protocol Packet Description and Use
The GRE packet format that Microsoft uses for encapsulating data has the following general form:
+-----------------------------------+ | Data Link (D/L) Header | +-----------------------------------+ | IP Header | +-----------------------------------+ | GRE Header | +-----------------------------------+ | PPP Header | +-----------------------------------+ | Encrypted PPP Payload | +-----------------------------------+ | Data Link Trailer | +-----------------------------------+ Using the diagram at the top of this section, an Internet Protocol (IP) packet from Lclient is first transmitted to the L-RRAS server. The IP packet is encrypted, given an additional PPP header, and then placed inside a GRE packet. The diagram below says "PPP stub" and not "PPP header" because the PPP header is also encrypted along with the data. Although it cannot see it, the GRE protocol is configured to know that a PPP header exists. The GRE packet with the encapsulated and encrypted data is sent across the Internet with a final destination of "R-RRAS server." The R-RRAS server strips off the GRE header and PPP header, and then transmits the decrypted data (IP packet) to Rclient.
Lclient L-RRAS ===== VPN ===== R-RRAS Rclient
| IP | | Internet | | IP |
-------------- ------------------- --------------
D/L header D/L header D/L header
IP header IP header IP header
Payload GRE header Payload
PPP stub
Payload (encrypted)
The Protocol HeaderTo understand how the GRE protocol works as an encapsulating protocol, you need to review the header format of the protocol. The GRE packet header as implemented by Microsoft has the following 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|A| Flags | Ver | Protocol Type |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Key (HW) Payload Length | Key (LW) Call ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Sequence Number (Optional) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Acknowledgment Number (Optional) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-----------------------------------------------------------------------+ | C | (Bit 0) Checksum Present. Set to zero (0). | +-----------------------------------------------------------------------+ | R | (Bit 1) Routing Present. Set to zero (0). | +-----------------------------------------------------------------------+ | K | (Bit 2) Key Present. Set to one (1). | +-----------------------------------------------------------------------+ | | (Bit 3) Sequence Number Present. Set to one (1) if a payload | | S | (data) packet is present. Set to zero (0) if payload is not | | | present (GRE packet is an Acknowledgment only). | +-----------------------------------------------------------------------+ | s | (Bit 4) Strict source route present. Set to zero (0). | +-----------------------------------------------------------------------+ | Recur | (Bits 5-7) Recursion control. Set to zero (0). | +-----------------------------------------------------------------------+ | | (Bit 8) Acknowledgment sequence number present. Set to one (1)| | A | if packet contains Acknowledgment Number to be used for | | | acknowledging previously transmitted data. | +-----------------------------------------------------------------------+ | Flags | (Bits 9-12) Must be set to zero (0). | +-----------------------------------------------------------------------+ | Ver | (Bits 13-15) Must contain 1 (enhanced GRE). | +-----------------------------------------------------------------------+ |=======================================================================| +-----------------------------------------------------------------------+ | Protocol Type | Set to hex 880B (for PPP). | +-----------------------------------------------------------------------+ | Key (HW) Payload Length | (High 2 octets of Key) Size of the payload, | | | not including the GRE header. | +-----------------------------------------------------------------------+ | Key (LW) Call ID | (Low 2 octets) Contains the Peer's Call ID | | | for the session to which this packet | | | belongs. | +-----------------------------------------------------------------------+ | Sequence Number | Contains the sequence number of the payload.| | | Present if S bit (Bit 3) is one (1). | +-----------------------------------------------------------------------+ | | Contains the sequence number of the highest | | Acknowledgment Number | numbered GRE packet received by the sending | | | peer for this user session. Present if A bit| | | (Bit 8) is one (1). | +-----------------------------------------------------------------------+ EnhancementsThe GRE protocol has several noteworthy enhancements. These are from Request for Comments (RFC) 2637.
Network Monitor TracesYou should note several things when you are looking at a Network Monitor trace. The flags summary is made up of the hexadecimal value of the first 16 bits. In the sample packet below, the flags summary is 12,417 or 0x3081h. The Microsoft Network Monitor parser does not represent the version number in the Flags Summary bit field, but it is there. For example, assume the following sample packet:
GRE: Flags Summary = 12417 (0x3081)
GRE: 0............... = Checksum Absent
GRE: .0.............. = Routing Absent
GRE: ..1............. = Key Present
GRE: ...1............ = Sequence Number Present
GRE: ....0........... = Strict Source Route Absent
GRE: ........1....... = Acknowledge Sequence Number Present
GRE: Recursion Control = 0 (0x0)
GRE: Ver = 1 (0x1)
GRE: Protocol Type = 0x880B
GRE: Key Length = 90 (0x5A)
GRE: Key Call ID = 32768 (0x8000)
GRE: Sequence Number = 16 (0x10)
GRE: Ack Number = 15 (0xF)
| Article Translations
|
Back to the top
