gre wiki

通用路由封装(GRE)是一种由Cisco Systems开发的隧道协议,能够封装多种网络层协议,并通过IP网络进行传输。它广泛应用于创建虚拟专用网络(VPN)、传递路由信息及实现不同网络间的互连。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Generic Routing Encapsulation

From Wikipedia, the free encyclopedia
  (Redirected from GRE tunnel)

Generic Routing Encapsulation (GRE) is a tunneling protocol developed by Cisco Systems that can encapsulate a wide variety of network layer protocols inside virtualpoint-to-point links over an Internet Protocol network.

Example uses[edit]

  • In conjunction with PPTP to create VPNs.
  • In conjunction with IPsec VPNs to allow passing of routing information between connected networks.
  • In Mobility protocols.
  • In A8/A10 interfaces to encapsulate IP data to/from Packet Control Function (PCF).
  • Linux and 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 endpoint.

Example protocol stack[edit]

OSI model layer Protocol
5. SessionX.225
4. TransportUDP
3. Network (GRE-encapsulated)IPv6
EncapsulationGRE
3. NetworkIPv4
2. Data LinkEthernet
1. PhysicalEthernet 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.

IP as a delivery protocol[edit]

GRE packets that are encapsulated within IP use IP protocol type 47.[1]

Packet header[edit]

Standard GRE Packet Header[edit]

A standard GRE packet header structure, as defined by RFC 2784 and RFC 2890, is represented in the diagram below.

Bits 0–3 4–12 13–15 16–31
C KSReserved0VersionProtocol Type
Checksum (optional)Reserved1 (optional)
Key (optional)
Sequence Number (optional)
C
Checksum bit. Set to 1 if a checksum is present.
K
Key bit. Set to 1 if a key is present.
S
Sequence number bit. Set to 1 if a sequence number is present.
Reserved0
Reserved bits; set to 0.
Version
GRE Version number; set to 0.
Protocol Type
Indicates the  ether protocol type of the encapsulated payload. (For  IPv4, this would be hex 0800.)
Checksum
Present if the C bit is set; contains the checksum for the GRE header and payload.
Reserved1
Present if the C bit is set; is set to 0.
Key
Present if the K bit is set; contains an application-specific key value.
Sequence Number
Present if the S bit is set; contains a sequence number for the GRE packet.

PPTP GRE Packet Header[edit]

The Point-to-Point Tunneling Protocol (PPTP), defined in RFC 2637, uses a variant GRE packet header structure, represented below. PPTP creates a GRE tunnel through which the PPTP GRE packets are sent.

Bits 0–4 5–7 8 9-12 13–15 16–31
CRKSsRecurAFlagsVersionProtocol Type
Key Payload LengthKey Call ID
Sequence Number (optional)
Acknowledgement Number (optional)
C
Checksum bit. For PPTP GRE packets, this is set to 0.
R
Routing bit. For PPTP GRE packets, this is set to 0.
K
Key bit. For PPTP GRE packets, this is set to 1. (All PPTP GRE packets carry a key.)
S
Sequence number bit. Set to 1 if a sequence number is supplied, indicating a PPTP GRE data packet.
s
Strict source route bit. For PPTP GRE packets, this is set to 0.
Recur
Recursion control bits. For PPTP GRE packets, these are set to 0.
A
Acknowledgement number present. Set to 1 if an acknowledgement number is supplied, indicating a PPTP GRE acknowledgement packet.
Flags
Flag bits. For PPTP GRE packets, these are set to 0.
Version
GRE Version number. For PPTP GRE packets, this is set to 1.
Protocol Type
For PPTP GRE packets, this is set to hex 880B.
Key Payload Length
Contains the size of the payload, not including the GRE header.
Key Call ID
Contains the Peer's Call ID for the session to which the packet belongs.
Sequence Number
Present if the S bit is set; contains the GRE payload sequence number.
Acknowledgement Number
Present if the A bit is set; contains the sequence number of the highest GRE payload packet received by the sender.

Standards[edit]

  • RFC 1701Generic Routing Encapsulation (GRE) (informational)
  • RFC 1702Generic Routing Encapsulation over IPv4 networks (informational)
  • RFC 2637Point to Point Tunneling Protocol (informational)
  • RFC 2784Generic Routing Encapsulation (GRE) (proposed standard, updated by RFC 2890)
  • RFC 2890Key and Sequence Number Extensions to GRE (proposed standard)

References[edit]

  1. Jump up^ RFC 1702: Generic Routing Encapsulation over IPv4 networks. October 1994.

External links[edit]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值