Configuring a GRE Tunnel
GRE provides a mechanism of encapsulating packets of a protocol into packets of another protocol. This allows packets to be transmitted over heterogeneous networks. The channel for transmitting heterogeneous packets is called a tunnel.
Usage Scenario
A single network protocol (for example, IPv4) is used to transmit packets on a backbone network, whereas other protocols, such as IPv6 and Internet Packet Exchange (IPX), are used to transmit packets on non-backbone networks. Because the backbone and non-backbone networks use different protocols, packets cannot be transmitted between the non-backbone networks over the backbone network. Generic Routing Encapsulation (GRE) resolves this issue. GRE provides a mechanism of encapsulating packets of a protocol into packets of another protocol.
Pre-configuration Tasks
Before configuring an ordinary GRE tunnel, complete the following task:
-
Configuring the Interface Bound to GRE
-
To enable the source interface or interface with the source IP address of a GRE tunnel to transmit GRE-encapsulated packets, the interface must be bound to GRE.
-
Configuring a Tunnel Interface
-
This section describes how to create a tunnel interface of a GRE tunnel to be established. After tunnel interfaces are created, set the encapsulation type to GRE and specify a tunnel source address or source interface, as well as a destination address for the GRE tunnel to be established. In addition, assign an IP address to the tunnel interface if a dynamic routing protocol is used.
-
Configuring Routes for the Tunnel
-
Routes for a tunnel must be available on both the source and destination devices so that packets encapsulated with GRE can be forwarded correctly. A route passing through tunnel interfaces can be a static route or a dynamic route.
-
(Optional) Configuring a TTL Processing Mode for a GRE Tunnel
-
To enable a GRE tunnel to process TTLs carried in packets, configure the GRE tunnel to process these TTLs in pipe or uniform mode.
-
(Optional) Enabling the Keepalive Function
-
You can enable the Keepalive function for a GRE tunnel to avoid selecting an unavailable GRE tunnel to transmit packets.
-
(Optional) Configuring GRE Security Options
-
Configuring GRE security options can improve GRE tunnel security.
-
Verifying the GRE Tunnel Configuration
-
After a GRE tunnel is set up, you can view the running status and routing information about the tunnel interface.